SageTV 6 On CentOS 5

Jul 31 2008

 

A while back I mentioned that I was in the process of possibly switching from MythTV to SageTV.  I want to keep the main server running Linux because I feel it is a more stable environment than Windows.  Plus, due to the low OS overhead, it allows me to continue using an older PC.  The down side to all of this is it seems there are far greater Windows SageTV users than Linux SageTV users.  As a result, just about all of the available help guides are geared toward a Windows based install.  Today, I'd like to help even things up a bit and cover the steps involved in getting a SageTV server up and running in Linux using CentOS 5.

SageTV CentOS 5 Install Guide

 

Assumptions & Pre-Requisite Software

Assumptions

Let's start off by discussing what you need to have prior to reading this guide.  First, make sure you meet the minimum hardware requirements for a server only install.  SageTV's site says an Intel P3 (or equiv) CPU with 256 MB of RAM should be enough.  I would imagine that most people could find a system of this caliber laying in a ditch near your home.  In may case, I'll be using an AMD Athlon XP-M 2400+ CPU with 512 MB of RAM and about 900 GB of combined attached storage.  This has been my main MythTV server for some time now, so I would expect it to function properly as a SageTV server as well.

Second, for the purpose of this guide, I am going to use CentOS 5 as my OS.  There is nothing special about this selection other than I am familiar with it and it has a very long life cycle which means I rarely need to do a complete OS upgrade.  The other benefit is I have already gone to the bother of posting a several guides describing how to install and tweak CentOS 5.  Please read these prior to proceeding with this install.

Third, verify that you have a properly running network and a connection to the Internet.  We won't be setting up anything that requires an incoming Internet connection, so you shouldn't need to change any perimeter firewall settings.

 

Pre-Requisite Software

SageTV is a java based application, so we will need to make sure a suitable java interpreter is installed.  Check to see if you already have one installed by running this as root:

java -version

Anything 1.5.0_16 and later should work fine.  If need be, you can grab a copy from Sun's site here.  Scroll down until you see "Java Runtime Environment (JRE) 5.0 Update 16" and click the "Download" button.  Pick Linux as your platform, check the "I agree to give Sun my first born..." box, and click "Continue".  You should see two files.  Click on "jre-1_5_0_16-linux-i586-rpm.bin" as that will extract into a RPM package we can install.  Once the file has been downloaded, execute the file as root.  This will extract the RPM and install it.  The final step is to link the java executable to a folder in your path.  Do this by running the following as root:

ln -s /usr/java/jre1.5.0_16/bin/java /usr/bin/java

At this point, you should be able to run the version command above to verify everything installed properly.  There are a few more RPMs that are install requirements before we can fire up SageTV.  Fortunately, if you followed my CentOS guides, this next step will be simple since you added ATrpms as a repository.  As root, run:

smart install libmad libmp3lame0 faad2

Install SageTV Server

Install SageTV Server

Last up is to download and install SageTV server.  In my case, I decided to take a chance and go with the latest beta version since it seems the Linux flavor is always a couple steps behind the Windows version.  I don't blame them as I'm sure the Windows version is 95% of their business.  Besides, I don't mind running into a few bugs.  It gives me a chance to help their product improvement team.

So, with that out of the way, let's download the latest SageTV server beta from here.  Out of force of habit, I download my manually installed RPMs and TAR files to the "/usr/src" folder.  The next steps will create a SageTV folder and extract the contents of the TAR file.  Again, run them as the root user.

mkdir -p /opt/sagetv/server
tar -xzf server_6.4.6.tar.gz -C /opt/sagetv/server

For some reason, the Linux version of SageTV insists on having the various media folders reside under "/var/media".  This may be fine for some users, but this makes it a little more inflexible than need be.  To solve this problem, I simply created symbolic links from the various "/var/media" folders to my "/htpc" folders like this.  Please modify the commands to suit your server environment.

ln -s /htpc/audio /var/media/music
ln -s /htpc/pics /var/media/pictures
ln -s /htpc/video /var/media/videos
ln -s /htpc/tv /var/media/tv

Next, we need to enter our SageTV license key by running:

/opt/sagetv/server/keygen.sh

The last step is to create a SageTV server startup/shutdown script so everything runs properly when the system is powered on.  SageTV server comes with individual start and stop scripts called "startsage" and "stopsage" respectively.  While these scripts work great for manual service control, I prefer things to work automatically.  To that end, I crafted an automated script which goes in the "/etc/init.d" folder.  There isn't anything special about it as it just calls the original two scripts, but it does make things feel a bit more polished.  Impliment the script by doing the following as root.

cd /etc/init.d
wget http://www.missingremote.com/images/stories/sagetv_centos5/sagetv
chmod 700 sagetv
chkconfig --add sagetv
setup

Scroll down until you highlight "System Services" and press <TAB> and then <ENTER> to select "Run Tool".  Scroll down to the "sagetv" service and ensure there is a "*" in the box next to it by pressing <SPACE>.   Press <TAB> and <ENTER> to select the "Ok" button  which will return you to the prior screen.  Choose "Quit" to exit.  Finally, launch the SageTV server by running this as root.

/etc/init.d/sagetv start

If everything started OK, you should be able to see a "java" process by running:

ps -A | grep java

Install SageTV Client

Install SageTV Client

At this point, we've done the majority of the "hard part", so we might as well install the SageTV Linux client.  I won't go into detail regarding configuring the SageTV client, but we will at least get it installed and running.  First, download the software from here.  Next, we will create the client folder and extract the TAR file by doing this as root:

mkdir -p /opt/sagetv/client
tar -xzf miniclient_6.4.6.tar.gz -C /opt/sagetv/client

Starting the client is as simple as running this while in an X Windows environment:

/opt/sagetv/client/sageclient.sh

The only time I use this is when I want to make SageTV server configuration changes while sitting at the server.  This comes in handy during initial start up.  You will notice that the SageTV client in Linux is in reality a Placeshifter client.  Select the local IP and click "Connect" to start the Placeshifter session.

SageTV Linux Client Login
SageTV Linux Client Login

 

Conclusion

At this point we've installed all the pre-requisite software, installed the SageTV server component as well as it's auto-start script, and we've got a Linux based SageTV client going.  Next, one would have to configure your tuners and channel line ups.  After that, the sky is the limit.  You can break out some Windows based clients, some off-site Placeshifter clients (this will require firewall adjustments), or even go the HD Extender route.  The choice is yours.  I will be exploring both the Windows client and HD Extender options here soon, so check back for future guides!  As always, please comment in the forums by following the link below.