Why? Because my server currently runs freeNAS 7.2 which uses sqlite rather than mySQL. I have not been able to get a solid mySQL server running in freeNAS 7.2, and I want one. Rather than installing to one of my windows/linux terminals, I wanted to utilize a low power always on device... thus the Raspberry Pi mySQL server.
For those of you who are unaware here are some of the things that a mySQL database can do for XBMC:
- Resume playback on any device.
- Sync scraper data to a server, eliminating the need for library database rebuilds.
- Greater uniformity.
As most of you are aware, Raspbian is the main debian distribution developed for the Raspberry Pi. Because it is well developed and can be installed without having to compile it manually like arch linux, this made it ideal to start from.
If I were going to dedicate more time to this project I would go with something lighter than Raspbian. As far as I can tell, there is no headless image. We don't really need access to any sort of GUI. The Pi will be plugged into the ethernet and left in your server area. The mySQL console is accessed via SSH and command line.
Installing the Raspbian image to your SD card from Linux.
[windows/OSX users click here] - I can write these instructions up, but I feel like most of you who are playing with a Pi must already be using linux machines. My blog stats show that almost all of you readers are win/mac guys... I strongly suggest checking out my guide to installing linux for beginners!
Download the Raspbian image here and save to your home directory.
Open your terminal and get ready for a few simple commands:
unzip the image (note:the file name listed below may not match yours exactly. Just insert the correct date for your download!)
Check the mounted file systems.
Insert your SD card and check again to verify the device label.
You should now know the label for your device: mine was "sdb"
Unmount any partitions on the device.
Write the image to the SD card. (note: remember to use the correct file name for your download. Double Check your device label!!!)
sudo dd bs=1M if=/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/sdb
NOW WAIT! This will take a while and no indication will be given for activity!
Errors at this command:
- The if= command should point to the unzipped img file. If you are getting an error here it is probably because you are not using the correct directory. Is your img extracted to "/home/user/debian6-19-04-2012/debian6-19-04-2012.img"? If your image was extracted elsewhere then please use that directory with the if= argument.
- Note: that because we extracted to the home folder initially, we do not need to type in /home/user/... because the terminal opens to that directory automatically.
If you experienced no errors, the terminal should be ready to accept a new command.
This will make sure that the write cache is completely flushed and that you will not lose any data when removing the SD card.
You should now be able to insert this SD card into a raspberry pi and apply power. The device will boot into Raspbian CLI and will start automatically into the first boot configuration script. You must be connected to a monitor at this point to complete the installation.
The most important option for me was removing the "Start X Server" from first the start after boot list. There is an easy option in the config script to disable Start X after boot. Disabling this will stop the GUI from running. This frees up more resources for your server functions.
You can set up the rest of the options as you like.
The script can always be rerun by typing
Once everything is set the way you like, you can reboot to see if the device behaves the way you like!
Next step is installing mySQL to the Pi.