How To Install Ubuntu 24.04 on Hetzner root server

In this post we will cover the installation process of Ubuntu 24.04 server on a hetzner dedicated server. Hetzner is a popular choice for affordable, high-performance dedicated hosting. At CloudSpinx, we proudly offer expert consultancy services for Hetzner Cloud hosting, ensuring seamless deployment, optimization, and management. The Hetzner root servers give you full control over the physical hardware resources, and the ability to customize the installation, server configurations, and being able to install a hypervisor for running virtual machines.

In this guide, we’ll walk you through the steps required to deploy Ubuntu 24.04 on your Hetzner root server with the server booted into rescue system. So let’s get started.

Log in to the Hetzner Robot interface > Server > “Server Name” > Rescue. Select Linux and activate rescue system.

List disks available on the server:

# lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                       7:0    0   3.2G  1 loop
sda                         8:0    0 447.1G  0 disk
sdb                         8:16   0 447.1G  0 disk

1. Create installation config

Create a new server installation configuration file.

vim config.txt

Feel free to modify below installation config file. To set encryption password, disks used, raid level, and disk partitioning.

CRYPTPASSWORD StrongCryptPassw0rd
DRIVE1 /dev/sda
DRIVE2 /dev/sdb
SWRAID 1         # Enable software Raid
SWRAIDLEVEL 0    # Use software raid level 0, use 1 for raid level 1
BOOTLOADER grub
HOSTNAME dserver.cloudspinx.com #Server hostname
PART /boot ext4 800M
PART lvm vg0 all # Create LVM Volume group which uses all space

### Customize disk allocations accordingly ###
LV vg0 root / xfs 50G
LV vg0 var_lib_libvirt /var/lib/libvirt xfs 600G

IMAGE /root/images/Ubuntu-2404-noble-amd64-base.tar.gz

Remember to customize disk partition to your liking before you begin os installation.

2. Install Ubuntu 24.04 on hetzner dedicated server

Once done run the command below to begin installation.

installimage -a -c config.txt

It is also possible to perform the setup from text ui editor by just running the installimage command. After choosing OS image to use, a text editor will be started, from where you can edit the configuration file.

# installimage

Expected installation output:


                Hetzner Online GmbH - installimage

  Your server will be installed now, this will take some minutes
             You can abort at any time with CTRL+C ...

         :  Reading configuration                           done
         :  Loading image file variables                    done
         :  Loading ubuntu specific functions               done
   1/18  :  Deleting partitions                             done
   2/18  :  Test partition size                             done
   3/18  :  Creating partitions and /etc/fstab              done
   4/18  :  Creating software RAID level 0                  done
   5/18  :  Encrypt partitions and create /etc/crypttab     done
   6/18  :  Creating LVM volumes                            done
   7/18  :  Formatting partitions
         :    formatting /dev/md/0 with ext4                done
         :    formatting /dev/vg0/root with xfs             done
         :    formatting /dev/vg0/var_lib_libvirt with xfs  done
   8/18  :  Mounting partitions                             done
   9/18  :  Sync time via ntp                               done
         :  Importing public key for image validation       done
  10/18  :  Validating image before starting extraction     done
  11/18  :  Extracting image (local)                        done
  12/18  :  Setting up network config                       done
  13/18  :  Executing additional commands
         :    Setting hostname                              done
         :    Generating new SSH keys                       done
         :    Generating mdadm config                       done
         :    Generating ramdisk                            done
         :    Generating ntp config                         done
  14/18  :  Setting up miscellaneous files                  done
  15/18  :  Configuring authentication
         :    Fetching SSH keys                             done
         :    Disabling root password                       done
         :    Disabling SSH root login with password        done
         :    Copying SSH keys                              done
  16/18  :  Installing bootloader grub                      done
  17/18  :  Running some ubuntu specific functions          done
  18/18  :  Clearing log files                              done

                  INSTALLATION COMPLETE
   You can now reboot and log in to your new system with the
 same credentials that you used to log into the rescue system.

3. Reboot the system

After the installation is complete, perform a reboot on the server.

reboot

Give it some minutes to come back online, then SSH into your fresh Ubuntu 24.04 system:

ssh root@<your-server-ip>

Update system packages to make sure it’s latest.

apt update && apt upgrade -y

Disabling root user login (Optional)

For better security you can disable root user ssh login. But before then, you will need to create a new user. In the example given, we are creating a user called cloud.

adduser cloud
usermod -aG sudo cloud

Edit the ssh configuration file to disable root login.

# nano /etc/ssh/sshd_config
PermitRootLogin no

Restart ssh daemon after the change:

systemctl restart ssh

Optionally, allow ssh service and activate UFW firewall service.

ufw allow OpenSSH
ufw enable

Confirm:

# ufw status
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

More articles from us:

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

One of the most effective control panels for web hosting that is used to host websites and administer web servers […]

Beekeeper Studio is an open-source completely free cross-platform SQL editor and database manager. It is available for Mac, Linux, and […]

OpenResty® is a full-featured web platform that uses our improved Nginx core to scale online applications and services. Its purpose […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.