Skip to content
Charles Ross edited this page Jul 18, 2014 · 16 revisions

This guides assumes you have already installed a fresh copy of Debian Linux Wheezy 64bit (https://www.debian.org/distrib/netinst) on your server or virtual machine.

  • Words like this are commands to run on your server or virtual machine.
  • The 'pico' text editor used in this documentation comes with Debian and is super simple to use. To open a file just type pico [location of your file]. Use arrow keys to navigate, and in order press "[CTRL]+[X], [Y], [ENTER]" to save file changes.

To begin installing, SSH into your Linux Debian server as root.

phpMyAdmin


phpMyAdmin is an easy to use free PHP-based MySQL administration panel, delivered through a web browser. Make sure you have NGINX/PHP with Percona Server or MySQL running.

Setup phpMyAdmin


Make install directory and move into it

mkdir /opt/phpmyadmin

cd /opt/phpmyadmin

Download latest version of phpMyAdmin

wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.6/phpMyAdmin-4.2.6-english.tar.gz

Decompress file

tar -xvf phpMyAdmin-4.2.6-english.tar.gz

Move into phpMyAdmin source directory

cd phpMyAdmin-4.2.6-english

Enter the mysql command line as root and enter password

mysql -u root -p

Run the phpMyAdmin sql script in the mysql command shell

source /opt/phpmyadmin/phpMyAdmin-4.2.6-english/examples/create_tables.sql

Leave mysql

quit

Copy over configuration file

cp /opt/phpmyadmin/phpMyAdmin-4.2.6-english/config.sample.inc.php /opt/phpmyadmin/phpMyAdmin-4.2.6-english/config.inc.php

Edit configuration file

pico /opt/phpmyadmin/phpMyAdmin-4.2.6-english/config.inc.php

Find the line

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

Uncomment the commands and put a user account that hss access to the phpmyadmin database, example:

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = '';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'your-mysql-root-password';

Next, find the line

/* Storage database and tables */
// $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]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';

And uncomment the commands, example:

/* Storage database and tables */
$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]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';

Setup NGINX for phpMyAdmin


To view the phpMyAdmin control panel, edit your nginx config file

pico /opt/nginx/conf/nginx.conf

Add a block for phpMyAdmin, an NGINX config file example is given below:

#NGINX CONFIGURATION
user nginx nginx;
worker_processes 1;

events {
    worker_connections 1024;
}

http {
    
    include mime.types;
    default_type application/octet-stream;
    
    sendfile off;
    gzip on;

    # phpmyadmin
    server {

        listen 1337;
        server_name localhost:1337;

        root /opt/phpmyadmin/phpMyAdmin-4.2.6-english;

        location / {
            index index.php;
            if (!-f $request_filename) {
                rewrite ^(.*)$ /index.php last;
            }
        }

        location ~ \.php$ {

            include /opt/nginx/conf/fastcgi.conf;
            fastcgi_index index.php;
            if (-f $request_filename) {
                fastcgi_pass 127.0.0.1:9000;
            }
        }

    }

}

Save and close

See if your NGINX configuration file is valid (if not see what error you made in previous step).

nginx -t

If valid then restart NGINX

service nginx restart

phpMyAdmin should now be accessible via http://localhost:1337 or whichever port you chose.

Note: If you're using VirtualBox make sure to open a port to 1337 (or whichever port you chose) in your Virtual Machine's Advanced Network settings