Linux : Trying Ubuntu

Ubuntu Version : 22.04

Overview

USed to Docker on a Windows machine, pretty annoyed with the updates/reboot. Tried TrueNas Scale … with TrueCharts apps repository … and I had a lot of issues, apps were not installed properly, getting a lot of snapshots (like 100s of thousands …). Then thought Lets wipe everything and install a VM on TrueNas hosting Ubuntu. (Got the idea from Level1Techs but the video/guide were not detailed enough for my level of Linux. Although I appreciate the content, and the explanations provided for the workarounds provided, I hit a lot of issues I could not resolve due to my poor knowledge of Linux platforms.) So I thought why do I need TrueNas? instead of running Ubuntu as a VM, lets install it as a

Install

Graphic card

I had specific issues with my graphic card to enable hardware transcoding with Jellyfin. Please Check Nvidia article in the reference below.

Using nvidia-smi I see I am using version 535 of the drivers.

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07             Driver Version: 535.161.07   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3050        Off | 00000000:01:00.0  On |                  N/A |
|  0%   58C    P5              13W /  70W |    766MiB /  6144MiB |      6%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      4156      G   /usr/lib/xorg/Xorg                          406MiB |
|    0   N/A  N/A      4268    C+G   ...libexec/gnome-remote-desktop-daemon       77MiB |
|    0   N/A  N/A      4317      G   /usr/bin/gnome-shell                         89MiB |
|    0   N/A  N/A      6042      G   ...irefox/4033/usr/lib/firefox/firefox      178MiB |
+---------------------------------------------------------------------------------------+

When those stepas are done I had to add the following :

sudo apt-get install libnvidia-encode-535 nvidia-docker2
sudo systemctl restart docker

Setup / preparation

activate Remote Access

Run one by one :

sudo apt update
sudo apt install xrdp
sudo systemctl enable xrdp
sudo ufw allow from any to any port 3389 proto tcp
ip address

SetUp windows Share

Note: I first started to share without doing those steps, and I ended up with errors because some packages were not habing the expected versions. This step should prevent this from happening.

Samba installation :

Activate the option in Ubuntu Settings.

SetUp Drives

Create symbolic Link between my NAS and the Ubuntu Machine Mounting NAS shared folders

(media folder for volatile data)

sudo mount -t cifs //mysan.local/share/subfolder /media/folder -o user=nasuser

Symbolic link to mounted folder :

ln -s /media/folder /mnt/share/MyStuff

GIT

sudo apt-get install git

Then configure git :

git config --global user.name "myusername"
git config --global user.email "myemailaddress"

Brave Browser

sudo apt update && sudo apt upgrade -y
sudo apt install apt-transport-https 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 arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install brave-browser -y
brave-browser --version

VSCode

Install from GUI. Open the App Repository, search for VSCode and install.

Docker

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get 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:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable docker

Test

sudo docker run hello-world

Docker installation file are located in : /var/lib/docker

Docker Compose :

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

GPU

cd /proc/driver/nvidia/gpus
ls
cd 0000\:01\:00.0/
cat information

Copy GPU UUID in Portainer : Portainer Setup GPU Section

Portainer

Create a Volume :

docker volume create portainer_data

Install Portainer :

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

Add

Jellyfin

Harware encoding can be tricky, but it is achieable. In Env tab, add the following entries :

    - NVIDIA_DRIVER_CAPABILITIES = all
    - NVIDIA_VISIBLE_DEVICES = all

In Ressources, Enable GPU.

VS Code

Search for code-server. Link config folder and workspace folder.

Install DotNet Core 8 in container.

sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-8.0
dotnet --info

PiHhole

Starting the container might be stopped because there is already a service using port #53 (dnsmasq). Disable it with the following commands:

$ sudo systemctl disable systemd-resolved.service
$ sudo systemctl stop systemd-resolved.service

References