Ubuntu checklist

This is my checklist (in progress) for installing Ubuntu; there are also many many Linux-y tips and tricks listed so I don’t forget.  😛

The important thing for me right now is to get it all in one place; I’ll make it pretty and presentable later.

Notes

Ubuntu in a VM
Install the distribution
Make sure the network adapter is enabled and in bridged mode

Before installing guest additions make sure to install the following packages:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ssh net-tools
sudo apt-get install build-essential gcc make perl dkms linux-headers-$(uname -r)

and then reboot and install the guest additions.

Make df output more friendly by creating a system-wide alias for it:

echo "alias df='df -h -x squashfs -x tmpfs -x devtmpfs'" >> /etc/profile.d/aliases.sh

Make sure to set the “always_set_home” variable in the sudoers file (using visudo)

Disable IPv6:

The recommend method to disable IPv6 on Ubuntu 18.04 after reboot is to configure the GRUB boot loader to pass kernel parameter during the boot time.

To do so open the /etc/default/grub using your favorite text editor with root privileges and change/add:

FROM:
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
TO:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

Once you have made the above change within the /etc/default/grub file execute the following commands to apply the GRUB changes:

$ sudo update-grub

To install Samba:

sudo apt-get install samba cifs-utils

To install NFS:

sudo apt-get install nfs-common nfs-kernel-server

To install mysql:

sudo apt install mysql-server
sudo mysql_secure_installation

To install Plex Media Server:

Plex Media Server installation

Helpful commands:

View video resolution capabilities – xrandr -q
List installed packages – sudo apt list –installed

Helpful Web Pages

Helpful page #1

Enable NFS

Finally!  The solution to get the “right” VNC setup

Ubuntu 18.04 switched from LightDM to GDM3. Connecting to the login screen with VNC while using GDM3 is currently not possible. The easiest way to get this VNC functionality back is to simply switch back from GDM3 to LightDM.

LightDM is still being actively developed and used by many Linux distributions including some other flavors of Ubuntu. So no worries there.

Install LightDM

apt install lightdm

Should you for some reason come to regret switching to LightDM:

dpkg-reconfigure gdm3

Once you have LightDM installed and configured as your default greeter..

Install x11vnc from packages

apt install x11vnc

Create the file /lib/systemd/system/x11vnc.service

# Description: Custom Service Unit file
# File: /lib/systemd/system/x11vnc.service
[Unit]
Description="x11vnc"
Requires=display-manager.service
After=display-manager.service

[Service]
ExecStart=/usr/bin/x11vnc -loop -nopw -shared -xkb -repeat -noxrecord -noxfixes -noxdamage -forever -rfbport 5900 -display :0 -auth guess
ExecStop=/usr/bin/killall x11vnc
Restart=on-failure
Restart-sec=2

[Install]
WantedBy=multi-user.target

Set the x11vnc service to automatically start at boot

systemctl enable x11vnc.service

Start the x11vnc service

This assumes screen :0 represents your monitor and binds x11vnc to that monitor instead of a session. If you do not have a monitor (headless) I believe it is possible to install a fake monitor driver and bind x11vnc to that.

 systemctl start x11vnc.service

Side notes

  1. Incase you are using virt-manager (which also enables VNC on 127.0.0.1:5900) you may want to bind x11vnc to your LAN IP (-listen 10.0.0.1)
  2. The parameters used to start x11vnc tell it not to ask for an additional password (-nopw)

Lets Encrypt/OpenVPN information

Let’s Encrypt HTTPS Certificates for OpenVPN AS (Access Server)

Installing Let’s Encrypt SSL Certs

Customizing the MOTD

Put any customization data into /etc/motd

Installing apache and php

sudo apt update
sudo apt install apache2
sudo apt install php libapache2-mod-php
sudo apt install php-mysql php-gd php-xml
sudo apt install phpmyadmin php-mbstring php-gettext

Install phpmyadmin

Reference this guide.

sudo apt update
sudo apt install phpmyadmin
mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';

User profile changes

  • If desired, disable the screen saver lock and screen blanking (see below)

 

Other things to document

List hard drive serial numbers
lsblk --nodeps -o name,serial

Listing which process is listening on a port
netstat -tulpn | grep LISTEN

Reload systemd manager configuration after changes made
systemctl daemon-reload

Listing all installed packages
apt list –installed

Searching for available packages
apt-cache search <keyword>

Changing default editor for visudo
sudo update-alternatives –config editor

Disable screen lock
Settings -> Privacy -> Screen Lock

Disable screen blanking
Settings -> Power -> Blank Screen

Create Samba User
smbpasswd -a <username>

Determine the date the system was installed
tune2fs -l /dev/vda2 | grep ‘Filesystem created:’ (replace vda2 with device where root filesystem is located)

View Samba Users
Use pdbedit

Add domains to the DNS Search Suffix list
Edit /etc/systemd/resolved.conf and add domains after Domains=

Finding largest files/directories
du -a /dir/ | sort -n -r | head -n 20 (replace 20 with the # of lines you wish to have returned)

Disable colors in the vi editor by default
Create (or edit, if it exists) ~/.vimrc; into this file add the command syntax off, and save the file.

Overwrite/blast the boot block on the hard drive (ONLY when you want to re-install the operating system!)
dd if=/dev/zero of=/dev/sda count=1 bs=512

Find files consuming the root file system

mkdir /tmp/rootbind 
mount --bind / /tmp/rootbind
du -d 1 -h /tmp/rootbind

Install VirtualBox Guest Additions on Ubuntu via command line

On the Guest console, select “Devices -> Insert Guest Additions CD Image”.
From the command line of the guest, perform the following commands (in a privileged shell):

mount /dev/cdrom /mnt
cd /mnt
sh ./VBoxLinuxAdditions.run --nox11

Linux hosts aren’t visible in the “Network Neighborhood” on Windows machines

The solution for this issue (installing/enabling the Windows Services for Devices Daemon (WSDD)) can be viewed here.

Installing Portainer to manage Docker containers

sudo docker run -d -p 9443:9443 -p 8000:8000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Disable interactive restart prompt while upgrading packages with apt

The trouble in this case is with the needrestart command, which is part of the apt-get upgrade process in Ubuntu now. By default this is set to “interactive” mode which causes the interruption of scripts.

To change this behavior, we can edit the /etc/needrestart/needrestart.conf file, changing the line:

#$nrconf{restart} = 'i';

to

$nrconf{restart} = 'a'; (if we want to restart the services automatically) or $nrconf{restart} = 'l'; to simply list the services that need restart.

Require username at GUI login (hiding list of valid users)

You can disable the user list shown on the login screen by setting the org.gnome.login-screen.disable-user-list GSettings key.

When the user list is disabled, users need to type their user name and password at the prompt to log in.

  1. Create the gdm profile (/etc/dconf/profile/gdm) which contains the following lines:

    user-db:user
    system-db:gdm
    file-db:/usr/share/gdm/greeter-dconf-defaults
  2. Create a gdm keyfile for machine-wide settings in /etc/dconf/db/gdm.d/00-login-screen:

    [org/gnome/login-screen]
    # Do not show the user list
    disable-user-list=true
  3. Update the system databases:

    # dconf update