SlideShare una empresa de Scribd logo
1 de 10
How to Create a fully functional
PHP/MySQL AWS EC2/RDS installation,
including phpMyAdmin
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:
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.
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
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
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…)
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
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:
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
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!

Más contenido relacionado

Último

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

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

  • 1. How to Create a fully functional PHP/MySQL AWS EC2/RDS installation, including phpMyAdmin
  • 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. 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. 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. 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. 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. 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. 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. 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. 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!