Looking for a home media server to stream movies, tv shows or music? Plex is a great solution. Utilizing a remote server to store your media content can sometimes be better due to easily scalable space on most hosting platforms. Check out how to setup a working remote Plex Media Server below. This guide is written for CentOS 7, but can usually be done on other Linux distributions by replacing package installation commands accordingly.
1.) First lets always run an update on our server to get new packages if available:
yum update -y
2.) Now lets grab the latest Plex server package from their website. Go to https://www.plex.tv/downloads/ then click the Download button under "Download Plex Media Server". Change the drop down selection from Windows to Linux then click the "Download" button. It should pop up a small list of packages to download. For this we'll right click the "CentOS 64-bit (RPM for CentOS 6 or newer)" and copy the link to install on our server.
3.) Now lets install the package from the RPM link we got above by running the following command (replace the link with the newest RPM from their website above):
rpm -i https://downloads.plex.tv/plex-media-server/22.214.171.12457-24ffd60/plexmediaserver-126.96.36.19957-24ffd60.x86_64.rpm
4.) Now it should quickly install in a couple of setings. If you are get an "semodule: command not found" error on an OpenVZ VPS ou can simply ignore this.
5.) Lets set the Plex service to run at boot and start it:
systemctl enable plexmediaserver.service
systemctl start plexmediaserver.service
6.) Now run " systemctl status plexmediaserver.service " to check that it's running properly, the output should look something like this:
7.) Now to complete the server installation we need to create a temporary SSH tunnel from our PC to the server that the Plex media server is running on. Download and open PuTTy then enter in the server IP:
8.) Now click the "+ SSH" tab near the bottom on the left hand side where the category choices are, then click "Tunnels". Now type into the "Source Port" field the port 8888 as shown in the screenshot below. In the "Destination" field type in "localhost:32400". Now click the 'Add' button then click 'Open' to start the SSH connection.
9.) Once you click 'Open' enter your server details like normal. Once the SSH connection is open, and the Plex media server is running in the step #5 above, go to your web browser on your PC and enter in or go to the following URL: http://localhost:8888/web/index.html
10.) Now we're accessing the Plex media server that we setup remotely via the SSH tunnel. Once the page loads we need to agree with the Terms of Service. You might be require to login to your Plex account first, if so, just login. If you don't have a Plex account go to the Plex website and register an account with them, then login and access the Terms of Service.
11.) Once you agree it'll bring you to a page that goes over how Plex works. Just click the "Got it!" button to continue. Next it'll bring you to the server install page and pop up a Plex Pass subscription notice, just click the X button on the popup to close it and continue to the installation. Now you'll see the page which asks what you want to name your remote Plex media server, you can name it whatever you like so you know it's yours. Also make sure that the box to "Allow me to access my media outside my home" is ticked. If not, you won't be able to access it remotely.
If you get an error message when trying to save the settings in the screenshot above like "There was a problem saving your server settings", simply reboot your server. Once the server is rebooted and the Plex service starts again it should work fine. Make sure to restart the SSH tunnel and go back to http://localhost:32400/web/ after rebooting to continue the setup!
12.) Now we should be on the home page of the Plex web app. A notice bar near the top should say "An unclaimed media server has been found on your network. Claim it now". You should also see the media server name you chose in the left sidebar near the top. Click "Claim it now" so we can add it to our Plex account.
13.) Once you click "Claim it now" it should bring you to a settings page with a button to claim the server. click "CLAIM SERVER".
14.) If it prompts you to login once you click "CLAIM SERVER", just login using your Plex account credentials. If you get any errors when logging in to claim the server, just stop and start the Plex media server service again:
service plexmediaserver stop && service plexmediaserver start
15.) Now you should be able to connect directly to your media server without the SSH tunnel. We'll try this out by going to our server IP with the Plex port: http://<server_ip>:32400 (replace <server_ip> with your servers IP address). Now once the page is loaded at the top right make sure the media server name you setup initially is selected. In the screenshot below I already have another media server setup, but as you can see the new media server that we just setup can be selected and opened:
That's it! Now you can click "Add Library" once your empty media server is selected from that server list. It will ask you to create a new library for media content, you can choose from categories such as Movies, TV Shows, Music, and more. It will ask you to name your new library then to choose a directory for which it will search for new media content to use. Make sure to proprely name media before you put it in your library folder for it to use. Read their official naming article for more information: https://support.plex.tv/hc/en-us/categories/200028098-Media-Preparation
If you create a library for your Movies in "/var/lib/plexmediaserver/Movies" you'll need to rename movie files like so: "The Legend of Tarzan (2016).mkv"; This means the movie file names must be "<Movie Name> <(Year)>.<format>". TV shows must be done similarly, so if you create a TV Shows library in "/var/lib/plexmediaserver/TV Shows" and you want to upload a series of The Flash, you'll need to create a new directory tree like "/var/lib/plexmediaserver/TV Shows/The Flash/Season 01". Each season of a show must be in it's own directory inside of the shows root directory. All episodes for that season must be named such as "The Flash s01e01.mkv" and so on.
I'd also recommend going into the settings at the top right of the Plex page, click the Servers tab, then click the Library tab in the left sidebar. Tick "Update my library automatically" so immediately when you upload or move a media file into the appropriate directory it will add it to the media server list and download the meta data for it.
Want to upgrade your Plex Media Server to a new version?
If a new version of Plex Media Server is available, upgrading is easy and quick.
1.) Stop the service: service plexmediaserver stop
2.) Download the new version .rpm from the Plex site: https://www.plex.tv/downloads/ (Choose Linux, then CentOS 7 64-bit), save the .rpm to your server.
3.) Now run the rpm upgrade with the .rpm we justr downloaded. yum localupdate plexmediaserver*
4.) Now start the service again: service plexmediaserver start
If you have any suggestions to this guide please contact us.