Ubuntu 14.04 Fresh install and installing Plex

Anyone got any step-by-step walk thru links for setting up Plex on a Ubuntu box. I'm finding information spotty at best, and just re-installed my OS fresh so I can try and get it right this time. 

 

I've found mentions to useful tidbits here:

 

https://support.plex.tv/hc/en-us/articles/200288586-Installation

 

https://support.plex.tv/hc/en-us/articles/200484543-Connecting-a-Server

 

http://askubuntu.com/questions/150909/plex-wont-enter-my-home-directory-or-other-partitions

 

https://support.plex.tv/hc/en-us/articles/200288596-Linux-Permissions-Guide

 

I also dropped in a few Windows formatted drives I had laying around containing media files and this came in handy:

 

https://help.ubuntu.com/community/MountingWindowsPartitions

I recently just fresh rebuilt my Plex server on Ubuntu server 12.04 (no GUI) but it shouldn't be too far off from 14.04. I have put together a set of instructions from installing to modifying kernel modules that work for my needs. Here you go:

================================================================================================

Install plex:

# dpkg -i plexmediaserver_0.9.9.7.429-f80a8d6_i386.deb
# echo 'deb http://plex.r.worldssl.net/PlexMediaServer/ubuntu-repo lucid main' >> /etc/apt/sources.list.d/plexmediaserver.list
# service plexmediaserver restart
 
by default, it runs on port 32400 so to access it if you're using 
192.168 through a browser would be to go to
 
192.168.1.xx:32400/web/index.html
 
…. once Plex is accessible through browser, you can create a user and login. You may configure settings within Plex from here only.
 
If you’re creating a NAT from your Public IP on port 6666 to point to your server’s internal IP on port 32400 (default plex port), if you want to view videos from outside your network, you’ll have to configure the “Plex Port Forwarding” in the browser to point to port 6666

================================================================================================

Install Packages (some packages may need to be installed individually as this one-liner may complain; once you get individual packages sorted, then you may use the one-liner)
 
apt-get update; apt-get install -y -f smartmontools lm-sensors gparted openssh-server gdisk vim avahi-utils avahi-daemon libdaemon0 libnss-mdns libavahi-core7 git build-essential autoconf autopoint libtool libx11-dev libgl1-mesa-dev libxrender-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libglew1.6-dev libmad0-dev libsamplerate-dev libogg-dev libvorbis-dev libbz2-1.0 libbz2-dev libwavpack-dev libmpeg2-4-dev libfribidi-dev libsqlite3-dev libpng-dev libpcre3-dev libcdio-dev libmysqlclient-dev libmodplug-dev libfaad-dev libflac-dev libsmbclient-dev libsdl-mixer1.2-dev libxt-dev libxtst-dev libxmu-dev libxinerama-dev libcurl4-gnutls-dev libdbus-1-dev libhal-storage-dev libhal-dev libpulse-dev libavahi-common-dev libavahi-client-dev libxrandr-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev liba52-dev libdts-dev libfaad-dev libmpeg2-4-dev libass-dev libflac-dev libwavpack-dev python-dev gawk gperf nasm libbluetooth-dev zlib1g-dev libmms-dev libsmbclient-dev libtiff4-dev libiso9660-dev libssl-dev libmicrohttpd-dev libmodplug-dev libssh-dev libsdl-image1.2-dev cmake libmysqlclient-dev libsmbclient-dev libxrandr-dev mesa-utils liblzo2-dev libjasper-dev unzip zip libvdpau-dev ffmpeg fail2ban faac ethtool htop chkconfig python-setuptools powertop sysstat transcode libdlna0 nmap transcode-utils libavcodec-extra-53 libx264-dev libx264-120

================================================================================================

System Config settings for optimization:
 
 

================================================================================================

Converting video files:
 
If you want to convert video files in .mkv containers to have x264 video and arc audio, you can run this 'for' loop in the directory where your .mkv files are. I did this so I can stream to cell/older pc/xbox 360 without causing my server to hit high load.
 
