Post installation script for Ubuntu server 22.04.
Go to file
allan c1767f0ab4 Fixed typo 2024-05-24 14:57:38 +02:00 Fixed typo 2024-05-24 14:57:38 +02:00
ubuntu-postinstall Logic changes 2024-05-08 07:49:56 +00:00

Post install script for Ubuntu 22.04 server


A clean Ubuntu 22.04 server although this should work on Ubuntu 20.04 as well.


This will configure sshd with the following.
PermitRootLogin no
PasswordAuthentication no

So be sure to have your public keys in place or you wont be able to login after the script has completed.

Download the script

git clone


cd ubuntu-postinstall
sudo ./ubuntu-postinstall [-n] <hostname or fqdn> [-i] <ip>=<ipaddr or dhcp> [-g] <gateway>=<ipaddr> [-t] <timezone>=<dk est pst cst utc> [-s] <sync time via ntp>=<y or n> [-help] help

Example 1

cd ubuntu-postinstall
sudo ./postinstall -n host1.hostname -i dhcp -t est -s n

Example 2

cd ubuntu-postinstall
sudo ./postinstall -n host1.hostname -i -g -t dk -s y

Additional software beeing installed

apt-transport-https - colordiff - dnsutils - expect - facter - fdupes - fping - htop - iftop - iotop - mailutils - mcrypt - net-tools - nfs-common - nmap - ntpdate - plocate - postfix - saidar - software-properties-common - sshpass - traceroute


In order to get rid of popups for kernel updates and reloading of services when doing apt update etc. the needrestart.conf has been modified.


Nothing to do.

More guides can be found on []

Last tested

January 12th 2024 on Ubuntu 22.04.