Quoted Strings

Post Installation of Ubuntu Server LTS

  2025/06/27

Posted Tag: #Linux
Other Tags: #Windows, #Personal, #All

After installing Ubuntu Server LTS there is what I would call personalization. Personalizing for the server you want it to be such as a data server, a server for visualization and Docker. This what my servers really are. So I going to take you through creating such a server.

First of all getting connected to the server. If running any distribution of Linux, Windows 10 or Windows 11 they are all the same. SSH or Secure Shell is installed on all of them. Well you have to explicitly install it on most Linux distributions. After installation of Ubuntu Server LTS in my last post, you should still have a monitor and keyboard attached. Type ip a to get the current assigned IP address of the server. Remember it or write it down if IP address you don't deal with them enough to just remember it. Now in bash on Linux or a Command Prompt in Windows type cmd in a search and then type SSH [email protected] being the server IP address. And if the user name you used was server, you will get a question about accepting the connection where you type yes and then the server password. What you get in Linux or Windows looks really the same.

Updates

First update the server.

sudo apt update
sudo apt upgrade

Network

This is only if you want a static IP address and a network bridge. Both of which you can establish here. If not using a static address the bridge below will not function properly since the provided DHCP address may change. Belowsudo su is to enter root access so your password is required.

ip a - Record you network device such as enp1S0

sudo su

cd /

Highlight, copy and paste the below into a text file so you can edit it. Then paste the edited into the SSH session followed by enter. 

Under ethernets list any devices listed such as en01 in my case. We are disabling DHCP on all the devices for the bridge. I create this bridge interface for use with virtual machines named in my case br10. via is your gateway address. The nameservers are 1.1.1.1 Cloudflare and 8.8.8.8 Google for DNS. Do not forget the final EOF.

cat << EOF > /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: false
      dhcp6: false
      optional: true
    eno1:
      dhcp4: false
      dhcp6: false
      optional: true
  bridges:
    br10:
      interfaces: [enp1s0]
      dhcp4: false
      dhcp6: false
      addresses: [192.168.00.00/24]
      routes:
        - to: default
          via: 192.168.00.1
          metric: 100
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]
      parameters:
        stp: false
EOF

netplan --debug generate
netplan apply

You will have just lost your SSH session. Connect again and use the static IP address you specified with SSH server@new address.

RSA Key Pair Access

I use a RSA key pair for secure connection to the server from my Arch Linux installation. Not sure how you can do this in Windows other than if you use PuTTY. Do the below unless you have previously generated the pair.

ssh-keygen -t rsa -b 4096

A secret key id_rsa and an public key id_rsa.pubon Linux is in the hidden directory .ssh in your home directory. First exit root access. For 00.00 use your address.

exit

scp ~/.ssh/id_rsa.pub [email protected]:
ssh [email protected]
chmod 700 ~/.ssh
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
rm ~/id_rsa.pub
chmod 600 ~/.ssh/authorized_keys

Use exit to exit the SSH session and type ssh server@new address again and no password is needed.

In a bash session on your Linux distribution, type the below if you generated the key pair above. Not needed if you have already done the key pair before. This records the association for other SSH sessions.

eval $(ssh-agent)

ssh-add

If you are using a key pair for access, change these settings in sshd_config on the server.

sudo nano /etc/ssh/sshd_config

PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
UsePAM no 

sudo service ssh restart

After this passwords will not function for access.

Setting Your Timezone

timezone=$(curl --fail --silent https://ipapi.co/timezone)
sudo ln -sf /usr/share/zoneinfo/$timezone /etc/localtime

To check your server date and time type timedatectl and you should get the below. Of course if your timezone is east coast US.

               Local time: Thu 2025-06-26 23:02:56 EDT
           Universal time: Fri 2025-06-27 03:02:56 UTC
                 RTC time: Fri 2025-06-27 03:02:56
                Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

Snap Removal

Here is something I do because I do not want Snap on my servers. It is a Ubuntu application distribution protocol not needed on servers. The last portion does not allow Snap and things such as Ubuntu-Advantage installation again in the future.

sudo su

systemctl disable snapd.service
systemctl disable snapd.socket
systemctl disable snapd.seeded.service
rm -rf /var/cache/snapd/
apt autoremove --purge snapd
rm -rf ~/snap

cat << EOF > /etc/apt/preferences.d/ignored-packages
Package: snapd cloud-init landscape-common popularity-contest ubuntu-advantage-tools
Pin: release *
Pin-Priority: -1
EOF

That does it for post installation of Ubuntu Server LTS. Next I will talk about ZFS and data storage.

Wish to add a comment? Please include your name to display in your comment or anonymous.

Your email address will never be shared with anyone.

Email me a comment to post it.