# for f in *.mkv; do avconv -y -i "$f" -vcodec libx264 -acodec libvo_aacenc -ac 2 “${f%.mkv}.mp4"; done

================================================================================================

 

As for the drives, if you're planning on reformatting the NTFS/FAT drives you have, this is how I formatted my 3TB drive (where I store all my media files)

===========================================================================
— Adding a new drive 
 
-make mount point based off serial number
# smartctl --all /dev/sdb | grep "Serial Number"
Serial Number:    Z5004305
# mkdir /disk-Z5004305
 
-add drive using ‘parted’
# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
(parted) mkpart pri 4096 -1
(parted) print                                                            
Model: ATA ST3000DM001-1ER1 (scsi)
Disk /dev/sdb: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: get
 
Number  Start   End     Size    File system  Name           Flags
1      4096MB  3001GB  2996GB               disk-Z5004305
 
# mkfs.ext4 /dev/sdb1 
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
182894592 inodes, 731566592 blocks
36578329 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
22326 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
102400000, 214990848, 512000000, 550731776, 644972544
 
# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.1
 
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present
 
Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 09134C0B-323E-487B-BC75-432E0D8F00C4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 8000365 sectors (3.8 GiB)
 
Number  Start (sector)    End (sector)  Size       Code  Name
    1         7999488      5860532223   2.7 TiB     0700  disk-Z5004305
 
# mount /dev/sdb1 /disk-Z5004305/
# tail -1 /etc/mtab >> /etc/fstab
 
-Configure using UUID so a new disk addition doesn’t break things:
# blkid
/dev/sda1: UUID="f36cc855-b136-4745-afc3-3df0a1f40f6b" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sda5: UUID="JjDmiv-OmqH-QPz3-7ri0-3AWK-N28K-Xef9ZL" TYPE="LVM2_member" 
/dev/sdb1: UUID="8dbc863e-9694-4c14-b1fb-37097150e337" TYPE="ext4" 
/dev/mapper/VolGroup01-root: UUID="04a5a17e-46d8-4091-8d79-48e1e2c601f3" TYPE="ext4" 
/dev/mapper/VolGroup01-tmp: UUID="000ad123-04ef-4141-ab0d-a708791fed27" TYPE="ext4" 
/dev/mapper/cryptswap1: UUID="41ebb94b-61ff-46b1-862e-49ddd0438524" TYPE="swap" 
 
# cat /etc/fstab
#            
proc                /proc         proc    nodev,noexec,nosuid 0 0
 
UUID=04a5a17e-46d8-4091-8d79-48e1e2c601f3   /             ext4    errors=remount-ro 0 1
UUID=f36cc855-b136-4745-afc3-3df0a1f40f6b   /boot         ext3    defaults          0 2
UUID=000ad123-04ef-4141-ab0d-a708791fed27   /tmp          ext4    defaults          0 2  
UUID=d170353f-420e-4af4-b6a2-80a92e7d0bba   swap          swap    defaults          0 0
UUID=8dbc863e-9694-4c14-b1fb-37097150e337   /disk-Z5004305  ext4  rw     0 0
==================================================================================================

Did you guys need to add all those extra packages, besides the plexmediaserver_0.9.11.4.739-a4e710f_amd64.deb ?

My install is on ubuntu server 14.04 LTS, but I keep getting irritating errors. I followed these steps

https://support.plex.tv/hc/en-us/articles/200288586-Installation

But they're pretty simple, and don't mention anything about all these additional packages.

Thanks!

