@Photo Larry pretty much hit the nail on the head! I am going to give an answer based on his that will be easy to understand and follow.
- Your first step is to install PMA (phpMyAdmin) from the official Ubuntu repo:
apt-get install phpmyadmin
.
- Next, cd into usr/share directory:
cd /usr/share
.
- Third, remove the phpmyadmin directory:
rm -rf phpmyadmin
.
- Now we need to download the latest PMA version onto our system (Note that you need wget:
apt-get install wget
):
wget -P /usr/share/ "https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-english.zip"
Let me explain the arguments of this command, -P defines the path and "the link.zip" is currently (7/17/18) the latest version of PMA. You can find those links HERE.
- For this next step you need unzip (
apt-get install unzip
): unzip phpMyAdmin-4.8.2-english.zip
. We just unzipped PMA, now we will move it to it's final home.
- Lets use the
cp
(copy) command to move our files! Note that we have to add the -r
argument since this is a folder. cp -r phpMyAdmin-4.8.2-english phpmyadmin
.
- Now it's time to clean up:
rm -rf phpMyAdmin-4.8.2-english
.
Keep Reading!
You might now notice two errors after you log into PMA.
the configuration file now needs a secret passphrase (blowfish_secret). phpmyadmin
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
However, these issues are relatively easy to fix. For the first issue all you have to do is grab your editor of choice and edit /usr/share/phpmyadmin/config.inc.php
but there's a problem, we removed it! That's ok, all you have to do is: cd /usr/share/phpmyadmin
& cp config.sample.inc.php config.inc.php
.
Example phpMyAdmin Blowfish Secret Variable Entry:
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V';
/* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Now save and close the file.
- Now we will create a tmp directory for PMA:
mkdir tmp
& chown -R www-data:www-data /usr/share/phpmyadmin/tmp
. The last command allows the Apache web server to own the tmp directory and edit it's contents.
EDIT Dec 12, 2018
You don't want someone to steal your cookies, now do you?
It has been brought to my attention that https://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator causes errors on older versions on PMA. However, the main reason I discourage you to use websites like this is because you have no idea whether they use a weak PRNG (Pseudo-Random Number Generator) (e.g. rand()
, mt_rand()
, and lcg_value()
) or one of the "shuffling" functions (e.g. str_shuffle()
, shuffle()
, array_rand()
). As such, I made my own tool for this purpose. It generates a cryptographically secure 32 character string you can use without concern for security or errors! PHP man page for function I use to generate the randomness http://php.net/manual/en/function.random-int.php. I replaced the old link with this one: https://www.motorsportdiesel.com/tools/blowfish-salt/pma/.
EDIT Sep 11, 2020
I have changed the blowfish generator link as the old one is no longer reachable.