The Ultimate Ubuntu Server Install 20.04LTS

From ScottWiki
Jump to navigation Jump to search

Main Installation

The main installation is slightly different in 20.04LTS, insert the Ubuntu Server (LTS 20.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 where you want the install, (then add them later)



root@solaris:/opt/mediawiki# lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  86.6M  1 loop /snap/core/4486
loop1    7:1    0  86.6M  1 loop /snap/core/4650
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 465.3G  0 part /
sdb      8:16   0   5.5T  0 disk
└─sdb1   8:17   0   5.5T  0 part /srv/data
sdc      8:32   0   2.7T  0 disk
└─sdc1   8:33   0   2.7T  0 part /srv/media
sdd      8:48   0 931.5G  0 disk
└─sdd1   8:49   0 931.5G  0 part /srv/backup
sr0     11:0    1  1024M  0 rom


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
<pre>

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) ==

<pre>
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-installer-config.yaml  (default netplan config)


Content of the 00-installer-config.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1: {}

  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: [ 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 192.168.3.200  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::8844:aff:fe67:ef14  prefixlen 64  scopeid 0x20<link>
        ether 8a:44:0a:67:ef:14  txqueuelen 1000  (Ethernet)
        RX packets 23464422  bytes 9513732953 (9.5 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6353547  bytes 53276355156 (53.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 6c:3b:e5:1b:e8:fb  txqueuelen 1000  (Ethernet)
        RX packets 25170973  bytes 10035606810 (10.0 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 40336930  bytes 55285023271 (55.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf7c00000-f7c20000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1754201  bytes 2338671140 (2.3 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1754201  bytes 2338671140 (2.3 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

NVIDIA Driver Install

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"

Then we can install the relevant drivers.


 apt install nvidia-headless-450 libnvidia-encode-450

Further Configurations

Continue with

  • = Optional.

Network / DNS Config

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

Security / Monitoring.

Logwatch Installation
Fail2ban installation

KVM Configuration

Configure KVM

Setup SSL Certs for apache etc in OVH

Certificate Provisioning


LAMP Stack / Web Servers / Databases

LAMP Stack Installation 18.04
Configure MySQL
Apache Configuration
PHP Configuration
PhpMyadmin Installation

Torrents / File shares / Time

Transmission Daemon Installation *
Samba Installation *
NTP Daemon Installation (deprecated use chrony)

Media Gaming

Generic Gaming Server Setup *
Plex Media Server installation *
Teamspeak Server Installation *
OpenHAB Installation *
Domoticz Installation *
Minecraft Server Install *
Steam Client Install *
7 Days to Die Server Install *
Arma 3 Server Install *

Open VPN

Open VPN Install *

Next Cloud / Scottcloud

Next Cloud Installation *

Wikipedia

MediaWiki Installation *

Backups

Amanda Backup Server Installation *
Amanda File Recovery