Ubuntu Linux Install

1. Ubuntu Linux Install

Download and install the lastest Ubuntu in a Windows Hyper-V VM or on physical hardware.

2. Post Install

2.1. Install Net Tools

sudo apt install net-tools

2.2. Install SSH server

  1. Install

    sudo apt -y install openssh-server
  2. Now you can connect remotely via ssh and continue with the remaining steps.

2.3. WiFi

2.3.1. WiFi Test

  1. Run

    Run
    sudo lshw -C network
    Sample
      *-network UNCLAIMED
           description: Network controller
           product: Wireless 8265 / 8275
           vendor: Intel Corporation
           physical id: 0
           bus info: pci@0000:06:00.0
           version: 78
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress cap_list
           configuration: latency=0
           resources: memory:dc000000-dc001fff

2.3.2. WiFi Fix

  1. Get Linux kernel version

    Run
    uname -r
    Sample
    6.8.0-51-generic
  2. Run

    Run
    sudo apt reinstall  linux-modules-extra-6.8.0-51-generic

2.4. Set the Time Zone

  1. View the current time zone

    timedatectl
    Example
                   Local time: Sun 2023-05-21 04:20:25 SST
               Universal time: Sun 2023-05-21 15:20:25 UTC
                     RTC time: Sun 2023-05-21 15:20:25
                    Time zone: Pacific/Pago_Pago (SST, -1100)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
  2. If the time and timezone are already correct, then skip over this section.

  3. View available Timezones

    timedatectl list-timezones | grep New_York
    Example US Timezones
    America/New_York
  4. Set the Timezone

    sudo timedatectl set-timezone America/New_York
  5. Confirm new Timezone

    timedatectl
    New Timezone
                   Local time: Sun 2024-03-31 20:19:09 EDT
               Universal time: Mon 2024-04-01 00:19:09 UTC
                     RTC time: Mon 2024-04-01 00:19:09
                    Time zone: America/New_York (EDT, -0400)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no

2.5. Perform Updates and Upgrades

This will take a few minutes to complete…​
  1. Updates and Upgrades

    sudo apt update -y && sudo apt upgrade -y
  2. Reboot

    sudo reboot now

2.6. Install iotop

  1. Install

    sudo apt install iotop
    Like the top command but for disk activity, disk io

2.7. Install dnslookup

  1. Install

    sudo snap install dnslookup

2.8. Install NetCat

  1. Install

    sudo apt install -y netcat

2.9. Install Nmap

  1. Install

    sudo apt install -y nmap

2.10. Install Curl

  1. Install

    sudo apt update && sudo snap install curl

2.11. Install IPMI Tools

  1. Install IPMI packages

    sudo apt-get install -y ipmitool ipmiutil

2.12. Install Samba

2.12.1. Install Samba

  1. Install

    sudo apt-get install samba -y
    sudo apt-get install keyutils
    sudo apt-get install cifs-utils
    sudo apt install smbclient
  2. Start Samba

    sudo systemctl enable --now smbd
  3. Create new Group for Samba

    sudo addgroup sambagroup
  4. Add User into new Group for Samba

    1. Add user to group

      sudo usermod -aG sambagroup mattosd
    2. Confirm User added to new group

      id mattosd
      Example
      uid=1000(mattosd) gid=1000(mattosd) groups=1000(mattosd),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare),1001(sambagroup)

2.12.2. Add User

  1. Configure user name & password

    sudo smbpasswd -a mattosd (1)(2)
    1 Must be an actual local account name
    2 This password is for Samba use only - it can be different from the account’s password but if it is the same as the network password, then credentials will not need to be provided for the connection.
  2. Enable User

    sudo smbpasswd -e mattosd

2.13. Install ZFS

  1. Install

    sudo apt update && sudo apt install -y zfsutils-linux
  2. Confirm

    zfs --version
    example
    zfs-2.1.5-1ubuntu6~22.04.4
    zfs-kmod-2.2.0-0ubuntu1~23.10.2

