The Ultimate Ubuntu Server Install 24.04LTS

From ScottWiki
Jump to navigation Jump to search

Noble Numbat

Main Installation

The main installation is slightly different in 22.04LTS, insert the Ubuntu Server (LTS 22.04LTS Live) installation CD/USB/DVD and follow the onscreen instructions. If you don’t understand the questions asked by the installer put the keyboard down and switch everything thing off and go back to being a user. You will be asked to select.

Language
Keyboard
Type of Ubuntu Install - Choose "Install Ubuntu"

Network Configuration: Use the cursor keys to configure the network interface with a static IP address. (set the IPv6 option to Do Not Use) Internet Proxy: Set to whatever you user (none if you don't user one) Select Install SSH server with relevant options (if you want to use certs etc)

Disk Partitioning

When prompted choose

Use An Entire Disk

This will configure the system disk, with automatic boot / root / swap partitions. You can specify extra disks later and mount them if needed. You can also enter manual mode and select other disks and choose your mount points.

If you want to be safe, disconnect all disks apart from the one on which you want the do the install, (then add them later)



root@solaris:/home/sysadmin# lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                       8:0    0   3.6T  0 disk /srv/media
sdb                       8:16   0  12.7T  0 disk
├─vg--backup-lv--cctv   252:0    0     1T  0 lvm  /srv/cctv
└─vg--backup-lv--backup 252:1    0  11.7T  0 lvm  /srv/backup
sdc                       8:32   0   3.6T  0 disk
└─vg--data-lv--data     252:2    0     3T  0 lvm  /srv/data
sr0                      11:0    1  1024M  0 rom
nvme0n1                 259:0    0 465.8G  0 disk
├─nvme0n1p1             259:1    0     1G  0 part /boot/efi
└─nvme0n1p2             259:2    0 464.7G  0 part /

You can edit the disk partitions before submitting to add further disks at specific mount points. Mount points used were.. (which in this case were manually configured as I did not want to lose existing data)

/srv/media (using ext4)
/srv/data (using ext4)
/srv/backup (using ext4)

User Config

When prompted create the system login user / password The server will install the basics, set up your user / timezone etc. Eventually you will be prompted to Reboot.

Reboot Now

Set up software repositories and update system

We need to add additional repositories so we can download all the nice pieces of software and grab all the security updates, we do this by editing the config file listing the repositories.

sudo nano /etc/apt/sources.list

Note: sudo elevates you to ROOT status, by typing sudo –s before you begin maintains your elevated status so you don’t have to keep typing sudo; nano is a simple text editor. Note that ‘#’ and ‘;’ indicates the line has been commented out.

Comment / Uncomment and repositories you wish to use.

Now we have to get Ubuntu to update its internal repository database

sudo apt update

Now we can do a full distribution upgrade which gets us all the latest patches and fixes.

sudo apt dist-upgrade

Say yes to accept the installation. The dist upgrade may take some time to install,

You probably then want to update any of the minor packages.

sudo apt upgrade

Answer yes to any of the upgrade questions. After it is probably wise to reboot and make sure everything is still good. Especially as you have probably got your self an updated linux kernel.

sudo reboot

SSH Server

Check that SSH server is working, Run a PuTTY session to the server and check connectivity.

nano /etc/ssh/sshd_config

And change

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

You can toggle PasswordAuthentication yes /no to allow you to copy the key with the command.

ssh-copy-id username@hostname  (keep it all short)
ssh-keygen (you may need to run this command 1st if you don't have a keypair, (VM machine)

As a one off, key exchange.

systemctl reload ssh

To reload ssh (after changing this file) - Do this securely via OpenVPN. Keep a session open while you test the new login.

Fix the console text scroll speed (if there is an issue when using NVIDIA drivers)

THIS IS NOW FIXED WITH NEWER NVIDIA DRIVERS

nano /etc/default/grub

Update the relevant line ... (this will force the console into VGA(ish) mode)

GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity vga=0x307"

Now update the grub loader

update-grub

Allow IP routing internally

nano /etc/sysctl.d/local.conf

Add the following line.

net.ipv4.ip_forward=1

Then to load this issue...

systemctl restart procps.service


Network Interface Configuration

Configure a network bridge to present a single interface to the world, this is handy for VMs / VPNs etc. as we only need to reference the bridge. (br0:) 18.04 uses netplan to configure its network configuration.

The following steps will set up a bridge with a static IP address.

Change to the netplan directory.

cd /etc/netplan
nano 00-solaris.yaml  (default netplan config)


Content of the 00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1: {}

  bridges:
    br0:
      critical: true
      dhcp4: false
      addresses: [ 10.3.200.1/16 ]
      gateway4: 10.3.1.1
      nameservers:
        search: [ scottworld.net ]
        addresses: [ 10.3.200.1 ]
      interfaces: [ eno1 ]
      parameters:
        stp: false


Here is an example if you have dual nics and want to team / bond them.


network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0: {}
    enp2s0: {}

  bonds:
    bond007:
      interfaces:
      - enp1s0
      - enp2s0
      parameters:
        mode: balance-alb

  bridges:
    br0:
      critical: true
      dhcp4: false
      addresses: [ 192.168.3.200/24 ]
      gateway4: 192.168.3.1
      nameservers:
        search: [ scottworld.net ]
        addresses: [ 192.168.3.200 ]
      interfaces: [ bond007 ]
      parameters:
        stp: false


Disable the cloud network configuration.

nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

Add this statement to the empty file.

network: {config: disabled}

Apply the changes

netplan --debug apply

Reboot and check the network configuration with

ifconfig

You should have an interface of br0: with the ip you specified.


br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.3.200.1  netmask 255.255.0.0  broadcast 10.3.255.255
        inet6 fe80::e05f:5eff:fe91:2710  prefixlen 64  scopeid 0x20<link>
        ether e2:5f:5e:91:27:10  txqueuelen 1000  (Ethernet)
        RX packets 102046183  bytes 83297677991 (83.2 GB)
        RX errors 0  dropped 2  overruns 0  frame 0
        TX packets 42949657  bytes 671852183457 (671.8 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

NVIDIA Driver Install

Installing the drivers on servers and/or for computing purposes You can either rely on automatic detection, which will install the driver that is considered the best match for your hardware:

sudo ubuntu-drivers install --gpgpu

Or you can tell the ubuntu-drivers tool which driver you would like installed. If this is the case, you will have to use the driver version (such as 525) and the -server suffix that you saw when you used the ubuntu-drivers list --gpgpu command.

Let’s assume we want to install the 525-server driver (listed as nvidia-driver-525-server):

sudo ubuntu-drivers install --gpgpu nvidia:525-server

You will also want to install the following additional components:

sudo apt install nvidia-utils-525-server

Further Configurations

Continue with

  • = Optional.

Network / DNS Config

Bind9 (DNS) Installation 24.04LTS
Time server chrony Installation 24.04LTS
DHCP Server Installation 24.04LTS
Dynamic DNS setup 24.04LTS *

Security / Monitoring.

Logwatch Installation 24.04LTS
Fail2ban installation 24.04LTS

KVM Configuration

Configure KVM 24.04LTS

Setup SSL Certs for apache etc in OVH

Certificate Provisioning 24.04LTS


LAMP Stack / Web Servers / Databases

LAMP Stack Installation 24.04LTS
Configure MySQL 24.04LTS
Apache Configuration 24.04LTS
PHP Configuration 24.04LTS
PhpMyadmin Installation 24.04LTS

Torrents / File shares / Time

Transmission Daemon Installation 24.04LTS *
Samba Installation 24.04LTS *

Media Gaming

Generic Gaming Server Setup 24.04LTS
Plex Media Server installation 24.04LTS *
Teamspeak Server Installation 24.04LTS *
Steam Client Install *

Open VPN

Open VPN Install 24.04LTS *

Next Cloud / Scottcloud

Next Cloud Installation 24.04LTS *

Wikipedia

MediaWiki Installation 24.04LTS *

Backups

Amanda Backup Server Installation 24.04LTS *
Amanda File Recovery 24.04LTS