Ubuntu 16.04: Install PLEX for personal media server like youtube

Table of Contents

1 Install PLEX

Download latest PLEX from project page.

$ wget sudo dpkg -i plexmediaserver_0.

A systemd is set and plex user is added when installing PLEX. If you use ufw, open 32400/tcp and 32400/udp.

2 Install Chromium

Firefox cannot play movie of PLEX. Please install Chrome or Chromium.

$ sudo apt-get install -y chromium-browser chromium-browser-l10n

3 Connect to PLEX

Access to below URL with Chromium or Chrome.

http://[IP address or name of Ubuntu 16.04]:32400/web

License agreement is dislayed. Press “Agree”.


Access to URL again.

4 Add Library

PLEX manages movies and pictures with Library.

Library will scan all file recursively from the specified directory and create metadata like thumbnail.

And then movie and picture is available.

The metadata is at below direcotry.

/var/lib/plexmediaserver/Library/Application Support

Movie library will scan only movie data and Picture library will scan only picture data.

This article will use Movie library specified with below directory.


Press “Add Library” at the left side and choose. Select library type and press “NEXT”.




Specify directory of library.

You can specify multiple directory.

Press “ADD” and “ADD LIBRARY”.


You should create directory if the directory is not exists.

The directory must be readable by PLEX.

$ sudo mkdir -p /var/lib/plexmediaserver/Library/Movies$ sudo chown hiroom2:hiroom2 /var/lib/plexmediaserver/Library/Movies$ ls -l /var/lib/plexmediaserver/Library/total 8drwxr-xr-x 3 plex plex 4096 5月 21 23:24 Application Supportdrwxr-xr-x 2 hiroom2 hiroom2 4096 5月 22 12:36 Movies

5 Add movie

There is no way of uploading movie and picture by browser.

You need to move movie and picture to direcotry.

This article will run mv command.

MyYoutube is a directory which includes multiple movies.

$ mv MyYoutube /var/lib/plexmediaserver/Library/Movies/

Scan will not be started automatically by default.

You can start to scan manually by pressing “Update Library”.


Deck shows thumbnails of movies after scanning.


Movie will be started by clicking a thumbnail.


6 Allow access only from private network

PLEX can control access list with IP address. Press “Setting”.


Press “Server” at the upper right. Press “Network” and “SHOW ADVANCED”.


Add access list to “List of networks that are allowed without auth”.

This article will add private network “”.

Press “SAVE CHANGES” and setting will be updated.


If you use apache2 digest authentication, please add “”.

7 Scan automatically

Scan is not started automatically by default.

This article will change to be started automatically when the directory of library detectes changes.

Press “Library” at “Setting”.

Check “Update my library automatica

Press “SAVE CHANGES” and setting will be updated.


8 Apache2 digest authentication (Optional)

PLEX does not have an authentication for private network.

This article will use apache2 proxy_http module and enable authentication for private network with auth_digest module.

There is a room for changing URL like www.my.server to www.my.server/plexmediaserver.


Install apache2 with apt and enable modules with a2enmod.

$ sudo apt-get install -y apache2$ sudo a2enmod proxy_http rewrite auth_digest

Create password file which has a realm “plexmediaplayer” realm and a user “hiroom2”.

This user will be used when accessing to URL.

$ sudo htdigest -c /etc/apache2/.plexmediaserver_htdigest “plexmediaserver” hiroom2Adding password for plexmediaserver in realm hoge.New password:Re-type new password:

Create site configuration for PLEX according to this site.

$ cat /etc/apache2/sites-available/plexmediaserver.confProxyPass / / OffProxyPreserveHost OnRewriteEngine onRewriteCond %{REQUEST_URI} !^/webRewriteCond %{HTTP:X-Plex-Device} ^$RewriteRule ^/$ /web/$1 [R,L]<Proxy> AuthType Digest AuthName “plexmediaserver” AuthUserFile /etc/apache2/.plexmediaserver_htdigest Require valid-user</Proxy>

Enable site with a2ensite.

$ sudo a2ensite plexmediaserver

Restart apache2.

$ sudo systemctl restart apache2

You can still access with :32400.

Please change “List of networks that are allowed without auth” to “”.


Username and password are required when access to URL without :32400 on Chrome of Android.


Accessing to PLEX is completed.


Android | Linux | SDL - Narrow Escape