Local CS131 Server Setup Guide
⚠️ WARNING
This guide assumes a test server creation. The sudo command is used throughout. Do not copy and paste these commands into your own machine, or any server of importance, unless you are sure you know what you are doing (or otherwise prompted).
1 Step 1: Set Up Server to Accept Username/Password
-
Update and upgrade your system's packages:
sudo apt update && sudo apt upgrade -
Press
[Y]or[Enter]when prompted. -
Install and enable SSH for remote access:
sudo apt install openssh-server && \ sudo systemctl enable ssh && \ sudo ufw allow ssh -
Install the micro text editor:
sudo snap install micro --classic -
Edit SSH configuration to enable username and password authentication:
sudo micro /etc/ssh/sshd_config- Ensure there is no comment sign
#beforePasswordAuthenticationand changePasswordAuthenticationfromnotoyes.
- Ensure there is no comment sign
-
Save changes and restart the SSH service:
sudo systemctl restart sshd && sudo systemctl daemon-reload
2 Step 2: Install zsh and oh-my-zsh
-
Install
zsh:sudo apt install zsh -y -
Install
curlandgit:sudo apt install git curl -
Install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -
Follow the prompts, entering your password when required.
3 Step 3: Install Podman
-
Install Podman:
sudo apt install podman -
Test Podman with a Hello World image:
podman run hello-world -
Create a shared image storage location:
sudo mkdir /var/lib/shared-images && \ sudo podman --root /var/lib/shared-images/ pull docker.io/harveymudd/cs131 && \ sudo podman --root /var/lib/shared-images image ls
4 Step 4: Configure Podman
-
Create and configure a system-wide
storage.conffile:sudo micro /etc/containers/storage.conf- Paste the appropriate configuration settings to enable image sharing without redownloading.
-
Update permissions to ensure all users can access the images:
sudo chmod -R a+rX /var/lib/shared-images/
5 Step 5: Set Up User Templates
-
Copy the
.oh-my-zshdirectory and.zshrcconfiguration file into/etc/skelto set defaults for new users:sudo cp -r ~/.oh-my-zsh /etc/skel/.oh-my-zsh && \ sudo micro ~/.zshrc && \ sudo cp ~/.zshrc /etc/skel/.zshrc -
Initialize configurations:
source ~/.zshrc
6 Step 6: Create a New User
-
Create a new user
user001and set a simple password:sudo useradd -m -c "Test User 001" -s /bin/zsh user001 && \ sudo passwd user001 -
Ensure the user has access to shared images:
sudo chmod -R a+rX /var/lib/shared-images/
7 Step 7: Login as a CS131 Student
-
SSH into the server as
user001:ssh user001@cs131.cs.hmc.edu -
Enter the password set earlier.
-
Launch the CS131 environment using the alias from
.zshrc:cs131env
8 Step 8: Configure User Memory Limits
-
Become root and configure memory limits for users:
su && \ cd /etc/systemd/system && \ mkdir -p /etc/systemd/system/user-.slice.d && \ micro /etc/systemd/system/user-.slice.d/50-memory.conf -
Set the memory limit and reload the system daemon:
systemctl daemon-reload
9 Step 9: Test Memory Limits
- Use
htopto monitor memory usage and test with resource-intensive commands.