Nethence Newdoc Olddoc Lab Your IP BBDock  

Setting up Ubuntu Server


Put your SSH keys in place so you can connect as wheeled user and possibly as root. Tweak the SSH daemon,

groupadd -g 11 wheel
usermod -a -G wheel root
usermod -a -G wheel WHEELED_USER
cd /etc/ssh/
cp sshd_config sshd_config.dist

vi sshd_config
allowgroups wheel

service ssh restart

Fix the system short hostname, FQDN and domain search,

vi /etc/hostname (short name is fine)
hostname HOSTNAME (idem)
vi /etc/hosts (long name + short name)

cp -pi /etc/network/interfaces /etc/network/interfaces.dist
vi /etc/network/interfaces

    dns-search EXAMPLE.local EXAMPLE2.local

    #cd /etc/network/interfaces.d/
    #cp 50-cloud-init.cfg 50-cloud-init.cfg.dist
    #vi 50-cloud-init.cfg

    service networking restart
    #service resolvconf restart
cat /etc/resolv.conf

Check that the locale is UTF-8,

echo $LANG
dpkg-reconfigure locales

Update/upgrade the system,

apt update
apt install apt-utils
apt full-upgrade
apt autoremove
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg --purge
apt full-upgrade

Fix the time,

dpkg-reconfigure tzdata
ls -lhF /etc/timezone
ls -lhF /etc/localtime

service ntp stop
ntpdate NTP_SERVER
hwclock --systohc
apt install ntp
cp -pi /etc/ntp.conf /etc/ntp.conf.dist
vi /etc/ntp.conf


service ntp start
ntpq -p

Install a few more packages,

#only on Docker host
apt install \
    screen \
    sudo \
            xfsprogs \

#shared with Dockerfile/install-script for containers

Tweak your environment

Setup GNU/Screen

Eventually install Docker

Eventually run an Apache or NGINX reverse-proxy.

Upgrading to new Ubuntu release

lsb_release -a
df -h
dpkg -l | grep ^ rc
apt update
apt full-upgrade
apt autoremove
dpkg -l | grep ^ rc

iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

make sure grub is in place,


make sure there’s a few bytes left for the system to start fine,

df -h

and reboot,


Revert to the default set of packages


Revert to default installed pkgs,

dpkg --get-selections >output
dpkg --set-selections <output
apt-get dselect-upgrade

Home | GitHub | Donate | Contact