« MythTV moving to QT4 - many more possibilities now available | Zabbix + ssh tunnel with AutoSSH » |
I have several Gentoo Linux machines set up for various purposes - and I've decided to get them all up to speed for programming / version control / backup. Stage one: install various apps like PhpMyAdmin for direct database access.
Install Steps for PhpMyAdmin on Gentoo (assuming you already have MySQL, Apache, PHP, etc.):
1. Attempt emerge
# emerge -av phpmyadmin
2. Discover that the PhpMyAdmin requires several 'USE' flags to be set for PHP - namely: ctype pcre session unicode - so I add these into the /etc/make.conf file, and recompile PHP:
# nano /etc/make.conf
# emerge -av dev-lang/php
# emerge -av phpmyadmin
since I typically use Gentoo's 'vhosts' setting for Apache virtual site hostings, I then have to create the desired Apache directories and then install the web-app into the desired directory:
# mkdir /var/www/phpmyadmin.server.lan.com
# mkdir /var/www/phpmyadmin.server.lan.com/htdocs
# mkdir /var/www/phpmyadmin.server.lan.com/cgi-bin
# mkdir /var/www/phpmyadmin.server.lan.com/logs
# mkdir /var/www/phpmyadmin.server.lan.com/secure
# webapp-config -I -h phpmyadmin.server.lan.com -d / phpmyadmin 2.11.5.2
then create the apache vhosts file, by editing a previously made one, filling in the new directory values and virtual server name, and then restart Apache:
# cp /etc/apache2/vhosts.d/02_forum_server_lan_com.conf /etc/apache2/vhosts.d/03_phpmyadmin_server_lan_com.conf
# nano /etc/apache2/vhosts.d/03_phpmyadmin_server_lan_com.conf
# /etc/init.d/apache2 restart
Then on the DNS server, add in the new phpmyadmin.server.lan.com DNS entries, and restart the DNS server.
Next is created a specific MySQL user for PhpMyAdmin - this is from the wiki at http://wiki.cihar.com/pma/controluser :
server ~ # mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.0.54-log Gentoo Linux mysql-5.0.54
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql[gt] GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'xxx';
Query OK, 0 rows affected (0.07 sec)
mysql[gt] GRANT SELECT (
-[gt] Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
-[gt] Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
-[gt] File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
-[gt] Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
-[gt] Execute_priv, Repl_slave_priv, Repl_client_priv
-[gt] ) ON mysql.user TO 'pma'@'localhost';
Query OK, 0 rows affected (0.03 sec)
mysql[gt] GRANT SELECT ON mysql.db TO 'pma'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql[gt] GRANT SELECT ON mysql.host TO 'pma'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql[gt] GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
-[gt] ON mysql.tables_priv TO 'pma'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql[gt] GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql[gt] exit
Bye
server ~ #
The other advanced step is to create databases to store PhpMyAdmin info - http://wiki.cihar.com/pma/pmadb - the SQL file was here - all I had to edit was the pma username, and then run that in MySQL.
# nano /var/www/phpmyadmin.server.lan.com/htdocs/scripts/create_tables_mysql_4_1_2+.sql
Getting close - next I worked on the config file for PhpMyAdmin, filling in the various various, and really uncommenting all the advanced features - why not?
http://wiki.cihar.com/pma/Quick_Install
# cp /var/www/phpmyadmin.server.lan.com/htdocs/config.sample.inc.php /var/www/phpmyadmin.server.lan.com/htdocs/config.inc.php
# nano /var/www/phpmyadmin.server.lan.com/htdocs/config.inc.php
So that it ended up looking like this:
$cfg['blowfish_secret'] = 'xxx'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'xxx';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
Bing Bang Boom! Done! I logged in to phpmyadmin.server.lan.com and all worked beautifully.