Execute below command to install phpMyAdmin
sudo apt-get update
sudo apt-get install phpmyadmin
sudo php5enmod mcrypt
sudo service apache2 restart
If you are running older version of Ubuntu server, run below command.
sudo apt-get install phpmyadmin apache2-utils php-curl
I tried above 2 methods and both worked well.
Secure phpmyadmin
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
Restart for new changes
sudo systemctl restart apache2
Create an htaccess File
sudo nano /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
For Authentication
sudo apt-get install apache2-utils
Add user and change password
sudo htpasswd -c /etc/phpmyadmin/.htpasswd username
sudo htpasswd /etc/phpmyadmin/.htpasswd username