How to install Plex media server on Ubuntu 20.04 LTS

Neither the Plex media server nor Ubuntu 20.04 LTS needs an introduction both are well-known software. Yes, version of Ubuntu that is 20.04 focal fossa is new but its working not.

However, those don’t know about the Plex, it is free server software that one can install on various kind of operating systems such as Linux, Windows, FreeBSD, macOS including NAS OS and boxes. Whereas to stream media from its streaming server, it also provides client app with nice interface for Android, iOS, TV, Chrome, Roku and more…

Thus, here is the tutorial to know how to use both of them together to manage your media files for online streaming.


  • Ubuntu 20.04 LTS installed Desktop or server
  • A non-root user with sudo access to install packages
  • Internet connection

Steps to Install Plex Media Server on Ubuntu 20.04 LTS

Don’t know whether you are using the GUI desktop version or Server of Ubuntu 20.04 LTS thus, we will show the pure command-line way to install the Plex. Also, the tutorial and its steps are applicable to earlier Ubuntu OS versions such as 19.10/19.04/18.04/16.04… including Debian, Elementary OS, Deepin and Linux Mint as well.

Step 1. Add Plex Media server repository 

Yes, indeed you can directly visit the official website of Plex to download its server packages for Linux. However, it would be hard for those are using the pure CLI server version. Yes, we can surf the website via command line but it will be cumbersome and messy, thus, it would be great if we first enable the Plex media repository on Ubuntu 20.04 and then download it purely with the command, to setup.

Here in the below command, we are adding the Debian repo of Plex TV in a separate file called plexmediserver.list under the sources.list.d. We haven’t added it in the main official repo list file of Ubuntu to make sure that it remains intact and would not get messy for future usage. Also, it will make us easy to remove the same in future.

echo deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

Now, add public singing key for the same, this will ensure whatever the packages or updates we get will be from the official source and wouldn’t be altered.

sudo apt install curl
curl | sudo apt-key add -

Step 2: Update the System

Next thing is whatever we added above should be recognized by the system, thus to flush the cache and build again the repo list for the system, run an update command:

sudo apt update

Step 3: Install Plex Media Server on Ubuntu 20.04 Focal fossa

Finally, everything we need is to get the packages of plex are at a place and its time to run a single command to install it.

sudo apt install plexmediaserver

The output for the above command:

