Ubuntu Server Setup (Media Server and SVN)

Once the OS was installed and the hard drives were setup and sharing correctly across the network, it was just a case of installing the remaining bits of software I needed.

Media Server

I have tried a few different media servers and always find myself coming back to the same one – Plex.

It works smoothly, has a nice UI, is well supported and can be accessed from all of my devices via apps or a browser… perfect.

To install Plex you need to first install Avahi. This is needed to advertise the necessary services (similar to Apple’s Bonjour), and is installed using:

sudo apt-get install avahi-daemon

In order to install Plex properly you need to add a record to the apt-get sources file. Open it up like so:

sudo nano /etc/apt/sources.list

and add the following line to the end of the file (a relevant comment is also a good idea):

deb http://www.plexapp.com/repo lucid main

With that done run the usual

sudo apt-get update

and then install Plex using

sudo apt-get install plexmediaserver

It is easiest to access the media server through a browser so hit this URL, add your files to the libraries and you are good to go.

http://server-ip:32400/manage/index.html

It can take a little while for Plex to add/organize your media (especially if you have a lot of it) but you can still play with the settings while it does this in the background.

Subversion

I know there are many fights between Git and Subversion fan boys when it comes to the right version control system, but I was brought up using SVN so that is the one I prefer. I do use Git where required, it has it’s place, but just not for my everyday coding.

Installing the SVN packages was simple via apt-get:

sudo apt-get install subversion subversion-tools libapache2-svn

This will install the SVN base package as well as some additional tools and Apache modules. That should give you all you need to get Subversion it up and running.

Create Repositories

I already have a current SVN directory in place but if you do not then add it like so (with whatever path you require):

sudo mkdir /home/svn

For each new SVN repository – add a project folder:

sudo mkdir /home/svn/test_project

create the new repo:

sudo svnadmin create /home/svn/test_project

add the initial directory structure:

sudo mkdir trunk tags branches

and import the above folders:

sudo svn import /home/svn/test_project/trunk file:///home/svn/test_project/trunk    

sudo svn import /home/svn/test_project/tags file:///home/svn/test_project/tags    

sudo svn import /home/svn/test_project/branches file:///home/svn/test_project/branches

Set Permissions

In order to access your SVN repositories you must update the permissions on /home/svn so that they are owned by the same user:group as Apache, allowing it access, like so:

sudo chown -R www-data:www-data /home/svn

Configure Apache

The first thing you need to do when configuring Apache for SVN is enable the ‘dav_svn’ module if it isn’t already, do so like this:

sudo a2enmod dav_svn

With that done we need to open up the Apache config file:

sudo nano /etc/apache2/apache2.conf

and add the following to the bottom:

<Location /svn>
    DAV svn
    SVNParentPath /home/svn
    <LimitExcept GET PROPFIND OPTIONS REPORT>
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/svn-auth
        Require valid-user
    </LimitExcept>
</Location>

This tells Apache what the SVN path is and also enables some basic authentication. In order to complete the process we just need to create a file containing the authentication data. Enter the command:

sudo htpasswd -m -c /etc/svn-auth username

and input your required password twice. If you want to add a new SVN user to /etc/svn-auth just omit the -c like so:

sudo htpasswd -m /etc/svn-auth username

this will edit the current file instead of creating a new one. Now just restart Apache with:

sudo service apache2 restart

and that’s it, you are good to go!

I hope these posts helped someone who was stuck in the same situation as me. Either way I am pretty sure I will need this info at some point in the future!

Take it easy…

Ubuntu Server Setup (Overview)
Ubuntu Server Setup (OS Install)
Ubuntu Server Setup (NAS Migration and Samba)

2 responses to “Ubuntu Server Setup (Media Server and SVN)”

  1. Hayden says:

    Hey dude!
    I am new to linux, but am loving it so far.
    I’ve set up my old HP PC to run Ubuntu Server and Plex. I have it all set up, got the files to import into Plex Media Manager or whatever via my Windows PC but none of the metadata downloads for the movies/tv shows :( Have you any idea? I have been racking my brain and trying heaps.
    I also noticed that when I downloaded the Plex App through Linux it was insanely slow, do you think that could have something to do with it?
    Cheers,

    Hayden!

    • Mike Parsons says:

      Hey man,

      Hmmm, I had no issues when downloading the package or metadata when I first installed Plex – their servers seem pretty solid.

      I use the web interface instead of the Windows software (as I think the application leaves a lot to be desired!) and there is an option in the settings to choose where the meta data is grabbed from. The defaults worked fine for me but maybe you might need to change it up a bit? I suspect you have already tried this but if not give it a shot.

      Other than that all I can think of is the handy “activity” monitor in the web interface (in the top navigation bar) that shows you what the system has been doing in the background – does this have any information on failed meta data look ups? It is worth noting that it took a long time (a few hours at least) to get the meta data and I only have a few films and few hundred TV episodes so it may be that their servers were overloaded at the time.

      If your server was struggling to get the Plex package in the first place as well as failing meta data look-ups it may be a bandwidth issue. So either your connection is slow, timing out or is causing download errors which would definitely explain your issues – although I imagine you would have noticed this already with your other internet related activities!

      I hope some of this helps – sorry I could not give you any more direct answers to your questions. Let me know how you get on.

      Kind regards,

      Mike