We are going to take a look at installing Plex Media Server on a headless linux server. This will be helpful for anyone running plex in a VM and doesn’t want a DE hogging resources. This server can be bare metal or a VM, I will be installing onto a VM.
You’re going to want to login to your server via SSH. This guide can be adapted to other linux operating systems as well, and should work with any rpm based distro, but I will be using centOS Stream.
Download/Install Plex Media Server
This is the current Plex Media Server as of this writing. You can find the most current version by going to the Plex Media Center Downloads page, which is located here.
[jeff@centos ~]$ wget https://downloads.plex.tv/plex-media-server-new/1.23.4.4712-1f0ed4aea/redhat/plexmediaserver-1.23.4.4712-1f0ed4aea.x86_64.rpm
This will have downloaded the plexmediaserver rpm onto your system. To install it we will use the rpm -ivh command. You need to use sudo to do it, otherwise you will get a permission denied error.
[jeff@centos ~]$ sudo rpm -ivh plexmediaserver-1.23.4.4712-1f0ed4aea.x86_64.rpm
[sudo] password for jeff:
warning: plexmediaserver-1.23.4.4712-1f0ed4aea.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 3adca79d: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:plexmediaserver-1.23.4.4712-1f0ed################################# [100%]
Created symlink /etc/systemd/system/multi-user.target.wants/plexmediaserver.service → /usr/lib/systemd/system/plexmediaserver.service.
[jeff@centos ~]$
It’s as easy as that! Plex media server is now installed on your headless server. Let’s enable it so that it starts at boot time.
[jeff@centos ~]$ sudo systemctl enable plexmediaserver.service
You can check the status of plex media server by issuing this command.
[jeff@centos ~]$ systemctl status plexmediaserver.service
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; ve>
Active: active (running) since Tue 2021-06-29 16:20:14 MDT; 8min ago
Main PID: 2011 (Plex Media Serv)
Tasks: 45 (limit: 11205)
Memory: 85.9M
CGroup: /system.slice/plexmediaserver.service
├─2011 /usr/lib/plexmediaserver/Plex Media Server
├─2035 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Re>
├─2077 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmedi>
├─2116 Plex Plug-in [com.plexapp.agents.imdb] /usr/lib/plexmediaserv>
└─2144 /usr/lib/plexmediaserver/Plex Relay -p 443 -N -R 0:127.0.0.1:>
As a little preliminary measure before we set it up, let’s create a directory where we want to store our plex content outside of our home folder. The reason for having it outside of the home folder is by default centOS only allows the owner of the home folder to access it, not any groups. So we don’t want to change permissions for our entire home folder. We can just use a folder outside of our home and give plex access to it.
[jeff@centos ~]$ sudo mkdir /plexmovies
Now we want to add the plex user to our user group, and change ownership so that plex will be able to read from the folder.
[jeff@centos ~]$ sudo usermod -a -G jeff plex
That command adds plex to the group “jeff”. Your group will be your username unless you have specifically made separate groups.
Now let’s change ownership and permissions.
[jeff@centos ~]$ sudo chown jeff:jeff /plexmovies/
[jeff@centos ~]$ chmod 755 /plexmovies/
Since the plex user is in the user group, we shouldn’t have a problem with plex finding our content.
To make sure all of our changes go through and our setup goes correctly, restart the plexmediaserver.service.
[jeff@centos ~]$ sudo systemctl restart plexmediaserver.service
Configuration and Setup on a Headless Server
Since our server is headless, we cannot open a browser on it to continue with the setup. So what we want to do is SSH into the server again but use some extra flags on the command. The command we are going to run will bind and open a connection that we can access locally on our main machine. Make sure you know the IP address of your plex server, if you don’t, you can use the ip command to find out.
[jeff@centos ~]$ ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 172.16.1.187/24 brd 172.16.1.255 scope global dynamic noprefixroute ens33
inet6 fe80::20c:29ff:fea4:1e02/64 scope link noprefixroute
[jeff@centos ~]$
As we can see my server is located at 172.16.1.187. I am going to ssh into the server again with different options on the command. Change the command to fit your user and your servers IP address.
ssh user@ip.address.of.server -L 8888:localhost:32400
% ssh jeff@172.16.1.187 -L 8888:localhost:32400
Now we can open a browser and configure plex as if we were doing it locally on the server. Open your browser and in the web address bar type in http://localhost:8888/web
After this you will sign into your plex account and be presented with this window.
Click on “GOT IT!” to continue the setup.
The next screen is the server setup screen, where you will give your server a friendly name.
Clicking on “NEXT” will take you to the “Media Library” tab. This is where the folder we created earlier will come in handy as a place to store all of our content.
Select “ADD LIBRARY” and you will be presented with a screen asking you what types of libraries you want to add.
Since we just created a movies folder, I will select movies here. You will want to create a folder for each library in order to keep things organized. After I select “Movies” it allows me to create a name for the library. After hitting “NEXT” you can select the folder you have created to store your plex movies.
Select “Browse for media folder” and find the folder you created.
Select “/plexmovies” and “ADD”. And then on the next screen select “ADD LIBRARY”.
Do this for all other folders where you want to store plex content, such as tv shows. You should now have a successful plex install, and other devices on your network can connect to it. Start adding content and enjoy your new server!
Additional setup
If UPnP (universal plug and play) is not working correctly or you keep getting an indirect access message from other devices on your network, we need to allow some ports in the OS firewall.
[jeff@centos ~]$ sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
[jeff@centos ~]$ sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
[jeff@centos ~]$ sudo firewall-cmd --permanent --zone=public --add-port=32400/tcp
[jeff@centos ~]$ sudo systemctl restart firewalld
Conclusion
Thats it! You’re done! Hopefully this guide helped you in installing your very own plex media server. If you experience any issues or have any questions, feel free to comment or contact us.
Bonus
To uninstall plex media server, use these commands.
[jeff@centos ~]$ sudo systemctl stop plexmediaserver.service
[jeff@centos ~]$ sudo rpm -e plexmediaserver
libsemanage.semanage_direct_remove_key: Removing last plexrsync module (no other plexrsync module exists at another priority).
[jeff@centos ~]$ sudo rm -R /var/lib/plexmediaserver/
[jeff@centos ~]$ sudo userdel plex
Now plex is completely uninstalled.
Thank you for reading! Hopefully now you have installed plex media server on a headless server!
Follow us on twitter at @vulnifo to stay updated with new posts and information!
Visit our contact page for more ways to get in touch.
Great post, really help me a lot. Thanks!!
What’s up, this weekend is fastidious for me, because this point in time i am reading this enormous educational piece of
writing here at my residence.
I don’t even know how I ended up right here, but I
assumed this submit was once great. I do not understand who
you might be but certainly you are going to a famous blogger if you happen to are not already.
Cheers!