Some Ubuntu Linux Setup Notes
Basic Ubuntu Linux setup notes/steps
Quick Links
Enabling Display of IP Address in Hyper-V Manager
"Login" as root
sudo -iAPT Update / Upgrade
apt update
apt upgrade
apt dist-upgradeNetwork Related
IP Address Information
ip a
netplan statusConfigure 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: trueSecure Files
chmod 600 01-static.yaml
chmod 600 02-dynamic.yamlApply Configuration
Safely apply the configuration.
netplan tryOr if you are confident, then just apply.
netplan applyTime Zone
timedatectl set-timezone Asia/SingaporeNodeJS
apt install nodejsAnother 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.0nginx
apt install nginxPython
Base Python3
apt install python3Useful modules
apt install python3-pip
apt install python3-venvBubblewrap
apt install bubblewrapFor 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-extraExecute 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-restrictFile Watcher Limits
Typical default values are:
fs.inotify.max_user_watches = 8192
fs.inotify.max_user_instances = 128Recommended values for development environments are:
fs.inotify.max_user_watches = 524288
fs.inotify.max_user_instances = 1024Setup 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 -pGo
Download from https://go.dev/dl/. For example:
wget https://go.dev/dl/go1.26.2.linux-amd64.tar.gzRemove previous Go installation:
rm -rf /usr/local/goExtract latest Go package. For example:
tar -C /usr/local -xzf go1.26.2.linux-amd64.tar.gzAdd /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 versionDisable IPv6
This method disables IPv6 for all interfaces without needing a reboot.
Edit the configuration file:
sudo nano /etc/sysctl.confAdd 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 = 1Apply the changes:
sudo sysctl -pVerify that IPv6 is disabled (should return no output):
ip a | grep inet6Enabling Display of IP Address in Hyper-V Manager
Install the necessary supporting components:
apt install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtualReboot.
Check:
sudo systemctl status hv-kvp-daemonDocker
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 updateInstall the Docker packages:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginAfter installation, verify that Docker is running:
sudo systemctl status dockerThe 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 dockerLog 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