Installing Mysql server on a ReadyNAS duo
By Stephane Carrez on Sunday, March 22 2009, 21:16 - Linux - Permalink
Being able to connect to my ReadyNAS duo using SSH (See Connecting to a ReadyNAS duo using SSH ), the next step for setting up a Bacula backup solution was to setup a MySQL server. The Mysql server is used by Bacula for the backup catalog (jobs, files ...).
Installing the APT extension
The ReadyNAS duo runs a Debian Sarge distribution. The apt-get commands are not available and we must install the APT addon:
- Download the APT extension. I've used the following link:
http://www.readynas.com/download/addons/4.00/APT_1.0.bin
- Go in the ReadyNAS FrontView with your browser and go to System -> Update -> Local Update
- Upload the APT binary file. The ReadyNAS verifies that content and if it is correct it displays a description of the addon.
- Acknowledge the installation of the addon
After installation, the ReadyNAS must be restarted. Shortly after, you will receive an email:
Subject: Addon Package Progress (nas-XX-XX-XX) Successfully installed APT.
Debian Sarge Package update
It may be good to check the debian packages. Connect to the ReadyNAS using ssh and run the following commands:
apt-get update
Installation of Mysql server
The mysql-server-5.0 is supposed to be installed according to dpkg -i command. However, the files are not there and they
have probably be removed. This is also the case for some utilities which are used by some installation scripts.
Preparation
The /usr/bin/chfn utility is missing and we need it for Mysql installation. We must re-install the passwd package. Download it and install it as follows;
# dpkg -i passwd_4.0.3-31sarge9_sparc.deb
The /usr/bin/logger is also missing. We must re-install the
bsdutils_2.12p-4sarge2_sparc.deb
package. Download it and install it as follows:
# dpkg -i bsdutils_2.12p-4sarge2_sparc.deb
Edit the /etc/mysql/my.cnf file and change the line:
user = admin
into
user = mysql
Additional packages
As reported by RoB (see comments), the following packages are also necessary for mysql-server:
# apt-get install libreadline5 libdbi-perl
Get Mysql packages
The mysql packages are part of backports.org (backport from Etch). You should download the following:
- libmysqlclient15off_5.0.32-7etch5~bpo31+1_sparc.deb
- mysql-common_5.0.32-7etch5~bpo31+1_all.deb
- mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb
- mysql-client-5.0_5.0.32-7etch5~bpo31+1_sparc.deb
- mysql-client_5.0.32-7etch5~bpo31+1_all.deb
Mysql installation
Install the Mysql server debian packages:
# dpkg -i libmysqlclient15off_5.0.32-7etch5~bpo31+1_sparc.deb \ mysql-common_5.0.32-7etch5~bpo31+1_all.deb \ mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb \ mysql-client-5.0_5.0.32-7etch5~bpo31+1_sparc.deb \ mysql-client_5.0.32-7etch5~bpo31+1_all.deb
Installation Problem and Solution
If in the installation process you see a message '/etc/init.d/mysql' not found, force the extraction of mysql-server files without the execution of the installation script:
# dpkg --extract mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb /
After that, redo the dpkg -i command.
If you see some errors in the logs:
[ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
Fix ownership of some existing directories:
# chown mysql /var/lib/mysql # chown mysql /var/lib/mysql/mysql
and restart mysql
Fix /etc/mysql/debian.cnf
After installation, the debian.cnf file used by mysqlcheck uses a user that does not exist. You can either create the
debian-sys-maint user in mysql or change it to 'root' by editing the file /etc/mysql/debian.cnf and
change user and password to use 'root'.
Fix startup scripts
Remove the following two startup scripts, they are not necessary for us:
- rm /etc/rc2.d/S18mysql-ndb
- rm /etc/rc2.d/S17mysql-ndb-mgm
Testing the database
Verify that the Mysql database is running:
nas-D2-24-F2:/var/log# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.0.32-Debian_7etch5~bpo31+1 Debian etch distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Comments
Hi there thank you so much for making this information available, however for beginners this is a huge task to undertake. Would you or anyone in the community be able to fill in the blanks where beginners might run into a brick wall. For me, as soon as we got to the “Installation of Mysql server" section, I was unable to install the needed files. HELP =0)
Verify that your ReadyNAS is running an Infrant Technologics CPU.
There are some ReadyNAS that run Intel-based CPUs and this article is not for them.
Connect to your ReadyNAS duo and check the /proc/cpuinfo file for that:
If you see that, you can proceed.
I'll need more details such as error messages to help you.
First off, thank you for responding so quickly! I checked the “/proc/cpuinfo” file and verified that I do have the correct CPU version.
I am very new to working with SSH and setting up MySQL. I did quite a bit of researching to get myself to understand each of the steps. After I posted yesterday, I was able to get to the “Mysql installation” step. However I got the following messages when installing this files mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb, mysql-client-5.0_5.0.32-7etch5~bpo31+1_sparc.deb, and mysql-client_5.0.32-7etch5~bpo31+1_all.deb.
--------Error Messages-------
pkg: dependency problems prevent configuration of mysql-server-5.0:
mysql-server-5.0 depends on mysql-client-5.0 (>= 5.0.32-7etch5~bpo31+1); however:
Package mysql-client-5.0 is not configured yet.
mysql-server-5.0 depends on libdbi-perl; however:
Package libdbi-perl is not installed.
mysql-server-5.0 depends on libreadline5; however:
Package libreadline5 is not installed.
dpkg: error processing mysql-server-5.0 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.0
-----end------
Also, I believe it is important to explain why I would like to install mySQL on the Readynas in the first place. I am setting it up to work with a Radio Station Automation Software that catalogs music in a database. The music files are easily stored and played off the ReadyNAS. However, a database is needed to store the artist, title, and a great deal of other information.
All-in-all, the station is very small but it has a few thousand of individual music titles that it will need to catalog and referred to, as well as the programming schedule.
Is this too much to for the Readynas to handle? Also once MySQL is installed, where is the software stored?
Thanks for your help!
Ok, I checked my installation and your error and I see that I have the libreadline5, libdbi-perl and libdbd-mysql-perl package installed.
I added one step in the article for that. Just do:
before the mysql installation step. As far as performance is concerned, don't expect to have a fast database. I'm using MySQL together with Bacula for managing backups. The database stores the file list of the backups. It can handle big databases but you have to use the InnoDB storage engine. The MyISAM seems to have issues. My bacula database contains 20 tables two of which are big, see below:For the installation of your additional software, it really depends on whether it has been ported to the Debian Sparc or not. If it's a php application, you could install it on the ReadyNAS provided that you manage to install php first.
Again thanks for making this available. Works for me - one step missing though: in the "Additional Packages" section add also:
# apt-get install libmysqlclient12 libdbd-mysql-perl
Took me an extra couple of minutes to realise that I needed these both on the same line. Then I had the missing init.d/mysql issue (thanks for the --extract line!)
Installation wasn't too painful with this step-by-step with all those links. Thanks again.
After following this post I now get the following when starting mysql 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!, please tell me how this can be resolved,
Gary
If you can't connect may be mysql didn't started correctly. It happens if there is a configuration error or if some component or library is missing.
I recommend you check mysql logs after it is started, you'll get information about the problem.
Is there a way to remove the installation of MySQL ?