Some Ubuntu Linux Setup Notes

Basic Ubuntu Linux setup notes/steps

"Login" as root

APT Update / Upgrade

Network Related

Time Zone

NodeJS

nginx

Python

Bubblewrap

File Watcher Limits

Go

Disable IPv6

Enabling Display of IP Address in Hyper-V Manager

Docker


"Login" as root

sudo -i

APT Update / Upgrade

apt update
apt upgrade
apt dist-upgrade

IP Address Information

ip a
netplan status

Configure Network / IP Address

Create / Update a .yaml file in /etc/netplan/ folder. By convention, start the filename with a 2-digit number, followed by a dash.

For example, the file 01-static.yaml with the following contents configures a static IP address on Ubuntu Server (which uses the renderer: networkd to denote the server's networking subsystem).

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.100.101/24
      routes:
        - to: default
          via: 192.168.100.254
      nameservers:
        addresses: [8.8.8.8, 8.8.8.4]

Here's another example for a file named 02-dynamic.yaml that configures a dynamic IP address on Ubuntu Desktop (which uses a different renderer: NetworkManager used by the desktop's networking subsystem).

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth1:
      dhcp4: true

Secure Files

chmod 600 01-static.yaml
chmod 600 02-dynamic.yaml

Apply Configuration

Safely apply the configuration.

netplan try

Or if you are confident, then just apply.

netplan apply

Time Zone

timedatectl set-timezone Asia/Singapore

NodeJS

apt install nodejs

Another method is via NVM.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/refs/heads/master/install.sh | bash
source ~/.bashrc
nvm install --lts  # Install the latest LTS version
nvm install 25.8.0  # Install the specific version 25.8.0

nginx

apt install nginx

Python

Base Python3

apt install python3

Useful modules

apt install python3-pip
apt install python3-venv

Bubblewrap

apt install bubblewrap

For relaxing security permissions for bubblewrap / bwrap in required scenarios, like allow autonomous agents to execute user-allowed commands.

apt install apparmor-profiles
apt install apparmor-profiles-extra

Execute if not already "executed" after install:

sudo ln -s /usr/share/apparmor/extra-profiles/bwrap-userns-restrict /etc/apparmor.d/
sudo apparmor_parser /etc/apparmor.d/bwrap-userns-restrict

File Watcher Limits

Typical default values are:

fs.inotify.max_user_watches = 8192
fs.inotify.max_user_instances = 128

Recommended values for development environments are:

fs.inotify.max_user_watches = 524288
fs.inotify.max_user_instances = 1024

Setup commands:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=1024 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Go

Download from https://go.dev/dl/. For example:

wget https://go.dev/dl/go1.26.2.linux-amd64.tar.gz

Remove previous Go installation:

rm -rf /usr/local/go

Extract latest Go package. For example:

tar -C /usr/local -xzf go1.26.2.linux-amd64.tar.gz

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation).

Verify the Go installation:

go version

Disable IPv6

This method disables IPv6 for all interfaces without needing a reboot.

Edit the configuration file:

sudo nano /etc/sysctl.conf

Add the following lines to the end of the file:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Apply the changes:

sudo sysctl -p

Verify that IPv6 is disabled (should return no output):

ip a | grep inet6

Enabling Display of IP Address in Hyper-V Manager

Install the necessary supporting components:

apt install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual

Reboot.

Check:

sudo systemctl status hv-kvp-daemon

Docker

The steps in this section are adapted from https://docs.docker.com/engine/install/ubuntu/.

Set up Docker's apt repository:

# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

sudo apt update

Install the Docker packages:

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

After installation, verify that Docker is running:

sudo systemctl status docker
The following steps are only recommended for use in development environments, purely for convenience reasons. They should not be used in production environments. This is because the account is effectively granted root privileges.

Allow your user to run Docker without sudo:

sudo usermod -aG docker "$USER"
newgrp docker

Log out, then log in to make sure the newgrp is effective.

Optionally verify that Docker is working:

docker --version
docker compose version
docker run --rm hello-world