Table of Contents

Install Ubuntu 20.04 LTS as Standalone Server

This will guide you through the installation of Ubuntu 20.04 LTS as a Standalone Server.

Do Not Forget To

Install Ubuntu Server 20.04 LTE from CD / USB

Size Location Notes
4 GB swap (primary) should be min sqrt(RAM) and max double RAM
6 GB / (logical) current install uses about 2.6 GB
5 GB /home (logical) current install uses about 45 MB
1 GB /boot (logical) current install uses about 145 MB
19.498 GB /var (logical) current install uses about 9.3 GB
4 GB /tmp (logical) current install uses about 21 MB

Setup

Update Packages

sudo apt-get update
sudo apt-get dist-upgrade

Install SSH Server

sudo apt-get install openssh-server

Mount other hard drives

sudo mkdir /mnt/storage
sudo mkdir /mnt/minecraft
sudo mkdir /mnt/plex
sudo mkdir /mnt/timemachine
sudo blkid

and

sudo lsblk

to get info for fstab.

sudo vim /etc/fstab

Install ex-fat (for USB drives or FAT formats)

sudo apt-get install exfat-fuse exfat-utils

Reboot

sudo reboot -h now

Create ssh-rsa key auth

Reboot

sudo reboot -h now

Install Tomcat

sudo apt-get install tomcat9

Change to port 80

sudo vim /etc/tomcat9/server.xml
<Connector port="80" protocol="HTTP/1.1"
       	connectionTimeout="20000"
       	URIEncoding="UTF-8"
       	redirectPort="8443" />

Copy webpage files

sudo rm -rf /var/lib/tomcat9/webapps/ROOT
sudo cp -a /mnt/backup/webpage/webapps/. /var/lib/tomcat9/webapps/
sudo cp -a /mnt/backup/webpage/plex /var/lib/tomcat9/

Allow Directory Browsing

sudo vim /etc/tomcat9/web.xml
<init-param>
  <param-name>listings</param-name>
  <param-value>true</param-value>
</init-param>

Faster Tomcat Startup

Install MySql

sudo apt-get install mysql-server

Import database dump

sudo mysql -u root -p < dumpfile.sql

Create mysql user

sudo mysql -u root -p
CREATE USER 'dirk'@'localhost' IDENTIFIED BY 'password';
show databases;
GRANT ALL PRIVILEGES ON *.* TO 'dirk'@'localhost';
exit

Allow write access for user

GRANT FILE ON *.* TO 'dirk'@'localhost';
exit

Allow mysql to write to files

sudo aa-status
sudo vim /etc/apparmor.d/usr.sbin.mysqld
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

Tomcat - Mysql linking / JDK / JAVA cleanup

Install Samba

sudo apt-get install samba
sudo smbpasswd -a dirk
sudo vim /etc/samba/smb.conf
[webapps]
  comment = Webpage Files
    path = /var/lib/tomcat9/webapps
    available = yes
    browsable = yes
    guest ok = yes
    read only = no
    writable = yes
    admin users = dirk
[storage]
[plex]

Add football season

LOAD DATA LOCAL INFILE "/home/dirk/2019o.csv" INTO TABLE games COLUMNS TERMINATED BY ',';

Allow rsync to run on own

sudo visudo -f /etc/sudoers.d/nopass
dirk ALL=(ALL:ALL) NOPASSWD:/usr/bin/rsync

Add cron job for backup

crontab -e
0 3 * * * /home/dirk/scripts/backup

Change timezone

sudo dpkg-reconfigure tzdata