2.14. Install GPU Drivers

2.14.1. NVidia

  1. Reference this Nvidia doc.

2.15. Install GPU Utils

2.15.1. Install GPU Stat

  1. Install

    sudo apt update && sudo apt -y install gpustat

2.16. Install Podman

  1. About Podman

  2. Install Podman

    sudo apt update && sudo apt -y install podman podman-compose

2.17. Install npx

  • The primary purpose of npx is to execute packages. Without installing, it can run any package you want from the npm registry. This is particularly useful when you want to run the package only once and want to avoid installing it globally or locally.

    1. Install npm

      sudo apt install -y npm

2.18. Install git

sudo apt -y install git

2.19. Install Visual Studio Code

  1. Install

    • Original install doc can be referenced here.

    • If Snap is installed then:

      sudo snap install --classic code

2.20. Install Cockpit

2.21. Install Browsers

2.21.1. Install Brave

  1. Get Brave

    sudo apt install curl
    sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
    echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
    sudo apt update
  2. Install Brave

    sudo apt install brave-browser -y

2.21.2. Install Microsoft Edge

  1. Get Edge

    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
    sudo rm microsoft.gpg
  2. Install Edge

    sudo apt update && sudo apt install microsoft-edge-stable

3. Resize Swap File

  1. Check size and confirm swap type = file

    swapon --show
    Example with a 1GB swap file
    NAME      TYPE   SIZE   USED PRIO
    /swapfile file 923.2M 245.5M   -2
    Partition Type
    However if type = partition, then a file partioning app will need to be used instead.
    Example with a 2GB partition based swap
    NAME      TYPE      SIZE USED PRIO
    /dev/sde2 partition   2G 1.5G   -2  (1)
    1 The second partition on disk e is configured as a temp partition
  2. Turn off swap

    sudo swapoff /swapfile
    This may take some time and will not produce any progress related output.
  3. Allocate a new swap file

    Allocate a 4GB file
    sudo fallocate -l 4G /swapfile
  4. Mark this file as the swapfile

    sudo mkswap /swapfile
    Example
    sudo mkswap /swapfile
    mkswap: /swapfile: warning: wiping old swap signature.
    Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
  5. Enable the swapfile

    sudo swapon /swapfile
  6. Confirm swap is re-enabled with new size

    swapon --show
    Example with new 4GB swapfile
    swapon --show
    NAME      TYPE SIZE   USED PRIO
    /swapfile file   4G 737.7M   -2

4. Expand Root Partition

  • Upon initial build, the root file system is max 100GB so there is available capacity for creating additional partitions.

  • To Expand

    1. Run lsblk to identify the root disk and partition name:

      lsblk
      Example
      sda                         8:0    0 931.5G  0 disk     (1)
      ├─sda1                      8:1    0     1M  0 part
      ├─sda2                      8:2    0     2G  0 part /boot
      └─sda3                      8:3    0 929.5G  0 part     (2)
        └─ubuntu--vg-ubuntu--lv 252:0    0   100G  0 lvm  /   (3)
      1 Root disk sda with total disk size ~ 1TB
      2 Partition name, sda3
      3 Root file system at 100GB
    2. Get the root file system name:

      df -hT
      Sample output
      Filesystem                        Type   Size  Used Avail Use% Mounted on
      tmpfs                             tmpfs  6.1G  4.7M  6.1G   1% /run
      /dev/mapper/ubuntu--vg-ubuntu--lv ext4    98G   15G   79G  16% /
    3. Extend the LVM logical volume and resize the filesystem using the free space already available in the LVM volume group.

      extend
      sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
      resize
      sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
    4. Confirm

      df -hT
      Filesystem                        Type   Size  Used Avail Use% Mounted on
      tmpfs                             tmpfs  6.1G  4.7M  6.1G   1% /run
      /dev/mapper/ubuntu--vg-ubuntu--lv ext4   915G   15G  862G   2% /