Time: About 1 hour (Linux installs are slow & typing takes time, particularly for those who haven't done this before); it helps if you have people download Debian as they enter.
RITlug Announcement Post In this workshop, we will be creating a personal server that you can easily deploy yourself at home on a Raspberry Pi or a VPS (the cloud).
- Grab a copy of the Debian netinstall. Since we're at RIT, mirrors.rit.edu is a good way to do this.
- Create a new virtual machine in VMware Workstation (since it's on the lab machines and we don't want to spend the whole time debugging a variety of hardware, operating systems, and virtualization software). Just do the recommended settings. By default the VM won't be given a lot of resources, but that's fine since it's close to a Raspberry Pi or a cheap VPS.
-
Boot up the VM and install Debian. There are a couple screens to note. First, don't set a root password (otherwise you might not get the
sudo
package). Second,/dev/sda
is the virtual disk, if prompted use it. Third, since we're at RIT, find and use mirrors.rit.edu. Fourth, in the software selection screen make sure ONLY "standard system utilities" is selected. We don't need a GUI, and GNOME will make your VM slow in addition to adding a significant amount of time to your install. Also leave "SSH Server" unchecked since I want to show a manual install of that. -
Log into your VM through the VMware console window and run the command
sudo apt install openssh-server ufw
and type Y (then enter) when prompted. OpenSSH Server allows us SSH access, and UFW gives us a simple firewall to protect the VM. Run the commandsudo ufw allow SSH
to allow SSH access, and thensudo ufw enable
to turn it on. You can useip a
to get the IP address of your VM. At this point your VM will be about the same as a plain VPS. -
To make this experience more real, close the VMware window and click "run in background" when prompted.
Now open PuTTY for an SSH terminal and log into your VM.
OpenSSH Server also provides an SFTP server out of the box.
You can see this by opening FileZilla, entering your VM's login information, and putting 22 as the port (or
sftp://
preceeding the VM's IP). SFTP is more secure than normal FTP, which transmits passwords as plaintext, so I recommend using it. It's possible to set up FTP so it doesn't do this, but SFTP is already there and you can't always count on getting a properly set up FTP server. -
You can do Git over SSH if you install the package using
sudo apt install git
and when using your Git client (or IDE plugin) of choice you can set a remote usingssh://<VM_IP_HERE>
-
Another convenient thing you can do on a VPS is IRC.
Since we don't want it being the only thing running, we're also going to install tmux.
- Use
sudo apt install tmux weechat
to install tmux and WeeChat (a command-line IRC client). - Use
tmux new -s irc
and thenweechat
to run WeeChat in tmux. - Use Ctrl+b and then press d to put tmux in the background.
- Use
tmux attach -t irc
to get back to WeeChat. - In WeeChat, use
/server add freenode chat.freenode.net
to add the FreeNode IRC network. - In WeeChat, use
/connect freenode
to connect to the FreeNode network. - In WeeChat, use
/join #rit-foss
to join the RIT FOSS channel. - Say hi!
- You can close WeeChat with
/disconnect
, and kill tmux withtmux kill-session -t irc
- Use
-
Let's also set up a quick web server.
- Run
sudo apt install apache2
to install Apache. - Use
sudo adduser <YOUR_USERNAME> www-data
to let your user change files on the web server. - The default directory for the web server is
/var/www/html
,cd
into it. - Delete or move the default homepage (
index.html
) usingrm
ormv
, respectively. -
Create a simple index.html using your editor of choice. Here's an example:
<!DOCTYPE html> <html> <head> <title>Simple website | YOUR NAME HERE</title> </head> <body> <h1>Hello World!</h1> <p>Put something here</p> </body> </html>
- Next, allow access to the web server in UFW with
sudo ufw allow WWW
("WWW" in caps).
- Run
-
Finally, let's throw in PHP.
- Install PHP with
sudo apt install php libapache2-mod-php
- Make your page a PHP file with
mv index.html index.php
- Replace
Hello World!
with<?php echo("Hello World (from PHP)!"); ?>
- Reload your page
- Install PHP with
If you're doing this as a workshop and still have time to spare, some ideas for more are: MariaDB/MySQL, Nextcloud, GitLab/Gitea/Gogs, and Docker.
Resources for more things you can do on your own time (on DigitalOcean, warning: may for an older version of Debian):
License
This workshop is available under CC BY-SA 4.0