apt-get update; apt-get install -y -f smartmontools lm-sensors gparted openssh-server gdisk vim avahi-utils avahi-daemon libdaemon0 libnss-mdns libavahi-core7 git build-essential autoconf autopoint libtool libx11-dev libgl1-mesa-dev libxrender-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libglew1.6-dev libmad0-dev libsamplerate-dev libogg-dev libvorbis-dev libbz2-1.0 libbz2-dev libwavpack-dev libmpeg2-4-dev libfribidi-dev libsqlite3-dev libpng-dev libpcre3-dev libcdio-dev libmysqlclient-dev libmodplug-dev libfaad-dev libflac-dev libsmbclient-dev libsdl-mixer1.2-dev libxt-dev libxtst-dev libxmu-dev libxinerama-dev libcurl4-gnutls-dev libdbus-1-dev libhal-storage-dev libhal-dev libpulse-dev libavahi-common-dev libavahi-client-dev libxrandr-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev liba52-dev libdts-dev libfaad-dev libmpeg2-4-dev libass-dev libflac-dev libwavpack-dev python-dev gawk gperf nasm libbluetooth-dev zlib1g-dev libmms-dev libsmbclient-dev libtiff4-dev libiso9660-dev libssl-dev libmicrohttpd-dev libmodplug-dev libssh-dev libsdl-image1.2-dev cmake libmysqlclient-dev libsmbclient-dev libxrandr-dev mesa-utils liblzo2-dev libjasper-dev unzip zip libvdpau-dev ffmpeg fail2ban faac ethtool htop chkconfig python-setuptools powertop sysstat transcode libdlna0 nmap transcode-utils libavcodec-extra-53 libx264-dev libx264-120

Hey dkerlee,

The packages I put aren't all necessary --- most of them are transcoding related but not at all required by Plex Team. I do think Plex requires the packages 'avahi-utils' and 'avahi-daemon'. Most other packages I installed are utilities I use regularly:

smartmontools - Control and monitor storage systems using S.M.A.R.T.

lm-sensors - Lm-sensors is a hardware health monitoring package for Linux.

gparted - GParted uses libparted to detect and manipulate devices and partition

 tables
openssh-server -  Ssh (Secure Shell) is a program for logging into a remote machine
 and for executing commands on a remote machine.
vim - command line text editor

ethtool - display or change Ethernet device settings

fail2ban - monitors log files for malicious attacks

sysstat - contains resource monitoring

nmap - port scanner

powertop - provides resource information and identifies tunables

chkconfig - system tool to enable or disable system services

...... TL;DR

I've seen it fail by not having the 'avahi' packages installed. If you want to continue through the information I provided, all you NEED are the following

# apt-get update; apt-get install avahi-utils avahi-daemon gparted gdisk vim  -y

..... What kind of errors are you getting? Do you have the particular output?

Converting video files:
 
If you want to convert video files in .mkv containers to have x264 video and arc audio, you can run this 'for' loop in the directory where your .mkv files are. I did this so I can stream to cell/older pc/xbox 360 without causing my server to hit high load.
 
# for f in *.mkv; do avconv -y -i "$f" -vcodec libx264 -acodec libvo_aacenc -ac 2 “${f%.mkv}.mp4"; done

================================================================================================

 

Silly question from me, but how do you run this script? :)

I have followed the rest as you pointed out and it works absolutely perfect, but the script would just make it even better :)

Silly question from me, but how do you run this script? :)

I have followed the rest as you pointed out and it works absolutely perfect, but the script would just make it even better :)

You would change to the directory where all your media is stored.

# cd /media/plex/movies/

# ls -al *

movie1.mkv

movie2.mkv

# for f in *.mkv; do avconv -y -i "$f" -vcodec libx264 -acodec libvo_aacenc -ac 2 “${f%.mkv}.mp4"; done

Then, as long as you have 'ffmpeg' installed, you should be able to run that 'for' loop and it will systematically convert all the 'mkv' extension files to x264 video and aac audio. Each file conversion is dependent on not only the size of the file but the performance of your CPU. If you have a powerful CPU and a 200Mb file, it should take a few minutes. If you have a weaker CPU, it may take 40+ minutes.

# ls -al /media/plex/movies/

movie1.mp4

movie2.mp4

This will give you all the information you need about that file

# mediainfo /media/plex/movies/movie1.mp4

Using Ubuntu 14.10 amd64

When I put this in:

