Setting up Ubuntu 21.10 for Plex Media Server with an Intel Gen 12 CPU
UPDATE 9/22/22 - THIS GUIDE IS DEPRECATED.
It exists for reference, but I don't recommend using Ubuntu 21.10 at all at this point. I also suggest using Docker instead of a native install.
A newer guide is at: https://tomthegreat.com/blog/installing-plex-on-ubuntu-22-04-using-docker/
One of the best ways setups for Plex Media Server in my experience has been running it on an Intel based Ubuntu Linux installation. Ubuntu Linux is very stable, has a lot of online support, and is pretty easy to learn for those new to Linux. Intel CPU's also offer some of the best transcoding capabilities, via the Quick Sync Video capabilities built into the CPU.
At the time of this posting, the Intel 12th Gen CPU's (Alder Lake) are not fully supported in the LTS version of Ubuntu (20.04). There are a number of things you can do to add in partial support, but the hardware is still too new.
In Ubuntu 21.10 support is mostly complete, so I went with that as my baseline system to start with. This is my attempt to get Plex Media Server fully functional on Ubuntu 21.10 with full hardware transcoding support from the Intel 12th Gen CPU.
- Ubuntu 21.10,
– Desktop or server edition, it doesn't make a difference, all the commands will be issued from a terminal session
- Intel CPU Gen 12 (Alder Lake)
- Administrator access to the Ubuntu installation
- Plex Media Server not already installed
- Active Plex Pass subscription
– For hardware transcoding
Install Ubuntu 21.10
If you already have Ubuntu installed, skip ahead.
I used the Desktop edition of Ubuntu 21.10 and did a fresh installation. I used ZFS as the filesystem and did a minimal install.
You could use the server edition if you wanted. The only reason I picked the desktop version is to have a GUI to play around with, but I don't actually use the GUI for anything.
Install Additional Components
Install inxi, a tool to provide more system information.
sudo apt install inxi
Install vainfo, a tool to provide information about VAAPI. VAAPI is what is the API used for the hardware transcoding.
sudo apt install vainfo
Install a collection of network tools, since I still use ifconfig.
sudo apt install net-tools
Install ssh to allow remote ssh connections.
sudo apt install ssh
Install curl, a useful tool.
sudo apt install curl
Install intel-gpu-tools, a tool to provide performance metrics about the CPU/GPU which will be useful to help check performance when transcoding.
sudo apt install intel-gpu-tools
Install the components necessary to support HDR to SDR with hardware transcoding.
sudo apt install ocl-icd-libopencl1 beignet-opencl-icd
The Intel drivers are in the package intel-media-va-driver, but there is a non-free version of this called, intel-media-va-driver-non-free. The difference between the two is that the non-free version includes some proprietary components and is also needed for hardware encoding. The naming convention leaves something to be desired as it is free to the user. The non-free version is not installed by default, so install that to have full hardware decode/encode capabilities.
sudo apt install intel-media-va-driver-non-free libmfx1
Download and install the Intel Compute Runtimes needed for Plex. Note that at time of writing this, the latest version of Intel Compute components (21.52.22081) do not work with HDR tone mapping, causing hardware transcoding to break with 4K content.
The workaround for now is to use the 21.49.21786 versions.
cd ~ wget https://github.com/intel/compute-runtime/releases/download/21.49.21786/intel-gmmlib_21.3.3_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9441/intel-igc-core_1.0.9441_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.9441/intel-igc-opencl_1.0.9441_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/21.49.21786/intel-opencl-icd_21.49.21786_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/21.49.21786/intel-level-zero-gpu_1.2.21786_amd64.deb
Install the components.
sudo dpkg -i *.deb
Update Ubuntu Packages
Make sure all your packages are up to date.
sudo apt update
sudo apt upgrade
Follow the prompts to update all the components. Once all the updates are complete, reboot the computer.
sudo reboot now
Update Ubuntu Kernel
You can check your kernel version using the command:
The kernel installed for me was 18.104.22.168-generic. Updating the kernel provides access to newer drivers, which is necessary to get more support for the Intel Alder Lake CPU/GPU.
Download the kernel files. I used 5.15.13 but you could try other ones. You can find the kernel files to download at https://kernel.ubuntu.com/~kernel-ppa/mainline/. You need to download the headers, the image, and the module for the version you are installing.
cd ~ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.15/amd64/linux-headers-5.15.0-051500-generic_5.15.0-051500.202110312130_amd64.deb wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.15/amd64/linux-headers-5.15.0-051500_5.15.0-051500.202110312130_all.deb wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.15/amd64/linux-image-unsigned-5.15.0-051500-generic_5.15.0-051500.202110312130_amd64.deb wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.15/amd64/linux-modules-5.15.0-051500-generic_5.15.0-051500.202110312130_amd64.deb
Install the kernel files.
sudo dpkg -i *.deb
Reboot the computer when it is complete.
Force Linux Kernel to Load Alder Lake GPU Drivers
The Linux Kernel that came with 21.10, 5.13.0-22-generic, doesn't load the Alder Lake GPU drivers by default and needs to be forced to do it. The instructions below will force the kernel to load the correct drivers.
Edit the boot loader file.
sudo nano /etc/default/grub
Add i915.force_probe=4680 to the line GRUB_CMDLINE_LINUX_DEFAULT line, it will look something like this.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.force_probe=4680"
Update the boot loader.
Reboot the computer.
sudo reboot now
Update Ubuntu Package Manager (apt) repository
To allow the apt commands to install Plex you need to update the default apt repositories to include the Plex repository. Run the following commands from a terminal window.
This command adds the Plex repository to the apt sources.
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
This command adds the public key for the Plex repository to your apt keychain.
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
This command updates apt with the new sources and checks for any updated packages.
sudo apt update
This installation is considered a bare metal installation, meaning Plex Media Server is being installed directly into the Ubuntu operating system.
Alternatives are using Docker containers, or Snap packages. Snap packages and Docker containers are likely going to lag behind the Plex repositories and due to that may not always have the latest Plex features. I use Plex on a dedicated device, so I prefer a bare metal installation.
Install Plex Media Server
Install the Plex Media Server.
sudo apt install plexmediaserver
If it asks to replace configuration files select N, which should be the default.
Upon success you should see something similar to this.
PlexMediaServer install: PlexMediaServer-22.214.171.12419-c43dc0277 - Installation starting. PlexMediaServer install: PlexMediaServer install: Now installing based on: PlexMediaServer install: Installation Type: Update PlexMediaServer install: Process Control: systemd PlexMediaServer install: Plex User: plex PlexMediaServer install: Plex Group: plex PlexMediaServer install: Video Group: render PlexMediaServer install: Metadata Dir: /var/lib/plexmediaserver/Library/Application Support PlexMediaServer install: Temp Directory: /tmp PlexMediaServer install: Lang Encoding: en_US.UTF-8 PlexMediaServer install: Intel i915 Hardware: Found PlexMediaServer install: Nvidia GPU card: Not Found PlexMediaServer install: PlexMediaServer install: OpenCL: Installed PlexMediaServer install: Intel Gmmlib: Installed PlexMediaServer install: Intel IGC Core: Installed PlexMediaServer install: Intel IGC OpenCL: Installed PlexMediaServer install: Intel OpenCL: Installed PlexMediaServer install: PlexMediaServer install: Completing final configuration. PlexMediaServer install: Starting Plex Media Server. PlexMediaServer install: PlexMediaServer-126.96.36.19919-c43dc0277 - Installation successful. Errors: 0, Warnings: 0
Optional: Connect to NAS using NFS
All my media is hosted on a separate network attached storage system, using NFS to connect to the shared folders. I have my files split into three NFS shares, one for music, one for photos, and one for video.
This part is mostly for my own reference, but if you want to use NFS these are the instructions to get the client portion of NFS setup. You will still need to setup the NFS server that hosts the NFS shares. This assumes that is already done.
Install the NFS client packages.
sudo apt install nfs-common
Create a directory for the NFS mounts to live.
sudo mkdir /media/video sudo mkdir /media/photo sudo mkdir /media/music
Set permissions for Plex to be able to access the shares. I do this step after installing Plex Media Server because Plex creates a user/group that we assign permissions to the shares.
sudo chown plex:plex -R /media sudo chmod 555 -R /media
Setup the shares to mount at boot up.
sudo nano /etc/fstab
Add to the fstab file the following entries, adjusting the IP address and the NFS share name.
<NAS_SERVER_IP>:/volume1/video /media/video nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0 <NAS_SERVER_IP>:/volume1/photo /media/photo nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0 <NAS_SERVER_IP>:/volume1/music /media/music nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
Mount the new shares.
sudo mount -a
Setup Plex Media Server
Once installed open a web browser to http://<your_ip_address>:32400/web and go through the configuration. Check the reference section for enabling hardware accelerated streaming and other general Plex configuration options.
I do suggest using a reverse proxy if you are going to be accessing Plex outside of your network. There are lots of tutorials on how to do that.