Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

How to create a fully functional AWS EC2/RDS PHP/MySQL installation complete with phpMyAdmin

How to create a fully functional AWS EC2/RDS PHP/MySQL installation complete with phpMyAdmin. Asumes that the user is using Windows for their remote access.

  • Loggen Sie sich ein, um Kommentare anzuzeigen.

How to create a fully functional AWS EC2/RDS PHP/MySQL installation complete with phpMyAdmin

  1. 1. How to Create a fully functional PHP/MySQL AWS EC2/RDS installation, including phpMyAdmin
  2. 2. 1. First create an AWS EC2 instance and MySQL RDS instance following the instructions found in AWS’s slideshare: “Your first week on Amazon EC2”, Days 1 through 3 2. Configure your Putty connectivity to your EC2 Server following the instructions found @ http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/getting-started- deploy-app-connect.html 3. Install Apache on your server • Using Putty, login to your EC2 instance as root (sudo su) sudo yum install httpd 4. Verify that your httpd installation worked by going to http://ec2-xxx-xxx-xxx-xxx.YOUR-REGION.compute.amazonaws.com/ where you *should* see the Amazon Linux AMI test page:
  3. 3. 5. Install and configure WinSCP for connectivity to your EC2 Server using the Instructions found at http://avastechnology.wordpress.com/2012/09/07/setting-up- winscp-for-aws-access/ 6. Using WinSCP, upload a test file to /var/www/http (I like <?php phpinfo(); ?>, which provides useful information). Go back to http://ec2-xxx-xxx-xxx-xxx.YOUR- REGION.compute.amazonaws.com/TEST-FILE-NAME.php and make sure it renders AOK. 7. If (so far=so good) then buy yourself a beer.
  4. 4. 8. Now we’re going to get phpMyAdmin to work with it… 9. As per the instructions found at https://gist.github.com/aronwoost/1105007 • Using Putty, login to your EC2 instance as root (sudo su) • If you like, reinstall php and MySQL packages and other goodies: sudo yum install https mod_ssl mysql mysql-server php php-mysql php-xml 10. As per the instructions @ http://superuser.com/questions/291230/how-to-install- phpmyadmin-on-linux-ec2-instance • Using Putty (as ec2-user) • Download & unpack the latest version of phpMyAdmin: cd /var/www/html sudo chown ec2-user . wget http://www.sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.4.1/phpMyA dmin-4.0.4.1-all-languages.tar.bz2 tar -jxf phpMyAdmin-4.0.4.1-all-languages.tar.bz2 -C /var/www/html mv phpMyAdmin-4.0.4.1-all-languages phpmyadmin rm -rf phpMyAdmin-4.0.4.1-all-languages.tar.bz2
  5. 5. 11. Returning to the instructions @ https://gist.github.com/aronwoost/1105007 • Using Putty, login to your EC2 instance as root (sudo su) • Install phpMyAdmin wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2- 2.el5.rf.i386.rpm sudo rpm –Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm sudo yum install phpmyadmin (or just skip all that & use: yum --enablerepo=epel install phpmyadmin) 12. Notice that either of the above techniques installed phpMyAdmin v2.11, and v 4.0.1 is now available, so decide that was a bad idea and uninstall phpmyadmin: yum erase phpmyadmin
  6. 6. 13. Returning to the instructions @ https://gist.github.com/aronwoost/1105007 • Start the MySQL service cd /etc/rc.d/init.d/ sudo ./mysqld start sudo /usr/bin/mysql_secure_installation (follow the instructions at the prompts & note that you should not use the same password as in your previously defined RDS instance for user: root in order to prevent imminent confusion) • Note that you now have a MySQL Server on your EC2 Instance, BUT THIS IS PROBABLY NOT ONE THAT YOU REALLY WANT TO USE! Use your RDS MySQL for data! So why did we bother? • Set startup scripts for apache & MySQL: cd /etc/rc.d/rc3.d sudo rm K15httpd sudo rm K36mysqld sudo ln -s ../init.d/mysqld S30mysql sudo ln -s ../init.d/httpd S85httpd • Set up phpMyAdmin to allow access from external IPs: sudo chmod 0700 /etc/httpd/conf.d/phpMyAdmin.conf (Oh! That’s why we bothered… because the config files persist through the uninstall. How convenient…)
  7. 7. 13. (contd…) • Set up aliases & Allow access from external IPs sudo nano /etc/httpd/conf.d/phpMyAdmin.conf … # Web application to manage MySQL # # Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from PUT.YOUR.IP.HERE # Alias /phpmyadmin /usr/share/phpMyAdmin Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /mysqladmin /usr/share/phpMyAdmin … • Set blowfish_secret to make it work with cookie auth sudo chmod 0700 /usr/share/phpMyAdmin/config.inc.php sudo nano /usr/share/phpMyAdmin/config.inc.php … $cfg['blowfish_secret'+ = ‘put-your-secret-magic –string-here'; … sudo chmod 0755 /usr/share/phpmyadmin/config.inc.php
  8. 8. 13. (contd…) • Make mod_rewrite (.htaccess) work in subdirectories cd /etc/httpd/conf sudo nano httpd.conf Find <Directory "/var/www/html"> Replace AllowOverride none with AllowOverride all Save changes and exit • Restart Apache sudo service httpd restart 14. Test connectivity of phpMyAdmin by going to http://ec2-xxx-xxx-xxx-xxx.your-region.compute.amazonaws.com/phpMyAdmin/ The phpMyAdmin login screen should appear:
  9. 9. 14. Use the loginID and password for the LOCAL MySQL installation on the EC2 server (the one you won’t want to use in the future… we’re just making sure phpMyAdmin got set up correctly). 15. If that worked, then modify the phpMyAdmin configuration file to point to your RDS instan sudo nano /usr/share/phpMyAdmin/config.inc.php Change host to $cfg*‘Servers’+*$i+*‘host’+ =‘YOUR-RDS-HOST-STRING.rds.amazonaws.com’ Save & exit 16. Restart Apache sudo service httpd restart
  10. 10. 17. Test connectivity of phpMyAdmin to your RDS MySQL DB by going back to the phpMyAdmin login Screen. 18. This time use the loginID and password for the RDS MySQL Server. 19. Success! 20. Drink that beer! Heck, you deserve a 6-pack! You now have a fully functional AWS EC2/RDS PHP/MySQL installation complete with phpMyAdmin. Congratulations!

×