apt-get update; apt-get install -y -f smartmontools lm-sensors gparted openssh-server gdisk vim avahi-utils avahi-daemon libdaemon0 libnss-mdns libavahi-core7 git build-essential autoconf autopoint libtool libx11-dev libgl1-mesa-dev libxrender-dev portaudio19-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libglew1.6-dev libmad0-dev libsamplerate-dev libogg-dev libvorbis-dev libbz2-1.0 libbz2-dev libwavpack-dev libmpeg2-4-dev libfribidi-dev libsqlite3-dev libpng-dev libpcre3-dev libcdio-dev libmysqlclient-dev libmodplug-dev libfaad-dev libflac-dev libsmbclient-dev libsdl-mixer1.2-dev libxt-dev libxtst-dev libxmu-dev libxinerama-dev libcurl4-gnutls-dev libdbus-1-dev libhal-storage-dev libhal-dev libpulse-dev libavahi-common-dev libavahi-client-dev libxrandr-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev liba52-dev libdts-dev libfaad-dev libmpeg2-4-dev libass-dev libflac-dev libwavpack-dev python-dev gawk gperf nasm libbluetooth-dev zlib1g-dev libmms-dev libsmbclient-dev libtiff4-dev libiso9660-dev libssl-dev libmicrohttpd-dev libmodplug-dev libssh-dev libsdl-image1.2-dev cmake libmysqlclient-dev libsmbclient-dev libxrandr-dev mesa-utils liblzo2-dev libjasper-dev unzip zip libvdpau-dev ffmpeg fail2ban faac ethtool htop chkconfig python-setuptools powertop sysstat transcode libdlna0 nmap transcode-utils libavcodec-extra-53 libx264-dev libx264-120

I got this:

Package ffmpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libtiff4-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libtiff5-dev:i386 libtiff5-dev

Package chkconfig is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libavcodec-extra-53 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libav-tools:i386 libav-tools

Package transcode-utils is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
transcode:i386 transcode

E: Unable to locate package libhal-storage-dev
E: Unable to locate package libhal-dev
E: Package ‘libtiff4-dev’ has no installation candidate
E: Package ‘ffmpeg’ has no installation candidate
E: Package ‘chkconfig’ has no installation candidate
E: Package ‘transcode-utils’ has no installation candidate
E: Package ‘libavcodec-extra-53’ has no installation candidate
E: Unable to locate package libx264-120

After eliminating all of them with issues, I was left with:

sudo apt-get update; sudo apt-get install -y -f smartmontools lm-sensors gparted openssh-server gdisk vim avahi-utils avahi-daemon libdaemon0 libnss-mdns libavahi-core7 git build-essential autoconf autopoint libtool libx11-dev libgl1-mesa-dev libxrender-dev libavcodec-dev libavformat-dev libswscale-dev libavdevice-dev libglew1.6-dev libmad0-dev libsamplerate-dev libogg-dev libvorbis-dev libbz2-1.0 libbz2-dev libwavpack-dev libmpeg2-4-dev libfribidi-dev libsqlite3-dev libpng-dev libpcre3-dev libcdio-dev libmysqlclient-dev libmodplug-dev libfaad-dev libflac-dev libsmbclient-dev libsdl-mixer1.2-dev libxt-dev libxtst-dev libxmu-dev libxinerama-dev libcurl4-gnutls-dev libdbus-1-dev libpulse-dev libavahi-common-dev libavahi-client-dev libxrandr-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev liba52-0.7.4-dev libdts-dev libfaad-dev libmpeg2-4-dev libass-dev libflac-dev libwavpack-dev python-dev gawk gperf nasm libbluetooth-dev zlib1g-dev libmms-dev libsmbclient-dev libiso9660-dev libssl-dev libmicrohttpd-dev libmodplug-dev libssh-dev libsdl-image1.2-dev cmake libmysqlclient-dev libsmbclient-dev libxrandr-dev mesa-utils liblzo2-dev libjasper-dev unzip zip libvdpau-dev fail2ban faac ethtool htop python-setuptools powertop sysstat transcode libdlna0 nmap libx264-dev transcode libtiff5-dev

