Chapter 5. Setting up the Library Mode

In this chapter, we will look at the following:

  • Setting up the Library mode that will store information about our content
  • Sharing this across multiple machines with a MySQL database
  • Setting up Raspbmc to use this database

Note

If you are planning to use a MySQL database to share the library across multiple devices, you should read the section on installing and configuring a MySQL database first.

Installing MySQL

It's best to install MySQL on the same system we'll be serving files from. This makes sense as we'll need both the file server and the database server to be online to play content, so we may as well confine these services to one system.

Installing on Linux

The MySQL package can be fetched via your distribution's default repositories, as follows:

  1. First, we need to fetch the packages using our distribution's package manager as follows:
    • On Debian/Linux Mint or Ubuntu systems, we can do this with the following command:
      sudo apt-get install mysql-server
      
    • On Redhat, CentOS, and Fedora systems, we can do this with the following command:
      sudo yum install mysql-server
      
  2. Now, we need to allow remote access to the MySQL database service. We can do that with the following command:
    sed -i /etc/mysql/my.cnf -e 's/bind-address/#bind-address/'
    
  3. We now need to restart the MySQL service, which can be done with the following command:
    sudo service mysql restart
    

Installing on Mac OS X

The MySQL package must be obtained from the MySQL website in OS X. The following steps will help you install MySQL on Mac OS X:

  1. Head on over to http://dev.mysql.com/downloads/mysql/ and select Mac OS X. Download the latest version of MySQL in the DMG format.
  2. Open the DMG folder and run the mysql-5.*.*.pkg file. This will launch the MySQL installer.
  3. Perform a standard installation of the MySQL package.
  4. We will want our MySQL server to launch on startup. Go back to the contents of the DMG folder and run MySQLStartupItem.pkg.
  5. Perform a standard installation of the MySQLStartupItem package.
  6. Return to the contents of the DMG folder again and launch MySQL.prefPane. You will be prompted to install a preferences pane for MySQL. Install this for all users of the computer.
  7. Open MySQL preferences. Start the MySQL server and check the checkbox entitled Automatically start MySQL Server on startup.
  8. Open Terminal and enter touch .bashrc. Using your favorite text editor, add the following command to this file:
    export set MYSQL_HOME=/usr/local/mysql-5.5.18-osx10.6-x86_64
    export set PATH=$PATH:$MYSQL_HOME/bin

    Note

    You should substitute the version number in the preceding example for the actual version you have installed. You can verify this with the following command:

    ls /usr/local| grep mysql
    
  9. Lastly, we need to allow remote access with the following command:
    sed -i /etc/mysql/my.cnf -e 's/bind-address/#bind-address/'
    

    You should log off and log in again so that the new MySQL variables defined in .bashrc are exported.

Installing on Windows

The MySQL package for Windows can be fetched from the MySQL website. The following steps will help you install MySQL on Windows:

  1. Grab the MSI installer of MySQL server of the appropriate architecture (32 or 64 bit) from http://dev.mysql.com/downloads/mysql/.
  2. Run the installer and perform a standard installation.
  3. Click on Next, accept the license agreement, and click on Next again.
  4. Choose a Typical installation and click on Install.
  5. When the installation is complete, ensure that Launch the MySQL Instance Configuration Wizard is checked and click on Finish.
  6. Choose the Detailed Configuration option and click on Next.
  7. Select Developer Machine and click on Next.
  8. Select Multifunctional Database and click on Next.
  9. You may wish to choose where to install the database datafiles, however the default location should be acceptable. Click on Next when done.
  10. Select Manual Setting, specify a maximum of 10 connections, and click on Next.
  11. Ensure that Enable TCP/IP Networking is checked, and check Add firewall exception for this port. Click on Next.
  12. Select Best support for multilingualism and click on Next.
  13. Leave the Install as Windows Service settings as the default, check Include Bin Directory in Windows Path, and click on Next.
  14. Enter a password for the root user and remember to make a note of it. Enable the Enable root access from remote machines option.
  15. Click on Execute, and the configuration will be deployed and the MySQL service started.
  16. You may need to configure third-party firewalls to allow external access to the database (MySQL, by default, runs on TCP/UDP3306).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.83.50