#Launch an instance http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/GetStarted.html
phpMyAdmin
| Type | Protocol | Port Range | Destination |
|---|---|---|---|
| SSH | TCP | 22 | 0.0.0.0/0 |
| HTTP | TCP | 80 | 0.0.0.0/0 |
| Type | Protocol | Port Range | Destination |
|---|---|---|---|
| All traffic | All | All | 0.0.0.0/0 |
Assign phpMyAdmin to the new EC2 instance and visit
http://YOUR_SERVER_IP
#Setup EC2
chmod 400 key.pem
ssh -i key.pem ec2-user@YOUR_SERVER_IP##Root login
sudo -i##Update and install
yum -y update
yum install -y gcc make gcc-c++
yum install -y php55-mysqlnd php55 php55-xml php55-mcrypt php55-mbstring php55-cli mysql55 mysql55-server httpd24-y will tell yum to say yes to all questions.
##Start your engines
service httpd start
service mysqld start##MySQL Setup
/usr/bin/mysqladmin -u root password SUPERSECUREPASSWORD##Setup startup scripts for apache and MySQL
cd /etc/rc.d/rc3.d
rm K15httpd
rm K36mysqld
ln -s ../init.d/mysqld S30mysql
ln -s ../init.d/httpd S85httpd##Install phpMyAdmin
cd /var/www/html
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.13.1/phpMyAdmin-4.4.13.1-english.tar.gz
tar -xzvf phpMyAdmin-4.4.13.1-english.tar.gz -C /var/www/html
mv phpMyAdmin-4.4.13.1-english phpmyadmin
rm -rf phpMyAdmin-4.4.13.1-english.tar.gzcheck for updates: https://www.phpmyadmin.net/downloads/
We now need to add permission for this folder, find the user group (should be apache) with this command:
egrep 'User|Group' /etc/httpd/conf/httpd.confWhich will return:
User apache
Group apache
And last, run this command to associate that user with the phpmyadmin folder:
chown -R apache.apache phpmyadmin/##Install Config
cd /var/www/html/phpmyadmin/
cp config.sample.inc.php config.inc.php
mkdir config
chmod o+rw config
cp config.sample.inc.php config/config.inc.php
chmod o+w config/config.inc.php##Setup Config
nano /var/www/html/phpmyadmin/config.inc.php$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V';reference: http://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator
##Restart Server
service httpd restart##Setup phpMyAdmin
http://YOUR_SERVER_IP/phpmyadmin/index.php
with username root password SUPERSECUREPASSWORD
##Remove config folder
rm -rf config#Setup RDS
Setup RDS with username awsuser password mypassword
##Edit Config
nano /var/www/html/phpmyadmin/config.inc.php$cfg['Servers'][$i]['host'] = 'mydbinstance.abcdefghijkl.us-east-1.rds.amazonaws.com:3306'##Access phpMyAdmin
http://YOUR_SERVER_IP/phpmyadmin/index.php
with username awsuser password mypassword
##phpinfo
nano /var/www/html/info.php<?php phpinfo(); ?>http://YOUR_SERVER_IP/info.php
##Test db connection
nano /var/www/html/db_test.php<?php
$link = mysqli_connect('mydbinstance.abcdefghijkl.us-east-1.rds.amazonaws.com', 'awsuser', 'mypassword', 'information_schema', 3306);
var_dump($link);<?php
$link = mysqli_connect('localhost', 'root', 'SUPERSECUREPASSWORD', 'information_schema');
var_dump($link);http://YOUR_SERVER_IP/db_test.php
#Git Deploy https://gist.github.com/oodavid/1809044
thank you!
(you have a typo: "Git Depoly" should be "Git Deploy") 😄