How to install PHPMyAdmin on Linux EC2 instance?

I just finished setting up a default Linux EC2 instance and would like to install PHPMyAdmin. I already have Apache and MySQL installed but cannot seem to install PHPMyAdmin. I tried using

sudo apt-get phpmyadmin but the command apt-get is not recognized.

I also tried sudo yum install phpmyadmin but that I get the message No package phpmyadmin available.

Any suggestions on what I am doing wrong?


I found an easy solution here.

Do the following:

  1. Navigate to the apache folder

    cd /var/www/html
    
  2. Ensure ownership of the folder (assuming signed in with ec2-user)

    sudo chown ec2-user .
    
  3. Download phpMyAdmin

    wget https://files.phpmyadmin.net/phpMyAdmin/4.5.0.2/phpMyAdmin-4.5.0.2-all-languages.tar.bz2
    
  4. Unzip

    tar -jxf phpMyAdmin-4.5.0.2-all-languages.tar.bz2 -C /var/www/html
    
  5. Rename the folder

    mv phpMyAdmin-4.5.0.2-all-languages phpmyadmin
    
  6. Remove the zip file

    rm -rf phpMyAdmin-4.5.0.2-all-languages.tar.bz2
    

That's the basics. You can find more info in the link provided above.


I know the question has more than one year, but was the first thing that popped up on google with "phpmyadmin ec2". Here is a better way to do things.

Knowing that you have yum, the best way to act is to install it by yum.

The easy way is to activate it just to install the packages you want, like phpMyAdmin or MongoDB. Eg.

sudo yum --enablerepo=epel install phpmyadmin

and it should work.

EDIT (comment by @eric-brotto):

It also should be noted that this comes with the advantage of uninstalling via

(sudo) yum erase phpmyadmin

Eric Brotto Jun 8 at 16:22

Note, that this would install phpmyadmin in /usr/share/phpmyadmin. To make it available in your web root, you would have to symlink it thus:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

There are two ways to use EPEL, one is above, the other is to activate it permanently, editing the file /etc/yum.repos.d/epel.repo and where it says enabled=0 we change it to enabled=1, now you can sudo yum install phpmyadmin.

Here you can see a package list for the EPEL repo, too.


First add the repository, then install:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm 
sudo yum install phpmyadmin 

This works fine on a standart 32bits amazon instance


Note that if, after using any of the above methods to install phpMyAdmin, the phpMyAdmin page is empty in example.com/phpmyadmin, then you probably need to edit httpd.conf to allow overrides in the web directory, e.g.:

sudo nano /etc/httpd/conf/httpd.conf
  1. Find <Directory "/var/www/html">
  2. Replace AllowOverride none with AllowOverride all
  3. Save changes and exit
  4. Restart Apache server

    sudo service httpd restart