Jan 31, 2023 4 min read

How to Install Debian Server

How to Install Debian Server
Table of Contents
⚠️
As of the writing of this article, VirtualBox can automatically install Debian when you finish creating the virtual machine. However, it will not install Debian as a server—instead, it will install as a client with the Gnome desktop. To install as a proper server you will have to disable automatic installations in VirtualBox.

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.

  • 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!

  • 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

  1. To get used to working with the keyboard only, select the second option "Install" instead of "Graphic install".

  2. Name the server debserver, the domain is example.com

  3. Write down or memorize your root password

  4. Create a user account named user

  5. For the partitioning method select "Guided – use entire disk"

  6. For the partitioning scheme select "All files in one partition"

  7. Finish, and write the changes to disk

  8. Select "No" for scanning another disc

  9. If you are unsure, use the deb.debian.org mirror

  10. Most of you will not use an HTTP proxy

  11. Important! Software selection:

    • Deselect "Debian desktop environment" and "print server"
    • Select "SSH server"
  12. Install the GRUB boot loader to the main device.

  13. 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. Change dhcp to static 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, type ip 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. Use ip 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.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Prowse Tech.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.