Setting up a web server in Debian
READ ME
This guide assumes the following:
- You have installed Virtualbox
- You know how to create a Debian virtual machine
If you do have not installed Virtualbox, or do not know how to create a virtual machine, follow steps 1, 2 and 3 of Lab 2. This guide starts from the point of creating a Debian 13 Web Server Virtual Machine.
Requirements
- Hypervisor: VirtualBox
- Host OS: Windows 11/10 or MacOS (Intel/Apple Silicon)
- Guest OS: Debian 13 (NO GUI)
- Server Application: Apache
- Other:
- SSH - For remote management of the server virtual machine
Host Machine System Requirements
- CPU: Quad core CPU or higher
- RAM: 8GB or More
- Free Storage: 60GB or more
Guest Machine System Requirements
- CPU: 1 Core
- RAM: 1 GB
- Free Storage: 20 GB
Step 1: Create a virtual machine
Step 2: Create a Debian Virtual Machine
Files to download:
- Download the Debian ISO. Which Debian ISO Should You Download?
Your Computer Type | CPU Type | ISO File to Download | Download Link |
---|---|---|---|
Windows 11/10 | Intel or AMD (x86_64) | debian-13.0.0-amd64-netinst.iso | Download -> Click the black Download button |
macOS (Intel) | Intel (x86_64) | debian-13.0.0-amd64-netinst.iso | Download -> Click the black Download button |
macOS (Apple Silicon) | ARM (arm64) | debian-13.0.0-arm64-netinst.iso | Direct Link |
- Create a virtual machine where Debian will be installed that meets the following specifications:
- RAM: 1GB
- CPU: 1
- Storage: 20GB
- Follow the steps in this presentation as a general guide and adjust the settings accordingly.
Step 3: Install Debian
- Turn on the virtual machine and install Debian.
- Follow the steps in this presentation:
Step 4: Update
sudo apt update && sudo apt upgrade -y
Step 5: Configure the server
- Check that Apache is enabled and running. Use the following command:
systemctl status apache2
- Check that SSH is enabled and running. Use the following command:
systemctl status ssh
- Install UFW. Use the following command:
sudo apt install ufw
- Enable UFW. Use the following command:
sudo ufw enable
- Configure UFW to allow http(s) and ssh traffic
sudo ufw allow 'WWW Full'
sudo ufw allow 'Apache'
Step 6: Check if the web server is working
At this point you should be able to see the default apache index.html site.
- Get the IP address of your virtual machine:
hostname -I
- Open a web browser in your host machine and type the IP address in the URL bar.
Step 6: Remote Access to the server
- In your host OS, you will need to open a terminal application and use the SSH command.
- Here is the general formula of the ssh command:
From this point on, we can manage the server from our Host OS
Step 7: Adding content to our web server
sudo apt update && sudo apt upgrade sudo apt install ufw sudo ufw app list sudo ufw allow ‘WWW Full’ sudo ufw allow ‘OpenSSH’ sudo ufw enable sudo chown -R rap:www-data /var/www/html sudo chmod -R 775 /var/www/html
Upload files to the web server