SlideShare uma empresa 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!

Mais conteúdo relacionado

Último

COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 

Último (20)

COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 

Destaque

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
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

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...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

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!