This tutorial can be displaying you ways to set up Plex media server on Ubuntu 18.04 LTS server/desktop. Plex is a free piece of software program that permits you to arrange your films, TV exhibits, music and pictures in a single lovely interface and stream these media information on your PC, pill, telephone, TV, Roku, and so on on the community or over the Web. Plex could be put in on Linux, FreeBSD, MacOS, Home windows and numerous NAS techniques.
Install Plex Media Server on Ubuntu 18.04
First, go to Plex server obtain web page, choose Linux and select Ubuntu 14.04 or newer.
In case you are going to set up Plex on a headless Ubuntu 18.04 server, then you possibly can go to your browser’s obtain historical past, then copy the Plex obtain hyperlink and use wget to obtain Plex from command line like under.
As soon as the Plex deb package deal is downloaded, cd to the obtain listing. For instance, my Plex is downloaded to the Downloads listing beneath House, so I run the next command. The tilde (~) represents residence listing.
On Debian based mostly Linux distros (Ubuntu, Linux Mint, and so on), dpkg is the usual command line software to set up deb packages. So run the next command to set up the Plex deb package deal.
sudo dpkg -i plexmediaserver_22.214.171.12432-21ab172de_amd64.deb
The -i is brief for –install. Observe that if you sort the next
sudo dpkg -i plex
You possibly can press the Tab key, which can autocomplete the filename.
Now Plex media server is put in. We will examine its standing with:
systemctl standing plexmediaserver
As you’ll be able to see, it’s operating on my Ubuntu 18.04 system. (Press q to take again management of terminal.)
If Plex media server isn’t operating, you can begin it with:
sudo systemctl begin plexmediaserver
Allow Plex Repository
By enabling the official Plex repo, you possibly can replace Plex on Ubuntu with apt package deal supervisor. The Plex deb package deal ships with a supply listing file. To see an inventory of information put in from a package deal, run dpkg with -L flag.
dpkg -L plexmediaserver
Open this file with the next command.
sudo nano /and so on/apt/sources.record.d/plexmediaserver.record
By default, its content material is commented out. Uncomment the final line. (Take away the start # image).
Then save and shut the file. To save lots of a file in Nano textual content editor, press Ctrl+O, the press Enter to affirm. To exit, press Ctrl+X. After that, run the next command to import Plex public key to apt package deal supervisor.
wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O – | sudo apt-key add –
Now replace software program repository index.
sudo apt replace
When you see the next message.
W: Conflicting distribution: https://downloads.plex.tv/repo/deb public InRelease (anticipated public however acquired )
You’ll be able to safely ignore it as a result of it’s a warning, not an error. Plex repository is working wonderful for Ubuntu 16.04. You will notice this message should you use Ubuntu 18.04. You want to await Plex builders to repair this drawback. In the event you don’t like to see this message, then disable the Plex repository. You’ll be able to re-enable this repo when a brand new model of Plex comes out.
Plex Media Server Preliminary Setup
Should you run the next command:
sudo netstat -lnpt | grep Plex
You possibly can see that Plex media server is listening on zero.zero.zero.zero:32400 and 127.zero.zero.1:32401.
The online-based administration interface is accessible at port 32400. The primary time you configure Plex, you have to go to Plex by way of 127.zero.zero.1:32400/net or localhost:32400/net. In the event you put in Plex on your Ubuntu 18.04 desktop, then you possibly can search Plex Media Supervisor in your software menu. It’s going to take you to Plex net interface, which in flip will take you to https://app.plex.tv since you want to check in with a plex.television account.
Notice that if Plex is put in on a distant Ubuntu 18.04 server, you want to arrange a SSH tunnel by executing the next command on your native pc. Exchange 126.96.36.199 with the IP handle of the distant Ubuntu server.
ssh 188.8.131.52 -L 8888:localhost:32400
Then you’ll be able to entry Plex net interface by way of the next URL.
This HTTP request can be redirected to http://localhost:32400/web on the distant server by way of SSH tunnel. This SSH tunnel is just wanted for the preliminary setup. After the preliminary setup, you’ll be able to entry Plex net interface by way of server-ip-address:32400. Substitute server-ip-address together with your actual server IP tackle.
As soon as signed in, you may be redirected to localhost:32400 to do the preliminary setup.
On the subsequent display, enter a reputation in your Plex server. Be certain that Permit me to entry my media outdoors my house is checked. Then click on Subsequent.
Now you’ll be able to add libraries. Click on Add Library button.
Choose a library sort, then click on browse for media folder button to add your media folders.
Notice that the plex consumer wants to have learn and execute permission on your media directories. For instance, my 2T exterior onerous drive is mounted underneath /media/linuxbabe/ , which is owned by root. Customers not in group root can’t entry it, so I run the next command to give consumer plex learn and execute permission. (I don’t advocate altering possession with chown or chgrp command. Utilizing the setfacl command will suffice.)
sudo setfacl -m u:plex:rx /media/linuxbabe/
You might also want to assign permission on particular person media directories like under.
sudo setfacl -m u:plex:rx /media/linuxbabe/directory-name
It may be tempting to add the recursive flag (-R), which provides plex learn and execute permission on each file and sub-directory on the drive.
sudo setfacl -R -m u:plex:rx /media/linuxbabe/
In case your exterior onerous drive is simply used for storing media information, then you are able to do so, however when you have delicate information on the exterior onerous drive, don’t do it.
When you end including your media folders, click on Subsequent after which click on Finished. You possibly can all the time add extra libraries later.
Redo the Preliminary Setup
In the event you made a mistake within the preliminary setup, you’ll be able to delete the Preferences.xml file and begin it over.
sudo rm /var/lib/plexmediaserver/Library/Software Help/Plex Media Server/Preferences.xml
sudo systemctl restart plexmediaserver
Now go to localhost:32400/net once more. Plex will inform you there’s an unclaimed server. Click on declare it now.
Create Nginx Reverse Proxy.
In case you want to use a website identify slightly than typing http://localhost:32400 to entry your Plex media server, then you definitely want to arrange a reverse proxy. We will use Nginx for this function. Install Nginx from the default Ubuntu software program repository.
sudo apt set up nginx
Then create a server block file for Plex.
sudo nano /and so on/nginx/conf.d/plex.conf
Put the next strains into the file. Exchange plex.instance.com with your personal area identify. Keep in mind to create an A report for the sub-domain in your DNS supervisor. (In case your ISP provides you a dynamic IP tackle somewhat than a static IP handle, you want to arrange dynamic DNS and port forwarding, or use PageKite. )
pay attention 80;
proxy_set_header Host $host;
proxy_set_header X-Actual-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#improve to WebSocket protocol when requested
proxy_set_header Improve $http_upgrade;
proxy_set_header Connection “Upgrade”;
Save and shut this file. Then check Nginx configuration.
sudo nginx -t
If the check is profitable, reload Nginx for the change to take impact.
sudo systemctl reload nginx
Now you possibly can entry Plex media server by way of plex.instance.com.
Create Apache Reverse Proxy
In the event you want Apache over Nginx, then set up Apache net server through the use of the next command.
sudo apt set up apache2
To make use of Apache as a reverse proxy, we’d like to allow the proxy modules and the header module.
sudo a2enmod proxy proxy_http headers proxy_wstunnel
Then create a digital host file for Plex.
sudo nano /and so forth/apache2/sites-available/plex.conf
Put the next configurations into the file. Exchange plex.instance.com together with your precise area identify. Don’t overlook to create DNS A document for this sub-domain.
ErrorDocument 404 /404.html
ProxyPass / http://localhost:32400/
ProxyPassReverse / http://localhost:32400/
Header all the time unset X-Body-Choices
Save and shut the file. Then allow this digital host.
sudo a2ensite plex.conf
sudo systemctl restart apache2
Now you possibly can entry Plex media server utilizing the area identify.
To encrypt the HTTP visitors if you go to Plex server from outdoors, we will allow HTTPS by putting in a free TLS certificates issued from Let’s Encrypt. Install Let’s Encrypt shopper (certbot) on Ubuntu 18.04. Python3-certbot-nginx is the Nginx plugin and python3-certbot-apache is the Apache plugin.
sudo apt set up certbot python3-certbot-nginx python3-certbot-apache
In the event you use Nginx, then run the next command to acquire and set up TLS certificates.
sudo certbot –nginx –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d plex.instance.com
For those who use Apache, then run this command:
sudo certbot –apache –agree-tos –redirect –hsts –staple-ocsp –email [email protected] -d plex.instance.com
- –nginx: Use the nginx plugin.
- –apache: Use the Apache plugin.
- –agree-tos: Agree to phrases of service.
- –redirect: Pressure HTTPS by 301 redirect.
- –hsts: Add the Strict-Transport-Safety header to each HTTP response. Forcing browser to all the time use TLS for the area. Defends towards SSL/TLS Stripping.
- –staple-ocsp: Allows OCSP Stapling. A legitimate OCSP response is stapled to the certificates that the server gives throughout TLS.
The certificates ought to now be obtained and mechanically put in.
And you may entry Plex net interface by way of HTTPS.
How to Improve Plex on Ubuntu 18.04
When a brand new model of Plex media server comes out, you possibly can improve it by executing the next instructions.
sudo apt replace
sudo apt improve
Then restart Plex.
sudo systemctl restart plexmediaserver
I hope this tutorial helped you put in Plex media server on Ubuntu 18.04. As all the time, for those who discovered this publish helpful, then subscribe to our free publication to get extra ideas and tips. Take care ?
Price this tutorial[Total: 26 Average: 4.4]
(perform(d, s, id)
var js, fjs = d.getElementsByTagName(s);
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/zh_CN/sdk.js#xfbml=1&version=v2.8&appId=961591023917170”;
(doc, ‘script’, ‘facebook-jssdk’));