How to install a lamp server amazon ec2 instance centos/ubuntu

install lamp on aws ec2

To install Apache / MySQL / PHP 7.x in ec2 instance / Centos

1. Sudo yum -y update

2. Sudo yum install -y httpd24

3. Service httpd start

4. Sudo yum install -y php72 mysql56-server php72-mysqlnd

5. Service httpd restart

6. Sudo chkconfig httpd on  (chkconfig command to configure the Apache to start at each system boot)

7. Check web server paste URL/IP in browser

8. ls -l /var/www

9. sudo usermod -a -G apache ec2-user

10. groups  (to check groups)

11. Then change groups ownership

12. sudo  chown -R ec2-user:apache /var/www

13. Sudo chmod 775 /var/www

14. Find /var/www -type d -exec sudo chmod 775 {} \;

15. Find /var/www -type f -exec sudo chmod 664 {} \;

16. echo  “<?php phpinfo(); ?>’ > /var/www/html/phpinfo.php

17. http://mydomainname/phpinfo.php

18. Sudo service mysqld start

19. Sudo mysql_secure_installation

20. Y

21. Y

22. Y

23. Y

24. Sudo service mysqld stop

25. Sudo chkconfig mysqld on

26. Cd /var/www/html

27. wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz

28. mkdir phpMyAdmin && tar -xvzf phpMyAdmin-latest-all-languages.tar.gz -C phpMyAdmin --strip-components 1

29. rm -rf phpMyAdmin-latest-all-languages.tar.gz

30. Sudo service mysqld start

31. http://mydomainname/phpmyadmin

 

Blog type: 

Add new comment

Authored By

Sandeep Gurjar

Hy all, This is Sandeep Gurjar am the founder of hostingride.in. I am a Redhat Certified Engineer (RHCE) / AWS Solutions Architect-Associate and working as an system administrator since 2016.

Follow us on

Facebook​  Twitter  LinkedIn  Google+