Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

How to Set Up Plex Media Server on Ubuntu

Install Plex Media Server on Ubuntu, reach the first-time setup on a machine without a screen, give Plex access to your folders, and open the right port.

3 min readBy Daniel

Reviewed by the AmazingRDP technical team

Setting up Plex on Ubuntu

A Linux VPS gives you root access. Only your own media, and within the usage policy. See Linux VPS from $6.99

Plex Media Server organises your own films, series, music and photos and plays them on phones, TVs and browsers. The server part runs well on Ubuntu, on a home machine or a small server. This guide installs it and gets you past the two points where people get stuck: the first-time setup on a machine without a screen, and folder permissions.

1. Install

Plex is not in Ubuntu's repository. Download the package from plex.tv: open Downloads, choose Plex Media Server, then Linux and the Ubuntu 64-bit build, and copy the link.

wget PASTE-THE-LINK-HERE
sudo apt install ./plexmediaserver_*.deb
systemctl status plexmediaserver

The service starts by itself and will start with the machine.

2. Keep it updated

The package places a repository file on the system, switched off. To get Plex updates along with normal system updates, open it and remove the # in front of the line that starts with deb:

sudo nano /etc/apt/sources.list.d/plexmediaserver.list
sudo apt update

If apt update then complains about a missing key, follow the current instructions on Plex's support pages; the key location has changed over the years.

3. The first-time setup

Setup happens in a browser at port 32400. Plex allows the very first setup only from the machine itself or its local network.

  • Machine with a desktop, or on your home network: open http://ADDRESS-OF-THE-MACHINE:32400/web.
  • Remote server: make the server believe you are local, with an SSH tunnel from your own computer:
ssh -L 8888:localhost:32400 user@203.0.113.10

Leave that window open and browse to http://localhost:8888/web. Sign in with a Plex account, name the server, and go on to the libraries.

4. Folders and permissions

Plex runs as its own user, plex, and can only read folders that user may enter. This is the usual reason for an empty library.

sudo mkdir -p /srv/media/films /srv/media/series
sudo chown -R $USER:plex /srv/media
sudo chmod -R 750 /srv/media

Your user owns the files and can copy to them; the group plex may read them. Media in your home folder often fails because the home folder itself is closed to other users; keep media outside it.

Plex matches titles by name. Use Film Name (2019).mkv for films and Series Name/Season 01/Series Name - s01e01.mkv for series.

5. Add libraries

In the web interface choose Add Library, pick the type, and browse to the folder. Plex scans it and fetches descriptions and artwork.

6. Reach it from outside

  • Firewall: allow the port. sudo ufw allow 32400/tcp: see the Ubuntu firewall guide.
  • At home: under Settings, Remote Access, Plex tries to open the port on your router by itself; if that fails, forward port 32400 to the machine by hand.
  • Apps: sign in with the same Plex account and the server appears.

Transcoding: the part that needs power

When a device can play a file as it is, the server only sends it, which costs almost nothing. When it cannot, the server converts the video while you watch, and that needs a strong processor: one conversion of a 1080p film can keep several cores busy, and 4K far more. Hardware-assisted conversion needs a paid Plex Pass and a suitable graphics chip. To avoid the problem, keep files in formats your devices play directly, or set the apps to original quality.

On a rented server

A server in a datacentre has the upload speed a home line lacks, but mind three things:

  • Only your own media. Our usage policy does not allow storing or sharing works you have no rights to, and a media server is not exempt.
  • Storage and traffic. Video fills disks and uses traffic fast; compare the plan's allowances with your collection.
  • Processor. A small VPS sends files directly without trouble and struggles with conversion.

Problems

SignCause
The page asks you to sign in and shows no server to set upYou are not local. Use the SSH tunnel
The library stays emptyPermissions: the user plex cannot enter the folder
Titles are wrong or missingFile names do not follow the pattern
Playback stutters and the server is at full loadIt is converting: see monitoring with htop
"Not available outside your network"Port 32400 is closed or not forwarded

For a server with root access, see our Linux VPS plans.

Questions

How do I install Plex on Ubuntu?

Download the Ubuntu package from plex.tv and install it with sudo apt install ./plexmediaserver_*.deb.

How do I set up Plex on a server without a screen?

Open an SSH tunnel with ssh -L 8888:localhost:32400 user@server and browse to http://localhost:8888/web.

Why can Plex not see my files?

The Plex service runs as the user plex, which needs read access to the folder and every folder above it.

Which port does Plex use?

TCP port 32400.