mysticpete
Contributor
- Joined
- Nov 2, 2013
- Messages
- 148
Create a Media Server hosting FreeNAS, Mythtv, PlexMediaServer, Transmission, Couchpotato and Sickbeard
Most recent details for this build can be found Here
I'm creating a media server and have been developing a solution for sometime, below you will find instructions for installing and configuring a very powerful media machine. These are the steps I have taken to accomplish the task, however they may not all work for you, take care to look for any errors at the end of each install, especially Mythtv looking for Lame.
I must first point out that much of the leg work has been done by others and where possible I have acknowledged them.
I thoroughly recommend starting with a fresh OS load, if you already have storage you can easily add it back in after by importing it, save your configuration before starting this.
Base Hardware:
I'm using an HP N54L server running 6GB of memory, 5 x internal 2TB WD RED hard disks for storage
TV will be supplied by a HD Homerun dual TV tuner, the benefit of this is it's flexibility in transmission out the box to many devices.
The FreeNAS OS and jails are installed on a 64GB mini SSD mounted on the PCI x1 slot
I do not intend to cover the process of installing the FreeNAS OS as this is readily available on the FreeNAS sites.
First Steps
A word about pkg-ng commands
This command set is a replacement for pkg_add as this is being phased out over the coming months (On my version of FreeBSD9-2-0 I was able to install it from the ports directory).
The command when used will download from its current ftp version i.e. entering # pkg install mythtv may look in the 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/' listing
So if you have a different version of FreeNAS installed, I would suggest installing the packages from that version (if they are available) i.e. if you have, like me FreeNAS 9.2.1 then you want files from the ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.2-release.
You receive the error "pkg: No packages matching '<Package-name>' available in the repositories"
This is because the package listing that pkg install is looking in does not contain the Package being requested, so you will need to install it from another version, you can check this by looking in the packages listing from a web browser i.e. ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/
If it's not listed in it's respective application directory then go up 2 levels and pick another version and look in the folder for that version...
Index of ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/
Up to higher level directory
Name Size Last Modified
packages 19/04/2007 12:00:00 AM
packages-8-stable 11/02/2014 10:02:00 PM
packages-8.3-release 28/03/2012 12:00:00 AM
packages-8.4-release 9/05/2013 12:00:00 AM
packages-9-current 9/12/2011 12:00:00 AM
packages-9-stable 11/02/2014 10:32:00 PM
packages-9.1-release 11/04/2013 12:00:00 AM
packages-9.2-release 3/09/2013 12:00:00 AM
packages-stable 7/11/2011 12:00:00 AM
So to pick up the version you need to install type the full path at the command prompt using pkg add command:
e.g. pkg add ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/multimedia/mythtv-0.26.0.tbz
Now let's get started....
To install the following plugins I recommend you use Zufallsheld's very comprehensive installation guide http://zufallsheld.de/2013/11/22/freenas-transmission-couchpotato-sickbeard-dlna-server/ for these.....
Plexmediaserver
Couchpotato
Transmission
Sickbeard
There are a couple of things I found when I followed this and I still have to fix some of the folder ownership issues. On the whole this is very well documented installation, and it all works.
Setup the Mythtv Jail
My research into previous setups did not reveal any examples getting this working on a FreeNAS server, only others asking the same questions. I came across a couple of other guys trying to get this going and so I pitched in to collaborate (the more hands the better) and this can be found on John Payne's blog http://blog.heiren.us/2013/11/mythtv-server-on-freenas.html?showComment=1386694184546 from which the next sections have been tidied up and I have added the extra requirements to.
Firstly create a mythtv jail in FreeNAS (standard plugin jail)
login to the jail
Run the following commands in sequence....
root@mythtest:/ # portsnap fetch extract
Install the additional packages for Mythtv
root@mythtest:/ # cd /usr/ports/audio/lame && make install clean
root@mythtest:/ # pkg install libXv (libXv has a CAPITAL 'X')
root@mythtest:/ # pkg install qt4-webkit
root@mythtest:/ # pkg install xauth
root@mythtest:/ # pkg install xorg-fonts
Install Mythtv
Currently there have been a number of issues reported with Myth versions above 9.2.0 and I would suggest at this time to Only use this version until the next stable version is advised.
root@mythtest:/ # pkg install mythtv
Add the following to /etc/rc.conf
root@mythtest:/ # echo 'mythbackend_enable="YES"' >> /etc/rc.conf
root@mythtest:/ # echo 'sshd_enable="YES"' >> /etc/rc.conf
root@mythtest:/ # echo 'mysql_enable="YES"' >> /etc/rc.conf
Install SQL server
root@mythtest:/ # pkg install mysql55-server
mysql will automatically create the user 'mysql' and group 'mysql' with UID (88) (no_password)
Start mysql
root@mythtest:/ # service mysql-server start
Add the following for the database setup
root@mythtest:/ # mysql < /usr/local/share/mythtv/database/mc.sql
root@mythtest:/ # mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
If the above fails try this......
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p mysql --force 2> /dev/null
After this, login to mysql and check the timezone:
root@mythtest:/ # mysql -p
Enter password:<no_password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3Server version: 5.5.33 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates
Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT @@global.time_zone, @@session.time_zone;
+--------------------------+---------------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------------+---------------------------+
| SYSTEM | SYSTEM |
+--------------------------+---------------------------+
1 row in set (0.00 sec)
This shows that mysql is using the system for it's timezone, there are other options but I am not going to go into these here.
Type exit to leave mysql
Now check the mythtv database entry
root@mythtest:/ # mysql -u root -p'<password>' -e 'show databases;'
Change the mysql password
root@mythtest:/ # mysqladmin -u root password <NEWPASSWORD>
Test the new password with # mysql -p
Setup X11 Forwarding
root@mythtest:/ # echo 'ListenAddress <youripaddress>' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'X11UseLocalhost no' >> /etc/ssh/sshd_config
Restart sshd
root@mythtest:/ # service sshd restart
root@mythtest:/ # ssh -Y root@<mythtv jail ip> /usr/local/bin/mythtv-setup
Setup Remote X11 access from your PC/Laptop
Download Xming from here: http://sourceforge.net/projects/xming/
Download PuTTY from here: http://www.putty.org/
1) Install Xming server and start it on your local machine
2) Install PuTTY on your local machine
3) Configure the default profile in PuTTY with the IP and SSH port of your myth Server
4) Go to the Connection panel then select ssh and enable compression, then the x11 tab and check "Enable x11 Forwarding" box, then enter localhost:0 in the "X Display Location" and check "MIT-Magic-Cookie-"
5) Go to "Session" and hit the save button
With the Xming server started, open the PuTTY session you saved and login (with the user you created earlier) to the myth server, then type....
root@mythtest:/ # mythtv-setup
this will open an Xwindow on your local screen and load the myth setup screen.
If you get a message saying X11 server not found then you did something wrong.
Summary
By now we should have all our apps running and be able to forward ssh to our laptop or desktop to setup the mythtv.
Just a note here that I am not installing myth-web and so will not be covering that here for now.
Added users to Mysql to allow remote access to Mythtv
I am using XNMC Mythbox to access my Mythtv backend, you may use other apps, the most important thing to remember here is that nothing will be able to access the database until you allow remote access in mysql. At installation mysql server blocks connections from IP's other than the loopback 127.0.0.1. To add your access you will need to create a user and host, give it grants to the database and ensure the frontend can access the back.
To add a the user:
root@mythtest:/ # mysql -u root -p
Enter password <password>
mysql> CREATE USER 'mythtv'@'host' IDENTIFIED BY 'password';
set the privileges on the mythtv database
GRANT ALL PRIVILEGES ON mythconverg. * TO 'user'@'host';
exit from mysql.
To test access to the db, first we will try from a localhost
root@mythtest:/ # mysql -u <user> -p<password> -h localhost
root@mythtest:/ # mysql -u mythtv -pmythtv -h localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 135
Server version: 5.5.36 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>exit;
and now echoing the remote user
root@mythtest:/ # mysql -u <user> -p <password> -h <mythtvipaddress>
root@mythtest:/ # mysql -u mythtv -p -h 192.168.1.xx
Enter password: <password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 137
Server version: 5.5.36 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>exit;
If you are able to access mysql in this way then it should work the same from the remote machine.
Most recent details for this build can be found Here
I'm creating a media server and have been developing a solution for sometime, below you will find instructions for installing and configuring a very powerful media machine. These are the steps I have taken to accomplish the task, however they may not all work for you, take care to look for any errors at the end of each install, especially Mythtv looking for Lame.
I must first point out that much of the leg work has been done by others and where possible I have acknowledged them.
I thoroughly recommend starting with a fresh OS load, if you already have storage you can easily add it back in after by importing it, save your configuration before starting this.
Base Hardware:
I'm using an HP N54L server running 6GB of memory, 5 x internal 2TB WD RED hard disks for storage
TV will be supplied by a HD Homerun dual TV tuner, the benefit of this is it's flexibility in transmission out the box to many devices.
The FreeNAS OS and jails are installed on a 64GB mini SSD mounted on the PCI x1 slot
I do not intend to cover the process of installing the FreeNAS OS as this is readily available on the FreeNAS sites.
First Steps
A word about pkg-ng commands
This command set is a replacement for pkg_add as this is being phased out over the coming months (On my version of FreeBSD9-2-0 I was able to install it from the ports directory).
The command when used will download from its current ftp version i.e. entering # pkg install mythtv may look in the 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/' listing
So if you have a different version of FreeNAS installed, I would suggest installing the packages from that version (if they are available) i.e. if you have, like me FreeNAS 9.2.1 then you want files from the ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.2-release.
You receive the error "pkg: No packages matching '<Package-name>' available in the repositories"
This is because the package listing that pkg install is looking in does not contain the Package being requested, so you will need to install it from another version, you can check this by looking in the packages listing from a web browser i.e. ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/Latest/
If it's not listed in it's respective application directory then go up 2 levels and pick another version and look in the folder for that version...
Index of ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/
Up to higher level directory
Name Size Last Modified
packages 19/04/2007 12:00:00 AM
packages-8-stable 11/02/2014 10:02:00 PM
packages-8.3-release 28/03/2012 12:00:00 AM
packages-8.4-release 9/05/2013 12:00:00 AM
packages-9-current 9/12/2011 12:00:00 AM
packages-9-stable 11/02/2014 10:32:00 PM
packages-9.1-release 11/04/2013 12:00:00 AM
packages-9.2-release 3/09/2013 12:00:00 AM
packages-stable 7/11/2011 12:00:00 AM
So to pick up the version you need to install type the full path at the command prompt using pkg add command:
e.g. pkg add ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.1-release/multimedia/mythtv-0.26.0.tbz
Now let's get started....
To install the following plugins I recommend you use Zufallsheld's very comprehensive installation guide http://zufallsheld.de/2013/11/22/freenas-transmission-couchpotato-sickbeard-dlna-server/ for these.....
Plexmediaserver
Couchpotato
Transmission
Sickbeard
There are a couple of things I found when I followed this and I still have to fix some of the folder ownership issues. On the whole this is very well documented installation, and it all works.
Setup the Mythtv Jail
My research into previous setups did not reveal any examples getting this working on a FreeNAS server, only others asking the same questions. I came across a couple of other guys trying to get this going and so I pitched in to collaborate (the more hands the better) and this can be found on John Payne's blog http://blog.heiren.us/2013/11/mythtv-server-on-freenas.html?showComment=1386694184546 from which the next sections have been tidied up and I have added the extra requirements to.
Firstly create a mythtv jail in FreeNAS (standard plugin jail)
login to the jail
Run the following commands in sequence....
root@mythtest:/ # portsnap fetch extract
Install the additional packages for Mythtv
root@mythtest:/ # cd /usr/ports/audio/lame && make install clean
root@mythtest:/ # pkg install libXv (libXv has a CAPITAL 'X')
root@mythtest:/ # pkg install qt4-webkit
root@mythtest:/ # pkg install xauth
root@mythtest:/ # pkg install xorg-fonts
Install Mythtv
Currently there have been a number of issues reported with Myth versions above 9.2.0 and I would suggest at this time to Only use this version until the next stable version is advised.
root@mythtest:/ # pkg install mythtv
Add the following to /etc/rc.conf
root@mythtest:/ # echo 'mythbackend_enable="YES"' >> /etc/rc.conf
root@mythtest:/ # echo 'sshd_enable="YES"' >> /etc/rc.conf
root@mythtest:/ # echo 'mysql_enable="YES"' >> /etc/rc.conf
Install SQL server
root@mythtest:/ # pkg install mysql55-server
mysql will automatically create the user 'mysql' and group 'mysql' with UID (88) (no_password)
Start mysql
root@mythtest:/ # service mysql-server start
Add the following for the database setup
root@mythtest:/ # mysql < /usr/local/share/mythtv/database/mc.sql
root@mythtest:/ # mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
If the above fails try this......
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -p mysql --force 2> /dev/null
After this, login to mysql and check the timezone:
root@mythtest:/ # mysql -p
Enter password:<no_password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3Server version: 5.5.33 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates
Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT @@global.time_zone, @@session.time_zone;
+--------------------------+---------------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------------+---------------------------+
| SYSTEM | SYSTEM |
+--------------------------+---------------------------+
1 row in set (0.00 sec)
This shows that mysql is using the system for it's timezone, there are other options but I am not going to go into these here.
Type exit to leave mysql
Now check the mythtv database entry
root@mythtest:/ # mysql -u root -p'<password>' -e 'show databases;'
Change the mysql password
root@mythtest:/ # mysqladmin -u root password <NEWPASSWORD>
Test the new password with # mysql -p
Setup X11 Forwarding
root@mythtest:/ # echo 'ListenAddress <youripaddress>' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'X11Forwarding yes' >> /etc/ssh/sshd_config
root@mythtest:/ # echo 'X11UseLocalhost no' >> /etc/ssh/sshd_config
Restart sshd
root@mythtest:/ # service sshd restart
root@mythtest:/ # ssh -Y root@<mythtv jail ip> /usr/local/bin/mythtv-setup
Setup Remote X11 access from your PC/Laptop
Download Xming from here: http://sourceforge.net/projects/xming/
Download PuTTY from here: http://www.putty.org/
1) Install Xming server and start it on your local machine
2) Install PuTTY on your local machine
3) Configure the default profile in PuTTY with the IP and SSH port of your myth Server
4) Go to the Connection panel then select ssh and enable compression, then the x11 tab and check "Enable x11 Forwarding" box, then enter localhost:0 in the "X Display Location" and check "MIT-Magic-Cookie-"
5) Go to "Session" and hit the save button
With the Xming server started, open the PuTTY session you saved and login (with the user you created earlier) to the myth server, then type....
root@mythtest:/ # mythtv-setup
this will open an Xwindow on your local screen and load the myth setup screen.
If you get a message saying X11 server not found then you did something wrong.
Summary
By now we should have all our apps running and be able to forward ssh to our laptop or desktop to setup the mythtv.
Just a note here that I am not installing myth-web and so will not be covering that here for now.
Added users to Mysql to allow remote access to Mythtv
I am using XNMC Mythbox to access my Mythtv backend, you may use other apps, the most important thing to remember here is that nothing will be able to access the database until you allow remote access in mysql. At installation mysql server blocks connections from IP's other than the loopback 127.0.0.1. To add your access you will need to create a user and host, give it grants to the database and ensure the frontend can access the back.
To add a the user:
root@mythtest:/ # mysql -u root -p
Enter password <password>
mysql> CREATE USER 'mythtv'@'host' IDENTIFIED BY 'password';
set the privileges on the mythtv database
GRANT ALL PRIVILEGES ON mythconverg. * TO 'user'@'host';
exit from mysql.
To test access to the db, first we will try from a localhost
root@mythtest:/ # mysql -u <user> -p<password> -h localhost
root@mythtest:/ # mysql -u mythtv -pmythtv -h localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 135
Server version: 5.5.36 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>exit;
and now echoing the remote user
root@mythtest:/ # mysql -u <user> -p <password> -h <mythtvipaddress>
root@mythtest:/ # mysql -u mythtv -p -h 192.168.1.xx
Enter password: <password>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 137
Server version: 5.5.36 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>exit;
If you are able to access mysql in this way then it should work the same from the remote machine.
Last edited: