How to Install Plex Media Server on Debian 11
Plex Media Server is a digital media player with the ability to host multiple online content channels from non-local sources. It runs on Windows, Linux, FreeBSD and OS X platforms. Plex Media Server enables you to aggregate all your media files stored on your computer, giving you instant access on all your devices.
The Plex Media Server is free to use, though some of its features are only available when using a Plex Pass subscription.
Here are some of the top Plex Media Server features.
- Multi-platform support for both client and server - allowing you to watch your media on many different devices. Plex applications are available on a wide range of platforms, including mobile phones, tablets, home theater PCs, streaming devices, smart TVs and set-top boxes.
- Playing back local media files, so you never need to download them first, saving disk space on your computer. Plex automatically converts your file using a high fidelity process, so you don't have to worry about things like bit rate or codecs – your media will always look its best.
- Remote access for your media files - securely stream any of your content to other devices on the same network. The Plex Media Server automatically converts your media on-the-fly to play on any device.
- Organizing and displaying your photo libraries, whether they are stored locally or synced through Google Drive, Dropbox or MobileMe - allowing you to display them as slideshows with fancy transitions.
- Creating photo albums from camera rolls across multiple platforms so you can have all of your images together in one place, regardless of where they were originally created. You can also create albums based on date/time or location, making organizing and enjoying your photos easier than ever.
Prerequisites
In order to set up your Plex Media Server on Debian 11, you will need the following:
- RAM: 2GB RAM recommended for smooth operation under Linux. Hard Disk Drive: at least 3 GB of available disk space for installation and additional free space for channel storage. Processor: at least 2 GHz Core for smooth operation under Linux.
- Root access to your Linux machine so you can install new software.
Updating the System
Before beginning, make sure to update your system. It's a good idea to ensure the packages in your repositories are up-to-date before installing a new package.
Enter the following command to update your Debian 11 system.
sudo apt update && sudo apt upgrade -y
Once the update command has finished, run the command below to install required dependencies.
sudo apt install unzip socat libexpat1 apt-transport-https -y
sudo apt install wget software-properties-common -y
Installing Plex Media Server on Debian 11
Now that your system is updated and the prerequisites are installed, you can go ahead and install Plex.
The Debian 11 base repository does not include the Plex Media Server package, so you will need to add a Plex repository to download and install it. First, import the GPG key to the APT keyring so it can verify the authenticity of the Plex repository.
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
You will get an OK message, meaning the key was correctly added to APT.
Sample output:
Now that your system can verify the authenticity of the Plex repository, you may add it as a source to your system.
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
Next, download and update the repository package lists.
sudo apt update
Finally, install the Plex Media Server by running the following command.
sudo apt install plexmediaserver -y
Once the installation is complete, you can start and enable Plex, so it starts on boot.
sudo systemctl start plexmediaserver && sudo systemctl enable plexmediaserver
You can also check the service's status and ensure it's running properly by running the following command.
sudo systemctl status plexmediaserver
You will get a result like the one below. The command will list the process ID, whether it is running in a foreground or background process, and how long it's been up.
Configuring the Firewall
Plex Media Server uses several ports for communication and client connections. These can be changed through the Plex Media Server settings. Plex uses port 32400 to listen for client requests. This is the main entry point for clients, such as TVs and mobile devices.
If you are running a firewall, you will need to allow traffic goes through on port 32400.
Run the following command to allow traffic on port 32400 for all interfaces so Plex can communicate with clients.
sudo ufw allow 32400
To verify the changes, run the following command.
sudo ufw status
You should see something like the following result. As you can see, it lists that port 32400 is allowed from any interface. Now you can access the Plex Media Server from any client on your network.
Configuring the Plex Media Server
You can configure the Plex Media Server once the server is installed. To access the Plex Web App Admin Console, enter your server's IP address with port 32400 in your browser's address bar.
http://server_ip:32400/web/
For example, if your server's IP address is 192.168.0.10, you'll enter http://192.168.0.10:32400/web/ in your browser's address bar. You can also search Plex Media Manager from your application menu in your Debian 11 server.
You will be taken to the log in screen as shown below.
Now, log in using an existing Google account or social media accounts. Press the Google or Facebook icon to log in with your existing account.
You'll be sent to the Plex initial setup page after you've logged in. If you haven't already, go to server_ip:32400/web/index.html#!/setup to proceed with the initial Plex setup. Follow the on-screen prompts to finish the Plex setup.
Configuring NGINX Reverse Proxy for Plex
To enable Plex's remote access feature, you have to set up a reverse proxy server. This can be done using Nginx. Nginx is a free, open-source, high-performance HTTP server and reverse proxy server. We use it as a reverse proxy server in this guide.
First, install the Nginx web server with the command below.
sudo apt install nginx -y
Once the installation is complete, you will need to start and enable Nginx by running the following command.
sudo systemctl start nginx && sudo systemctl enable nginx
You can check that the Nginx install was successful by checking the status of Nginx with the following command.
sudo systemctl status nginx
You should see something similar to the below result.
Next, you need to create a new Nginx virtual host configuration file for Flex. This will make managing the Nginx proxy for Plex Media Server easier.
sudo nano /etc/nginx/conf.d/plex.conf
Add the following lines to the Plex Nginx configuration file.
server {
listen 80;
server_name plex.your-domain.com;
location / {
proxy_pass http://127.0.0.1:32400;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#upgrade to WebSocket protocol when requested
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
You can replace plex.your-domain.com with your domain name. Save and close the file when you are finished by pressing CTRL-X, Y, and Enter.
Check the Nginx configuration for syntax errors by running the following command.
sudo nginx -t
If you receive any warnings or errors, fix them and re-run the command until you get no error messages.
Sample output:
Reload Nginx for the changes to take effect with the following command.
sudo systemctl reload nginx
Now you can access Plex Media Server from any client on your network using the domain name you assigned to Plex.
Conclusion
Plex Media Server is an excellent media server software. It is easy to configure and use. You can now enjoy all your media content from any client on your network.
In this guide, you've learned how to install Plex Media Server on a Debian 11 system. You've also learned how to configure the Plex Media Server and set up a reverse proxy server using Nginx.