How to Install LAMP Stack in Cent os 7 on Google Cloud Platform

What is LAMP Stack?

LAMP stands for Linux,Apache,MySQL and PHP. Linux is an operating system where we are going to install Apache. In Apache we can run HTML,CSS,PHP and MySQL. An Apache is a web server it is used to run a web application on web browser.MySQL is a database server which is used to store a data in a table and PHP stands for hypertext Pre-processor it is a programming language to create a web application that run on a back-end.


How to install LAMP Stack in Google Cloud Platform?


In this tutorial we are going to install LAMP stack on CentOS 7 in google cloud platform by creating a VPS.

Requirements:

      1. Google cloud platform account.
      2.Basic Linux knowledge.
      3. VPS with sudo privileges.


1. Create a VM instance in google cloud platform with this requirements.

 
      1.CentOS 7
      2.1GB RAM with 1CPU
      3.10GB storage

if you don't know how to create VM instance click here 

2. Add the EPEL repo here to install latest phpMyAdmin



rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release


install nano to edit files in terminal
yum -y install nano


3. Install MySQL and MariaDB

yum -y install mariadb-server mariadb

Start MySQL service and create a system startup link that run MySQL when system boots
systemctl start mariadb.service
systemctl enable mariadb.service

Now securely install MYSQL and set password for the user root.
mysql_secure_installation

follow the steps to install MySQL.


4. Install Apache Server.


copy and past the command to install Apache 2.4 in CentOS7.
yum -y install httpd

Now start the apache adn setup startup link to run apache when system boots
systemctl start httpd.service
systemctl enable httpd.service


5. Setup Firewall rule to access web-server using external IP of server

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Now type your external IP in web Browser like http://YourExternalIP/ you can see a test apache page in web browser.


6. Installing PHP


To install newer version on PHP use the below command
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

install yum-utils as we need the yum-config-manager utility.
yum -y install yum-utils

update the system packages by using
yum update

Copy and paste the below command to install PHP 7.2
yum-config-manager --enable remi-php72
yum -y install php php-opcache
Now restart the Apache Server


systemctl restart httpd.service


7. Installing Common PHP Modules

yum -y install php-mysqlnd php-pdo
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
Now restart Apache web server
systemctl restart httpd.service


8. Installing PhpMyAdmin.


Usign the phpmyadmin you can access the database through web interface
yum -y install phpMyAdmin

Now open the phpmyadmin configuration file using nano
nano /etc/httpd/conf.d/phpMyAdmin.conf

Now comment the lines which is highlighted in Red color


<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
#Apache 2.4
#<RequireAny> 
#Require ip 127.0.0.1 
#Require ip ::1 
#</RequireAny> 
Require all granted 
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

Next, we change the authentication in phpMyAdmin from cookie to http

nano /etc/phpMyAdmin/config.inc.php



[...]
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
[...]


Restart Apache server


systemctl restart httpd.service


To access PhpMyAdmin type https://YourExternalIP/phpmyadmin

Now we sucessfully installed LAMP Stack in centos7 on google cloud platform
 

Post a Comment

1 Comments

  1. Casino Nights Casino VR App for iOS - JTM Hub
    The casino games are simple: just 부산광역 출장샵 spin the wheel and start spinning the slots, spin the wheel and 수원 출장마사지 pick up the 군포 출장마사지 prize. 부천 출장안마 Once the wheel spins you'll 천안 출장안마 be able to

    ReplyDelete