h2smedia@dell-server:~$ sudo apt install plexmediaserver
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 328 not upgraded.
Need to get 90.9 MB of archives.
After this operation, 302 MB of additional disk space will be used.
Get:1 public/main amd64 plexmediaserver amd64 [90.9 MB]
Fetched 90.9 MB in 12s (7,862 kB/s)
Selecting previously unselected package plexmediaserver.
(Reading database ... 160529 files and directories currently installed.)
Preparing to unpack .../plexmediaserver_1.19.1.2701-6327e27bf_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Pre-installation Validation complete.
Unpacking plexmediaserver ( ...
Setting up plexmediaserver ( ...

Step 4: Check Plex Server status

We have successfully installed it, now its time check whether the Plex is up and running on our Ubuntu 20.04 server properly without any error.

systemctl status plexmediaserver

In case, it yet hasn’t been started then run this command:

sudo systemctl start plexmediaserver

You will get something like shown below in the screenshot with Active status and green signal.

Check Plex running status ubuntu 20.04
Check Plex running status ubuntu 20.04

Step 5: Check ports opened for Plex on Ubuntu 20.04

The default port which Plex listen to after the installation is 32400, yet if you want you can see exactly what are the ports engaged with it. Run netstat command:

sudo netstat -lnpt | grep Plex

The output will be like this:

h2smedia@dell-server:~$ sudo netstat -lnpt | grep Plex
[sudo] password for h2smedia:
tcp 0 0* LISTEN 7948/Plex Media Ser
tcp 0 0* LISTEN 8685/Plex Plug-in [
tcp 0 0* LISTEN 8351/Plex Plug-in [
tcp 0 0* LISTEN 8118/Plex Tuner Ser
tcp 0 0* LISTEN 8022/Plex Plug-in [
tcp 0 0* LISTEN 8617/Plex Plug-in [
tcp 0 0* LISTEN 8264/Plex Plug-in [
tcp 0 0* LISTEN 8149/Plex Plug-in [
tcp 0 0* LISTEN 8605/Plex Plug-in [
tcp6 0 0 :::32400 :::* LISTEN 7948/Plex Media Ser

In the above output or in the given screenshot you can see two ports are assigned to access the Plex media server on the Ubuntu 20.04, so of course, in the next step, we use one of them to access it.

Check ports used by Plex server
Check ports used by Plex server

Step 6: Open Web management interface of the Plex server

We have two ports 32400 and 32401, you can use any of them to access the GUI web interface of Plex in our browser. Therefore, open your system browser or if you are using CLI server then use any other machine that has a browser installed, it could be windows, Android, Linux, macOS. And there in the URL bar, type your server IP address along with ports number 32400. If you don’t know your IP address then use the command ifconfig.

For example, my IP address is, thus I enter it in the browser along with the port number and it will be like this

You can also use: 127.0.01:32400

Note 1: If you are using a server with firewall UFW enable then, you won’t be able to access Plex with any other computer available in the same network. Thus, you have to add or open the port 32400 in the Ubuntu 20.04 firewall. For that you can use the command:

sudo ufw allow 32400

Note 2: Second thing is if you want to access the Plex server setup page installed on remote Ubuntu 20.04 server, then it won’t be possible until and unless you access it locally but CLI server doesn’t have GUI browser. Therefore, we create an SSH tunnel from a GUI system (Windows, macOS, Linux, FreeBSD) to our server.

Here we are forwarding 8888 to server’s 32400, thus will be able to access remote server-ipaddress:32400 via localhost:8888 of the system you are using to access it. Open Command Prompt of Windows or Terminal on Linux/macOS and run the below command:

ssh [email protected] -L 8888:localhost:32400

Replace Username and address with your Plex server IP address and username.

After that, in the browser type: or!/setup

Step 7: Sign up and set up Plex Web account

The first thing you will get once the Web interface gets opened is the Sign page. There are different ways available on the Plex page to log in Google account, Facebook, Apple and Email. Opt any of them and sign for Plex web. Once you did it, the setup will redirect you to Setup Web page of Plex server.

Plex server running on Ubuntu 20.04 LTS
Plex server

Step 8: Setup page of Plex Media Server

Setup page of Plex server
Setup page of Plex server

After successfully recognizing the installed server by Plex setup, it will give provide the initial setup wizard to add media files. So, on the first page, you can edit the server name (if you want) along with a default checked option “Allow me to access the media server outside my Home” this option let you stream media files via the internet. However, to successfully use, this, make sure you have forwarded the server IP in your router to access it from outside. If you are installing it on some hosting or cloud space then nothing needs to be forwarded.

Allow access me outside home-min
Allow access me outside the home

The second page will let us add our media files. Click on Add Library button and then NEXT.

Add library-min
Add library

Select the type of library. I mean for adding music select that and in the same way for others.

Select you library type-min
Select your library type

Once you select any type of Library category, a page will come to browse the media files available on your server or storage devices such as NAS, Hard drive or USB drive accessible through your server.

In case your Plex server won’t be able to access external USB drives mount on the server, then follow this tutorial: {Will update soon}.

Browse Media files-min
Browse Media files

The mounted path can be seen on the screen to confirm its addition, click on the Add Library button.

Library address-min
Library address

Whatever category you have added, will show in this step, just move forward.

Library added successfully
Library added successfully

If you want to get Plex apps for your different devices to stream the media files, go, you can get from here or directly through the official website.

Server setup is done-min
The server setup is done

Finally, our added music files can be seen on the Plex Dashboard, and the same you would be.

Dashboard Plex server on Ubuntu 20.04
Dashboard Plex server on Ubuntu 20.04

Extra Tips

In case you have done something wrong in the initial setup you can simply remove the Preferences.xml file to again start the setup process. This will allow you to again claim your server.

sudo rm /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml

sudo systemctl restart plexmediaserver


Other Articles: