Setting up a web server in Debian
Requirements
- Hypervisor: VirtualBox
- Host OS: Windows 11/10 - MacOS (for Intel CPUs)
- Guest OS: Debian
- 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: Install VirtualBox
- Go to virtualbox.org and download the installer for your operating system:
- Click on the Download button
- On the VirtualBox Platform packages, select your Operating System
- Download the Extension Pack by clicking on the “Accept and Download” button
- Download the Microsoft Visual C++ Redistributable
- Install the Microsoft Visual C++ Redistributable
- Install VirtualBox
- Install The VirtualBox Extension pack
Screenhots
Step 2: Create a Debian Virtual Machine
Files to download:
- Debian ISO
- Got to Debian.org and click on download
- Create a virtual machine where Debian will be installed.
- Follow the steps in this presentation:
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