How to Install Ubuntu Server 24.04


Overview
This article will teach us how to:
Install Ubuntu Server 24.04 on a laptop from scratch
Install Ubuntu server by using Vagrant tool with ISO image
Prerequisites:
A laptop without any OS installed;
A virtualization software Virtualbox that Vagrant uses to create virtual machines.
Vagrant which automates the setup and provisioning of virtual machines.
Installing Ubuntu Server on Laptop
Installing Ubuntu Server on a laptop is a straightforward process, though it involves several steps:
Go to the Ubuntu Server Download Page and click the download link to get the ISO file. In this hands-on, Ubuntu Server 24.04.1 LTS version was downloaded and used as a base image.
Download a balenaEtcher, a USB creation tool that allows you to create bootable media.
Now, when balenaEtcher is downloaded as a
.zip
file, extract it with theunzip
command:After extraction, you will find an executable file with
.AppImage
extension.Insert your USB drive with at least 4 GB of space into your computer.
Run the balenaEtcher, select the downloaded Ubuntu Server ISO, choose the USB drive, and start the flashing process:
💡This process will erase all data on the USB drive, so make sure to back up any important files.Insert the bootable USB drive into your laptop, restart your laptop, and enter the boot menu (usually by pressing
F12
on the Dell laptop).💡If you have any important data on your laptop, back it up as the installation process may erase the entire disk.Select the USB drive from the boot options and press
Enter
.Choose the language you want to use for the installation process.
Select your preferred keyboard layout.
Choose the type of installation.
Configure Network:
If your network is not found among other networks, you can continue without a network and later configure the network at your own pace.
If your system requires a proxy to connect to the Internet, configure your Proxy.
If you use an alternative mirror for Ubuntu, enter the Mirror address details.
Set Up the Storage:
💡In this hands-on, an entire disk was chosen for the Ubuntu Server OS, however choosing the entire disk is not recommended since it will erase all data on the disk, making it unsuitable if you need to preserve existing data or partitions.Create a user account by entering your name, the server name, and a username and password for the system.
If you plan to access your server remotely, choose to install the OpenSSH server.
Confirm the installation details and start the process. The installer will copy the files and configure the system. This may take some time.
Once the installation is complete, remove the installation media and press
Enter
to reboot.Log in with the username and password you created during the installation.
Your Ubuntu Server installation is now complete. You can start using it as a server or install additional services as needed.
Install Ubuntu Server via Vagrant
To install Ubuntu Server manually using a Vagrant machine with a downloaded ISO file, follow these steps:
Edit the
Vagrantfile
to configure the virtual machine and specify that it should boot from the ISO file:Vagrant.configure("2") do |config| config.vm.box = "bento/ubuntu-20.04" config.vm.provider "virtualbox" do |vb| vb.gui = true # Ensure the boot order prioritizes booting from the virtual DVD drive vb.customize ["modifyvm", :id, "--boot1", "dvd", "--boot2", "disk"] # Attach the ISO file to the VM as a virtual DVD drive to the existing SATA controller vb.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", "path/to/your/ubuntu-24.04.1-live-server-amd64.iso"] # Create and attach a virtual hard disk to the SATA controller for installation vb.customize ["createhd", "--filename", "ubuntu-server-disk.vdi", "--size", 20000] # creates a 20 GB virtual hard disk that the Ubuntu Server can be installed on. vb.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "ubuntu-server-disk.vdi"] #the new virtual hard disk is attached to the SATA controller # Optionally increase VM resources (like memory or CPU) vb.memory = "4096" vb.cpus = 2 end # Configure a bridged network config.vm.network "public_network", bridge: "wlo1: Wi-Fi (Home)" #This configuration forwards requests made to port 2222 on your host machine to port 22 on the Vagrant guest machine config.vm.network "forwarded_port", guest: 22, host: 2222, auto_correct: true end
Replace
"path/to/your/ubuntu-server.iso"
with the actual path to the Ubuntu Server ISO file on your system.Once your
Vagrantfile
is ready, you can boot the machine:vagrant up
This will start the virtual machine and boot from the ISO file to install Ubuntu Server on the virtual hard disk.
Since the ISO is loaded, the Ubuntu Server installation screen will appear. You should now be able to install Ubuntu Server as if you were on physical hardware. Proceed with the standard Ubuntu Server installation steps within the VM.
After installation is complete, you may see an error “
Failed unmounting crdom.mount /cdrom
“, which means that the installation medium (ISO image) is still mounted in the virtual machine's virtual CD-ROM drive. Power off the VM to make sure that the ISO file is detached from the virtual machine so that the system can reboot from the newly installed Ubuntu Server operating system on the virtual hard disk.Now edit the Vagrantfile to change the boot order to boot directly from the virtual hard disk (where the OS was already installed).
# Ensure the boot order prioritizes booting from the virtual DVD drive vb.customize ["modifyvm", :id, "--boot1", "dvd", "--boot2", "disk"]
💡The default boot order typically prioritizes the hard disk once an operating system is installed.To access your Ubuntu Server installed via VirtualBox with
vagrant ssh
, you need to ensure that the VM is configured to allow SSH access. Power on the server through VirtualBox again and install SSH to be able to interact with the Ubuntu Server directly via the terminal:sudo apt install openssh-server sudo systemctl enable ssh #to start the service at boot sudo systemctl start ssh sudo systemctl status ssh
Now that SSH is running on your Ubuntu Server, we need to update the
Vagrantfile
to handle SSH connections correctly:Vagrant.configure("2") do |config| # Use the existing box or manually installed Ubuntu Server config.vm.box = "bento/ubuntu-20.04" config.vm.provider "virtualbox" do |vb| # Ensure the boot order prioritizes the hard disk vb.customize ["modifyvm", :id, "--boot1", "disk", "--boot2", "dvd"] # Optionally increase VM resources vb.memory = 4096 vb.cpus = 2 end # SSH Configurations #config.vm.network "public_network", bridge: "wlo1: Wi-Fi (Home)" # Adjust to your network interface config.vm.network "forwarded_port", guest: 22, host: 2222, auto_correct: true # Forward SSH port # Use vagrant's default insecure key (no need for password) config.ssh.username = "vagrant" # Ensure this matches the username created during Ubuntu installation config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key" # Ensure key matches end
If Ubuntu Server was installed manually and a
vagrant
user was not created, create one now. Vagrant expects to use a uservagrant
with passwordless SSH access.sudo adduser vagrant sudo usermod -aG sudo vagrant
Add Vagrant’s Public Key: The default Vagrant SSH key needs to be added to the
vagrant
user’sauthorized_keys
. Copy Vagrant's default insecure public key to thevagrant
user’s SSH directory to allow passwordless SSH access.sudo mkdir /home/vagrant/.ssh sudo curl -Lo /home/vagrant/.ssh/authorized_keys https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub sudo chown -R vagrant:vagrant /home/vagrant/.ssh sudo chmod 700 /home/vagrant/.ssh sudo chmod 600 /home/vagrant/.ssh/authorized_keys
- Adding the Vagrant public key ensures Vagrant can authenticate using the default key and configuring
authorized_keys
and permissions resolves any SSH authentication issues.
- Adding the Vagrant public key ensures Vagrant can authenticate using the default key and configuring
Now that the
Vagrantfile
was updated and thevagrant
user was set up, reload the Vagrant configuration:vagrant reload
💡If you encounter “Warning. Authentication failure. Retrying…“ you can ignore it by pressing Ctrl+CAt this point, the VM should be up and running. On the host machine, run the following:
ssh -i ~/.vagrant.d/insecure_private_key -p 2222 vagrant@localhost
If you can successfully SSH into the server, it confirms that the SSH configuration is correct. Enter the password of your Ubuntu Server if needed.
You can also run the following:
vagrant ssh
References
Subscribe to my newsletter
Read articles from Karlygash Yakiyayeva directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Karlygash Yakiyayeva
Karlygash Yakiyayeva
Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.