This post demonstrates how to install Debian as a server, meaning with no desktop environment. It includes a video and a step-by-step written procedure. I often use Debian as a server in the field and I work with it in my webinars and video courses.
Note: I recommend downloading the latest version of Debian.
Minimum & Recommended Requirements
- CPU: 1 GHz
- For virtual machines, two logical CPUs is recommended.
- RAM: 512 MB
- Recommended 2 GB
- Drive space: 2 GB
- 10 GB recommended
Video Demonstration
This video demonstrates how to:
- Locate and download the Debian .iso image.
- Setup a virtual machine in VirtualBox.
- Create a NAT network in VirtualBox.
- Install Debian 10 as a server (command line only and no GUI).
- Update the operating system and install programs.
- Configure the hostname, static IP address, and DNS server address.
- Configure port forwarding in VirtualBox.
- SSH into the new virtual machine.
Duration: 54 minutes.
In the video I am using a Windows 10 computer with VirtualBox version 6.1 installed.
See below for links and step-by-steps. Enjoy!
Links
- Debian can be downloaded from this link
- VirtualBox can be downloaded from this link
- VirtualBox virtual networking documentation: link
I chose VirtualBox for this tutorial because it is free and it runs on most operating systems. But you are free to use another virtualization platform if you wish (VMware Workstation, ESXi, KVM, Xen, Proxmox, and so on). If you are using another platform, then I assume you know what you are doing. On this webpage I focus mostly on VirtualBox. (However, during my webinars, KVM is my go to tool. Check it out here if you haven't already!)
Note: If you use VMware workstation, put your initial virtual machine in "My Computer" and not "Shared". Reason being, you can't clone VMs in the Shared section, which you will need to do later.
Step-by-step Debian installation instructions
-
To get used to working with the keyboard only, select the second option "Install" instead of "Graphic install".
-
Name the server debserver, the domain is example.com
-
Write down or memorize your root password
-
Create a user account named user
-
For the partitioning method select "Guided – use entire disk"
-
For the partitioning scheme select "All files in one partition"
-
Finish, and write the changes to disk
-
Select "No" for scanning another disc
-
If you are unsure, use the deb.debian.org mirror
-
Most of you will not use an HTTP proxy
-
Important! Software selection:
- Deselect "Debian desktop environment" and "print server"
- Select "SSH server"
-
Install the GRUB boot loader to the main device.
-
Reboot, login as root and check for Internet connectivity.
Example: ping example.com
Note: Configure Debian as shown above (and in the video) and follow the additional steps below.
Debian Configurations
-
Update Debian
First check for any updates to the OS and apps:
apt update
Then, if any are available, and you are comfortable installing them, issue this comand:
apt upgrade
-
Install packages
In the following command we are installing vim as our default text editor, curl to be able to transfer data via HTTP and other protocols, and git so that we can access and download Github repositories.
apt install vim curl git
-
Modify the hostname
We want our hostname to be:
debserver.example.com
Modify this in
/etc/hostname
.
I use vim during the video, but if you wish, you can use nano which is built in to Debian.
Examples:vim /etc/hostname
nano /etc/hostname
Which editor you use doesn't matter to me, as long as you get the job done. However, if you want to follow along with what I am doing, I suggest using vim.
You could also type the following command to change the hostname:hostnamectl set-hostname debserver.example.com
Note: You will find that Linux is constantly evolving. You could also omit the "set-" portion of the above command in many distributions of Linux.
-
Set a static IP address
Not all servers use a static IP, but many do. You will have to configure the IP address manually. Do this in
/etc/network/interfaces
. Changedhcp
tostatic
and add the following information:
address 10.0.2.4/24
gateway 10.0.2.1
Your actual IP address can be different. The one I am using above is 10.0.2.4. The one I used in the video is 10.0.2.16/24. It doesn't make much of a difference what you use, as long as you know and remember what it is.
Note: It is okay to use the current IP address that was assigned by the DHCP server. To find out what this is type
ip a
. To find out the current gateway address, typeip r
. (I may use other IP addresses during live webinars.)
This portion of your interfaces configuration file should now look something like this:
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet static
address 10.0.2.4/24
gateway 10.0.2.1
-
Modify the DNS server IP address
Do this in
/etc/resolv.conf
Remove any content that is there and add the following:
nameserver 10.0.2.1
Warning: Using the nameserver 10.0.2.1 makes use of VirtualBox's built in DNS forwarding capability, which is often slower than just using your LAN's DNS address. Be ready for slower pings and other responses from Internet hosts. If it is too slow, or simply doesn't work, use the DNS server IP on your LAN (the one used by your SOHO router, or other device).
-
Reboot the system
-
Check your work
Use
ip a
to verify your IP address. Useip route show
to verify your default gateway. Verify the DNS configuration here:/etc/resolv.conf
. Finally, ping a website domain to verify Internet connectivity. For example,ping example.com
. You should get successful results similar to the following:
PING example.com (93.184.216.34) 56(84) bytes of data.
64 bytes from 93.184.216.34 (93.184.216.34): icmp_seq=1 ttl=58 time=12.7 ms
64 bytes from 93.184.216.34 (93.184.216.34): icmp_seq=2 ttl=58 time=15.9 ms
-
Setup SSH capability
This is shown in the previous video and the step-by-step procedure here.
Note: You might also be interested in changing the resolution and font type. If so, see this article
That's it!
Your Debian server should now be set up. Enjoy! Or, if you have any questions, feel free to ask here or at my Discord server.