Are these necessary? A couple of them had substitutions.

libx264-120 transcode-utils portaudio19-dev ffmpeg libavcodec-extra-53 libtiff4-dev chkconfig libhal-storage-dev libhal-dev

Most Methods mentioned here are older, you can still use this kind of method if you wish and even could build Plex Server from source if you wish, but Plex now provides Binary Packages for Ubuntu [including derivatives like I use xUbuntu and still just use Ubuntu package just fine all the time (I have Plexpass lifetime and use Plexpass version of server)].  Short answer is once you use a binary package it specifies required dependancies in the package and so those will be installed for you as part of the overall process you do not really need to go trying to figure out and install dependancies ahead of time.  Keep reading for more details but really just grab binary package from page open from your favorite file manager and click install (or Upgrade if already installed) in software center and if it says this package does not meet standards this is only because it does not like the email provided for support which is a recent added package check Ubuntu has instituted in past few months, but does not affect Plex in the least). Otherwise nothing about Plex Server code, use, or anything is actually affected just tell it to install anyways and you are good.  Trust me been using xUbuntu since 12 with PlexServer (~ what 3-4 years solid now) constantly upgrading to newest Plex Pass version as it is released and I have a VAST media collection trust me it works completely period. :-)

Here is direct link and should open the downloads page [Public Channel] and if Linux tab is not automatically opened for you just click the Linux tab and click 32 or 64-Bit button below the distro you use and viola just install that using Synaptic or Software Center [or similiar facility in Fedora, Cent OS, or FreeBSD]: https://plex.tv/downloads

As far as installing plex server in Linux just visit the http://plex.tv click on downloads tab [login and click plex pass button if you have plexpass and want the beta] then all you do is click Computer and a new screen pops.  Then click Linux tab and grab the binary you need [most will be using Ubuntu [which is a Debian derivative and as such should work for Debians].  They also have Fedora binaries as well as CentOS.  There is also a FreeBSD tab should you be using that. 

Once you download the needed binry (in ubuntu''s case the *.deb file) and double click on it when viewing in a file manager and this will open software center. 

Click the Install button and provide your password for sudo access.  Now it will install not only Plex Media Server but any and all needed dependencies automagically for you.  It may complain the package is not compliant and may cause issues.  For Plex this is a HOLLOW warning as their suppolrt email provided in package is invalid so it is only complaining about that.  Nothing about Plex Server itself is affected.  Just click Install Anyway and you are good. 

Once done visit http://localhost:32400/web/in browser and setup your media directories and enjoy.

For updates just grab new versions binary file from Downloads and when you double click on it using a file manager it will open Software Center and Install button becomes Upgrade.  Click enter password and go.  Now if you are like me I like to open a terminal and issue

sudo service plexmediaserver stop

before I click Upgrade button just to ensure no files remain in use during upgrade but really in Ubuntu and most major Linux derivatives it will automatically stop the running process as a part of the upgrade process before it applies new files, but I am old school ish [I don't feel like building from source for something that has an easy to use binary package anyays.

Last Note yes if you enable all repos [restricted extras in software sources control panel] you will find if you search Software center in Ubuntu there is already a Plex Server entry that you can click and it will install, but I find this version found within Ubuntus official repos is not updated oftgen at all so it is usable, but if you want the latest versions [ESPECIALLY if using Plex Pass version] you must download binary as Ubuntu Official repo offering is only the Public version that is offered for free.  It still is behind the version you can download from Plex.tv Downloads page in any case so again you still get a newer version grabbing it from Plex.tv Downloads page.

Here is direct link and should open the downloads page [Public Channel] and if Linux tab is not automatically opened for you just click the Linux tab and click 32 or 64-Bit button below the distro you use and viola just install that using Synaptic or Software Center [or similiar facility in Fedora, Cent OS, or FreeBSD]: https://plex.tv/downloads

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.