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.

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).

  1. Grab a copy of the Debian netinstall. Since we're at RIT, mirrors.rit.edu is a good way to do this.
  2. 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.
  3. 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.
  4. 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 command sudo ufw allow SSH to allow SSH access, and then sudo ufw enable to turn it on. You can use ip a to get the IP address of your VM. At this point your VM will be about the same as a plain VPS.
  5. 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.
  6. 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 using ssh://<VM_IP_HERE>
  7. 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.
    1. Use sudo apt install tmux weechat to install tmux and WeeChat (a command-line IRC client).
    2. Use tmux new -s irc and then weechat to run WeeChat in tmux.
    3. Use Ctrl+b and then press d to put tmux in the background.
    4. Use tmux attach -t irc to get back to WeeChat.
    5. In WeeChat, use /server add freenode chat.freenode.net to add the FreeNode IRC network.
    6. In WeeChat, use /connect freenode to connect to the FreeNode network.
    7. In WeeChat, use /join #rit-foss to join the RIT FOSS channel.
    8. Say hi!
    9. You can close WeeChat with /disconnect, and kill tmux with tmux kill-session -t irc
    The WeeChat Quick Start Guide be found here.
  8. Let's also set up a quick web server.
    1. Run sudo apt install apache2 to install Apache.
    2. Use sudo adduser <YOUR_USERNAME> www-data to let your user change files on the web server.
    3. The default directory for the web server is /var/www/html, cd into it.
    4. Delete or move the default homepage (index.html) using rm or mv, respectively.
    5. 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>
                  
    6. Next, allow access to the web server in UFW with sudo ufw allow WWW ("WWW" in caps).
    You should now be able to open a web browser, type in your VM's IP address and see your page.
  9. Finally, let's throw in PHP.
    1. Install PHP with sudo apt install php libapache2-mod-php
    2. Make your page a PHP file with mv index.html index.php
    3. Replace Hello World! with <?php echo("Hello World (from PHP)!"); ?>
    4. Reload your page
    Voila!

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):

RITlug Announcement Post

License

This workshop is available under CC BY-SA 4.0