In a previous post I’ve described this process with Ubuntu 12.04 LTS but here I’m going to run through setting up a basic installation of Ubuntu 14.04 LTS (Long Term Support – 2019 in this case) without the GUI on an HP MicroServer N40L/N54L so it can run headless. In addition we’ll get Plex Media Server installed and configure Samba so we can access the media libraries from a Windows PC (as a source for media files).
If you’re using Ubuntu 12.04 LTS, check out my other post here.
If you need any assistance with Ubuntu 16.04 LTS – check out my notes here.
Plex Media Server allows you to store your Sections (the logical name given to a folder of media files) in different locations but if you want to maximise your storage space in your MicroServer it’s worth thinking in advance where you want Ubuntu installed. For example do you want it on one of the hard disks in your system (potentially losing this disk for media) or on a USB flash drive (the HP MicroServer N40L/N54L have an internal USB2 slot – show in first image below)
I use an HP Microserver N40L with an internal USB flash drive (Sandisk Cruzer Fit 16GB – shown in second image above) and two 2TB disks (at the moment) in a ZFS mirror. I’ve found the Sandisk Cruzer to be quite slow (as expected) when compared against a spinning hard disk – primarily during software updates (unpacking/installing). Under normal operation I don’t see any sluggishness.
Another thing to consider is size of USB flash drive – my library is around 1000 TV shows and 30 or so movies and the plex metadata (install, config, background music, pictures etc) is around 450MB. If you utilise a feature called Media Indexing (this indexes your media and allows for graphical seeking) then this could easily become much much larger (20-40x). Of course you could move your Plex Library onto your data disks in the future if required.
I’ve written another post on installing and configuring ZFS with Ubuntu and the HP MicroServer.
Download the latest ISO for Ubuntu 14.04 LTS (at time of writing this is 14.04.1 @ 572MB) from the Ubuntu Server Download page. Ubuntu Server 14.04 LTS is 64 bit only. There are three methods to get going:
- Burn the ISO to a CD if you have a CD drive in your MicroServer.
- Use a tool like Universal USB Installer to create a bootable USB key. As stated above the MicroServer has an internal USB slot and supports booting from USB.
- Keep the ISO as is if you plan to build this out in a virtual machine (for testing).
1. and 3. are straightforward so I’ll just briefly cover 2. as this was the method I used on Windows 7 (as I had no CD/DVD drive on my HP MicroServer).
- Locate a USB flash drive at least 1GB in size and insert into your PC. Note the drive letter.
- Download Universal USB Installer from here.
- Run the executable and accept the UAC warning (if prompted). Click I Agree on the license agreement.
- Step 1 – Select Ubuntu Server Installer (on v220.127.116.11).
- Step 2 – Click Browse and if you’ve selected correctly you will only see the ISO you downloaded earlier as the program is looking for a particular prefix in the file name. Select your ISO.
- Step 3 – Select your USB flash drive from the drop down list. Select to Format the drive as well if required (NOTE: these operations will remove all contents). Formatting the drive here is an additional step to ensure the creation will be successful as FAT32 is one of the supported formats.
- Click Create.
- Check through actions displayed and click Yes if you’re happy.
- The tool will run and complete the extraction and set up to the USB flash drive.
NOTE: Ensure the MicroServer is plugged into your network and has a connection to the internet when using the 14.04 ISO image specified above. This is required to progress past a certain stage in the installation.
The following methods should be fairly straightforward and I won’t add further explanation:
- CD > Local hard disk
- CD > Local USB flash drive
- ISO > Virtual disk (deploying to a virtual machine)
- USB > Local hard disk
The method that’s worth an extra note is USB > Local USB flash drive. As discussed earlier, if this is possible in your system then it’s definitely worth considering as it frees up a SATA port for a hard disk (and creates a hardware boundary between your OS and your data) From experience I’ve found the following high level steps to work:
- Remove any on board USB flash drives and boot from your external USB flash drive with Ubuntu.
- Select your Language.
- Choose Install Ubuntu Server
NOTE: If this is a new system or new memory it is also worth running the Test memory option for at least 3-5 passes – this could take significant time depending on memory size.
- Once the Ubuntu select language screen is up, insert your onboard USB flash drive.
- Select your Language.
- Select your Location.
- Select whether you want to select your keyboard from a list (select No) or try and autodetect with key presses (select Yes).
- Additional components will be loaded.
- Link should be detected on eth0 including link local address (depending on whether you are connected to a network)
- DHCP will try and obtain network configuration. If this succeeds you will then be prompted with entering a hostname. To use a static IP address select Go Back and move to step 12.
- To use a static IP address (advisable) select Configure network manually.
- Enter a static IP address and select Continue.
- Enter a subnet mask and select Continue.
- Enter a gateway and select Continue.
- Enter the IP address (or multiple IP addresses separated by spaces) for your DNS servers and select Continue.
- Enter the hostname for the system and select Continue.
- If you have a local domain name enter this (e.g. foo.local, foo.com etc) and select Continue.
- If prompted to select a local Ubuntu mirror, choose the one closest to you based on country code.
- Enter the full name for your user and select Continue.
- Enter the username for your account and select Continue.
- Enter the password for your account and select Continue.
- Re-enter the password and select Continue.
- Select whether to encrypt your home directory or not. This isn’t really a necessity if it’s your media server and won’t hold personal documents etc that you might want to encrypt.
- The installation will then try and set the clock. Confirm or change your time zone as required.
- The next thing to configure is your partitioning. For this installation I’ll be selecting Guided – use entire disk and set up LVM (as I want a simple installation but with LVM behind it).
- Ensure the disk listed in the next screen is your onboard USB flash drive.
- Choose Yes to confirm you want write the changes to disk.
- You’ll now get offered what size of the disk you want to offer up to the guided partition. For this installation I’ll leave it at the default (all the available space) and select Continue.
- If prompted, confirm one last time that you’re happy with the changes being written to disk. Select Yes.
- The disk partitioning and formatting will begin. Once complete the base system will be installed (this will take 10-15 minutes on a typical USB flash drive).
- Enter proxy information if required and select Continue.
- The Select and install software will now begin. Select whether to install updates automatically or not.
- On the Software selection screen select OpenSSH server and then select Continue.
NOTE: We’ll install Samba separately later.
- The rest of the system software will now be unpacked and installed then the boot loader.
- The device for the boot loader installation may be displayed (depending on what was on your USB flash drive previously). If you have no other hard disks in your MicroServer and only your external USB flash drive and onboard USB flash drive (inserted later) then this will be /dev/sdb. Select Yes to install GRUB boot loader to the master boot record.
- When the installation is finished remove your external USB flash drive and select Continue.
Your HP MicroServer will reboot into Ubtuntu and before long you’ll see the following:
Ubuntu 14.04.1 LTS <hostname> tty1
Enter the username and password you set during the installation so you get to the shell.
It’s now time to shut down the MicroServer and put it in its final place (headless) with a network connection.
$ sudo shutdown -h now
Move the MicroServer, plug it into the network and power it up.
When it’s powered up and connected to the network we need to update Ubuntu with latest packages for 14.04.
- SSH to your server (using a tool like PuTTY)
- Update the package information and then upgrade:
$ sudo apt-get update
$ sudo apt-get upgrade
- Browse to the Plex Media Server Downloads page then select Computer then Linux.
- Right click the latest 64bit Ubuntu download link and copy it to the clipboard
- SSH to your server (using a tool like PuTTY)
- Log in with your username and password.
- Change to the /tmp directory:
$ cd /tmp
- Download the latest package (paste in the link from step 2 – example below):
$ wget http://downloads.plexapp.com/plex-media-server/0.9.9.14.531-7eef8c6/plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb
- Install two dependencies required for Plex Media Server and choose Y to confirm:
$ sudo apt-get install avahi-daemon avahi-utils
- Install Plex Media Server using Debian package manager (example file name below):
$ sudo dpkg -i plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb
- This will install Plex Media Server and also add a repo file called plexmediaserver.list in /etc/apt/soures.list.d/
NOTE: at time of writing, the Plex team are having issues with this public repo and it is out of date. Repeating steps 1 to 8 (EXCLUDING step 7) when there is a new version will also upgrade your version in future if required.
- You’ll then see the following output from the installer:
Selecting previously unselected package plexmediaserver.
(Reading database … 56008 files and directories currently installed.)
Preparing to unpack plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb …
Unpacking plexmediaserver (0.9.9.14.531-7eef8c6) …
Setting up plexmediaserver (0.9.9.14.531-7eef8c6) …
plexmediaserver start/running, process 10041
Once complete open a browser and go to http://<ipaddress>:32400/web
- You should see the license agreement. Click Agree.
- You can then start adding libraries by clicking the + (plex) sign in the top left next to your server name. This will display the following wizard:
- You can also adjust your Plex Media Server and Plex Web options by clicking the tools icon in the top right. The following screenshot displays the General options for the Plex Media Server including setting a Friendly name.
As mentioned at the start of this post it’s useful (if you use Windows) to be able to access your media files remotely. Installing and configuring Samba will allow us to do this.
NOTE: This section presumes you have your storage configured (i.e. the locations where your Plex libraries will be).
- Let’s get the packages installed first:
$ sudo apt-get install samba
- Create a new smb user to map to your Ubuntu user (you’ll use this to map your share):
$ sudo smbpasswd -a <youruser>
e.g. sudo smbpasswd -a joeb
- Ensure the password you enter is the same as your Ubuntu password. When we create a new smb.conf file we’ll ensure that the Samba password is updated whenever your Ubuntu password is updated next time.
NOTE: You can create a new Ubuntu user and then create an associated Samba user (it doesn’t have to be your existing one)
- Back up the old smb.conf file:
$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.old
- Create a new smb.conf file:
$ sudo nano /etc/samba/smb.conf
- Paste in the following configuration that configures a share called media:
NOTE: Some of the options below are default (and therefore not needed but are included for completeness and to research yourself)
[global] workgroup = WORKGROUP netbios name = PLEX server string = %h server (Samba %v, Ubuntu) map to guest = Bad User obey pam restrictions = Yes pam password change = Yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%m max log size = 1000 dns proxy = No usershare allow guests = No panic action = /usr/share/samba/panic-action %d idmap config * : backend = tdb [media] path = /data1/media comment = Plex raw media files writeable = yes valid users = joeb browsable = yes guest ok = no
- Ensure you check and/or change the following:
- netbios name – this should ideally match the host name of the server.
- path – I have put an example path here but yours will likely be different.
- valid users – Only use this user account if you’ve followed the steps above otherwise use the account you specified.
- Save this file and exit.
- Restart Samba:
$ sudo service smbd restart
- You will need to provide read/write access for your user to the path above. Following on from my example I’d do the following:
$ sudo chown joeb:joeb /data1/media
- You will now be able to connect from windows to your share (media). Using the names above it would be \\plex\media, then enter the username and password you configured.
NOTE: The key thing is that the user plex (created by the plexmediaserver application) has read access to your media files. By default everyone should have read access to a directory outside your home area.
- You can now create folders (that can become Sections in Plex) and manage files in this area.
Working with remote Windows (CIFS) shares
If you’re tying to mount a Windows share onto your server using mount with the -t cifs option but get the following error ensure you have the cifs-utils package installed as this will ensure you can specify cifs as a file system type:
mount: wrong fs type, bad option, bad superblock on //<server>/<share>,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so
If required, just install with the following command and confirm the package installation:
$ sudo apt-get install cifs-utils
This has been a fairly exhaustive post that tries to remain as generic as possible while still hopefully providing the information necessary to get up and running with Ubuntu 14.04.1, Plex and Samba. It doesn’t cover storage configuration as this could be several posts by themselves given the multiple permutations.
Please sound off in the comments for any updates/additions to this post.