How many times have you found yourself flicking through the channels, and can’t find anything to satisfy you. Or do you have a load of movies saved, but are tired of having to connect up the laptop to the TV and having to control the pausing and playing of the movie from the laptop?
A few years ago I was looking for a set-top box for watching Netflix. I eventually got a Roku set-top box, which had many apps, including Netflix, Youtube and Plex. Plex is a great app for playing movies you have saved to a local computer or NAS device straight to your TV. No more messing with cables and having to plug in your laptop, or worry about it powering down half-way through the movie. As I already had a hard drive full of movies, Plex gave me a very easy way of watching them on my TV, and turned what was a hobby home server, into a serious and purposeful home entertainment project that the whole family could enjoy.
Installing the Plex server involves downloading and installing the correct installer file for Ubuntu, opening the appropriate port on your firewall, and then setting up a library with your movie folder. The server will be an Ubuntu 18.04 LTS server.
Playing movies with Plex requires two elements: the client and the server. The server is where your movie files are stored and served from; the client is the unit from which you watch the movies. In my case, the client was an app on the Roku. Plex also have apps for smart TVs, mobile devices, computers, etc, so you can watch your stored videos using a variety of devices. They have a wide range of supported platforms listed on their site. The Plex server is what we are going to install on our linux server and which will serve movies to the app.
The first step is to go to plex.tv and sign up for an account. Once you have an account, go to Your Media, and click the link to download the media server.
From the drop down menu, choose Linux as your platform. Rather than downloading the installer, we are going to copy the link and then use our own server to download it.
Click Choose Distribution, and hover your mouse over the option for Ubuntu 64-bit (14.04 or newer). Right click and copy the link. If you are running a 32-bit server then copy the link for that. 32 bit applications will run on 64 bit systems, but not vice versa.
Note: If you look at the links provided for the different linux versions, you will notice that Ubuntu servers get a .deb file, while Fedora and CentOS servers get a .rpm file. These are similar to .msi installer files on Windows. Ubuntu is based on the Debian operating system, and uses the Debian Package Manager (dpkg) to install .deb files. Fedora and CentOS are based off of Red Hat and use the Red Hat Package Manager (rpm) to install .rpm files. By default, Ubuntu cannot install .rpm files, so it is important to choose the correct installer file.
Log into your server over SSH and use wget to download the installer. To paste text into PuTTY, Ctrl + v wont work. Instead use Shift + Insert, or pressing the right click button on your mouse works also.
wget is most often installed by default on Ubuntu servers, but if it is not, run sudo apt-get install wget to download it.
Once downloaded, use dpkg, the Debian Package Manager, to install it.
dpkg –i https://downloads.plex.tv/plex-media-server/plexmediaserver_..._amd64.deb
Opening a Firewall Port
Plex uses port 32400 for when you want to set up and administer your server, and for clients connecting to it. You will need to open this port in your firewall with the following command:
sudo ufw allow tcp/32400 comment "Plex server"
Once installed, log in to the web portal to begin setting up your movie collection. If your servers IP address is 192.168.1.100, visit https://192.168.1.100:32400/web.
Using the username and password you created earlier, log in to the server. In order to connect the server and the client device (Smart TV, set top box, mobile app, etc), the client device may display a PIN to be entered on the server web interface.
Setup a Playlist
Plex has a nice, user friendly interface when you log in, with links clearly labelled throughout the page. As you explore the various Settings and links, there is a Home link at the top which will always bring you back to the home screen. It is from here that you can set up a playlist for watching your library of movies.
Under ‘Playlists’, click to Add a Library. You will be asked to select your library type. For movies, choose Movies. If you want to watch videos you have made yourself, of family holidays for example, you would choose Other Videos. For any videos in the Movies library, Plex will go out to internet databases to get cover arts and details of the movies. It won’t do this for the Other Videos library.
Click Next, and Plex will prompt you to browse your server for your media folders. Here it helps to have your TV shows, home videos and moves in separate folders, so they don’t end up in the wrong libraries. Click the ‘/’ icon on the left, and then browse to your media folder through the folders on the right.
When I was first setting up my movie libraries, I was unable to see my movie folder listed on the right hand side. This turned out to be a permissions issue. Plex runs under its own user and group (plex:plex), so you have to ensure that your media folder(s) have allowed permission for this user to browse and read the files (chmod –R 777 /path/to/movies).
Once done, click Add, and then Add Library. Plex should begin scanning the folder(s) you have selected and you should begin to see the cover art for the movies, etc, appearing on the home screen.
One particular setting I would recommend is under Settings >Library > Scan my library automatically. This will scan your library whenever it notices that you have added a new movie to the server folder where the movies are saved, making it available to watch immediately.