Skip to main content
  1. Posts/

Ubuntu Server

·966 words·5 mins
CoeusLabs
Author
CoeusLabs
Passionate self-hosting enthusiast sharing insights and experiences in homelab deployment and Linux. Not a professional, but always eager to learn and help others.

What is it and why?
#

To start our homelab, the first thing we need is a server. This server will be the foundation for all future projects. Essentially, we need a computer on which we can install our OS. This computer will serve as our server—a machine dedicated to storing and serving data, without the need for a fancy interface, monitor, keyboard, or mouse (though these will be necessary during the OS installation). Once the OS is installed, you can remove the peripherals, leaving only the power cable and an Ethernet cable connected to the server.

Creating a Bootable USB
#

First, we’ll need a USB drive and an ‘.iso’ image of our desired OS. In this case, we will use Ubuntu Server. You can download it from here. After downloading the image, we’ll need to create a bootable USB using a tool called ‘Rufus,’ available here. Open Rufus, select the USB drive you want to use, then choose the ‘.iso’ image you downloaded and click ‘Start’. Once the process is complete, you will have a bootable USB with Ubuntu Server on it.

Installing Ubuntu Server
#

With our bootable USB ready, we can begin installing Ubuntu Server. Plug the USB into the server and boot from it. Enter the BIOS of the server by pressing F2, Del, or Esc during the boot process. In the BIOS, navigate to the ‘Boot’ tab and change the boot order so that the USB is first. Save and exit the BIOS. The server will now boot from the USB, presenting you with the Ubuntu Server installation screen. Press Enter on the first option to start the installation.

Default Settings
#

The initial screens display default information; simply press ‘Next’. Note that the mouse is not used in this OS since it is the server version, but don’t worry, you won’t need it.

Here are some default settings such as language and keyboard configuration. However, there’s one screen where we typically enter some information that we will skip for now. I’ve encountered issues during server reboots when including this step, so we’ll complete it later to avoid any problems.

Partitioning
#

Since this will be used as a server, we can leave the default setting to use the entire disk.

Keep in mind any data on the disk will be erased, so make sure you have a backup of any important data.

User Creation
#

After partitioning, you will be asked to create a user. This user will be the main user on the server with sudo rights. You will also be asked to create a password for this user. Remember this password as you will need it to log in to the server. You will also encounter a screen asking if you want Ubuntu Pro, a paid service, which you can skip.

Services
#

Next, you are prompted to install some services. On the first screen, select to install the OpenSSH server, allowing remote connections to the server. On the second screen, you can choose to install additional services; we will install Docker for future use.

Finishing Up
#

After completing these steps, we can rest while the installation finishes. Once done, you will be prompted to remove the USB and press enter. The server will reboot, and you will be greeted with the login screen. Log in with the user credentials you created during the installation.

Network Configuration
#

Remember the step we skipped during installation? We’ll complete it now. To do this, we need to edit the network configuration file. First, we need to know what to write to that file. Type sudo apt install net-tools in the terminal to install the necessary tool, then type ifconfig to display network information. Identify the interface connected to the internet, typically named enp0s3 or eth0. Note the IP address, subnet mask, and gateway.

Navigate to the network configuration file in /etc/netplan/ using the command cd /etc/netplan/. Edit the file by running sudo nano name.yaml, replacing “name” with the actual file name, which you can find by running ls. Start typing the file name and press Tab to auto-complete it. Once open, you will see something like this:

Overwrite the file with the values noted earlier in the following format:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp0s31f6: #replace with your interface name
      dhcp4: no
      addresses: [192.168.64.4/24] # IP address and subnet mask from ifconfig, adding /24 at the end
      gateway4: 192.168.64.255 # Gateway IP address from ifconfig
      nameservers:
        addresses: [1.1.1.1] # Cloudflare DNS (feel free to use any other)

Save the file by pressing Ctrl + O and then Enter, and exit by pressing Ctrl + X. Apply the changes by running sudo netplan apply. Verify the changes with ip a, which will display the network interfaces and their configuration. If successful, the new configuration will be visible.

Remote Access
#

Congratulations! You have successfully installed Ubuntu Server. You can now disconnect everything from the server except the power cable and Ethernet cable, and manage it remotely using SSH.

From your main PC or laptop, connect to the server for the first time. If using Linux, open the terminal. If using Windows, use Command Prompt or PowerShell. Alternatively, I highly recommend downloading Tabby, a user-friendly terminal emulator that can store your login info for SSH sessions.

To connect to the server, type ssh username@ip in your terminal, replacing “username” with the user you created during installation and “ip” with the server’s IP address. Enter the password for the user you created. Once logged in, this will be your primary method of accessing the server.

The End
#

That’s it! You have successfully installed Ubuntu Server, providing the base for all future projects in our homelab. In the next post, we will install additional services to enhance the server’s functionality.