How to Setup Amazon Web Services EC2 Instance with Apache, PHP, MySQL

How to Setup Amazon Web Services EC2 Instance with Apache, PHP, MySQL



How to Setup Amazon Web Services EC2 Instance with Apache, PHP, MySQL

Instructions:
Go to and create a new account if you do not have an account already.
A credit card or debit is required.

Sign into your AWS account under console management.

Select EC2 and create a new instance.

Choose one of the Ubuntu AMIs, and leave everything default. Under Security groups, create a new security group with SSH and HTTP.
Name your key and download.

Under the terminal, maneuver to the key and chmod 400 to make sure that the permissions are correct.
Under windows, you may have to run as administrator the command prompt or cygwin to chmod properly.
Or you can use the command that I did, which was:
chown :Users testTutorial.pem
Then I did:
chmod 400 testTutorial.pem
Allows only me to read
Then:
ssh -i testTutorial.pem [email protected]…(public IP)

Once you are on the Ubuntu AMI, you can start to mess around with the packages to install.
I recommend the following:
Run the command:
sudo apt-get install apache2 libapache2-mod-php5 php5 mysql-server php5-mysql
You can also get phpadmin if you would like.
Remember to restart the apache service:
service apache2 restart

Then, run a secure installation of mysql:
mysql_secure_installation

Go put in your browser the public IP. It works! But what if you want to change the index.html

Well, go cd ../../var/www
In this directory www, you can edit the index.html
sudo vim index.html
You can change the index.html to anything you want using the editor of your choice.

The site changes.

Twitter:
Blog:

25 thoughts on “How to Setup Amazon Web Services EC2 Instance with Apache, PHP, MySQL

  1. sir will ubuntu server work on windows
    i am unable to download the packages for by the command:sudo apt-get install apache2 libapache2-mod-php5 mysql-server php5-mysql php

  2. are u selecting ubuntu sever bcz ur on a ubuntu operating system? or even windows operating system can choose ubuntu?

  3. Очень люблю хостинг-провайдера WELL-WEB, 2 года на нем, тех. поддержка как родная, отвечают быстро, во всем всегда помогут, даже если по мелочам к ним лезу – у них хватает терпения на мои глупости :)) Неограниченное кол-во IP, разные сетки, Удобные способы оплаты и кто сказал что для VPS нужен админ? Нет, они сами все сделают! У меня 37 сайтов на php с разными скиптами и плагинами на VPS Старт, а я в их оптимизации и администрировании полный нуль))Все отлично работает! Рекомендую WELL-WEB!

  4. hi, the learned author is using a mv command for moving the pem file in the command prompt… i am not getting that command.. any advise please

  5. how do i connect such database remotely?
    Please reply… i have been searching for this since 2 days…

    Thanks in advance

  6. For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.

    For a CentOS AMI, the user name is centos.

    For a Debian AMI, the user name is admin or root.

    For a Fedora AMI, the user name is ec2-user or fedora.

    For a RHEL AMI, the user name is ec2-user or root.

    For a SUSE AMI, the user name is ec2-user or root.

    For an Ubuntu AMI, the user name is ubuntu.

    Otherwise, if ec2-user and root don't work, check with the AMI provider.

  7. 8:26 you don't have to terminate the virtual machine. you go Key Pairs section in EC2, delete old key and create new key.

  8. for the ***.pem error i could not solve it using the approach shown in the video – however i solved it using the following solution from stackoverflow

    On windows, Try using git bash and use your Linux commands there. Easy approach

    chmod 400 *****.pem

    ssh -i "******.pem" [email protected]

  9. in iran we are boycotted. anybody can help me to verify us phone number in amazon?

    i've already registered but i cant register voip phone number, it doesn't receive call.

    anybody can help me?

    email: [email protected]

  10. when i run
    sudo apt-get install apache2 libapache2-mod-php5 php5 mysql-server php5-mysql php5
    Package 'libapache2-mod-php5' has no installation candidate
    Package 'php5-mysql' has no installation candidate
    Package 'php5' has no installation candidate

  11. How can i use a simple FTP software to edit files in the virtual machine with a elegant UI please ?
    (sorry for my english i'm french)

  12. I am really happy with your video because your video is very unique and powerful for new learner.
    https://bit.ly/2w8mrMC

  13. Great Video I would like to suggest to take a look at Cloudways laravel cloud. It makes the process of installing Laravel on AWS like a breeze.
    https://www.cloudways.com/en/laravel-hosting.php

  14. Awesome Man !!

    Some update.. on sudo apt-get command

    As php version changed ,new command will be
    sudo apt-get install php7.0 php7.0-mcrypt php7.0-mysql mysql-server apache2

  15. 'ssh' is not recognized as an internal or external command,
    operable program or batch file.

    How can I solve this problem, please?
    and I installed (Cygwin64 Terminal)

Leave a Reply

Your email address will not be published. Required fields are marked *