SlideShare a Scribd company logo
1 of 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!

More Related Content

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Featured

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
 

Featured (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!