You are on page 1of 3

Install PHP, MySQL and Apache on EC2 Centos.......................................................................

2
Step 1: Clean-up yum: ........................................................................................................ 2
Step 2: Update existing packages: ...................................................................................... 2
Step 3: Add Yum CentOS 7 Repositories ............................................................................ 2
Step 4: Install PHP 7 from webtatic ..................................................................................... 2
Install Basis PHP modules............................................................................................... 2
Step 5 Install Apache 2.4 .................................................................................................... 2
Start httpd service and enable to start on boot. ................................................................... 2
Step 6 Install MySQL 5.7 .................................................................................................... 3
Apply security on MySQL and also set root user password. ............................................ 3
Generate temporary password for mysql ......................................................................... 3
Step 7 Install and open firewall port .................................................................................... 3
Install Firewall.................................................................................................................. 3
Start firewall service ........................................................................................................ 3
Step 8 Check Installed Version ........................................................................................... 3

Devscreencast, Inc
Install PHP, MySQL and Apache on EC2 Centos
Firstly, we need to clean and update Yum. Yum is a command line tool for package
management in a Linux system. It is used to easily install, update, remove or search
software packages on a system.

Step 1: Clean-up yum:


#sudo yum clean all

Step 2: Update existing packages:


#sudo yum update

Step 3: Add Yum CentOS 7 Repositories


we need to add the following various YUM repositories such as REMI, EPEL, Webtatic &
MySQL community server to our system.

# sudo yum install epel-release


# sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# sudo rpm -Uvh http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm

Step 4: Install PHP 7 from webtatic


# sudo yum install php71w

Search for installed PHP modules - #sudo yum search php71w

Install Basis PHP modules.


# sudo yum install php71w-mysql php71w-xml php71w-soap php71w-xmlrpc
# sudo yum install php71w-mbstring php71w-json php71w-gd php71w-mcrypt

Step 5 Install Apache 2.4


Apache (HTTPD) is the most popular web server used on Linux systems.
#sudo yum --enablerepo=epel,remi install httpd OR sudo yum -y install httpd

Start httpd service and enable to start on boot.


# sudo systemctl start httpd.service OR sudo service httpd restart
# sudo systemctl enable httpd.service
#sudo systemctl status httpd OR sudo service httpd status

Devscreencast, Inc
Step 6 Install MySQL 5.7
# sudo yum install mysql-server

Apply security on MySQL and also set root user password.


# sudo systemctl start mysqld.service

Generate temporary password for mysql


# grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1
# sudo mysql_secure_installation

Restart MySQL service and enable to start on system boot.


# sudo systemctl restart mysqld.service
# sudo systemctl enable mysqld.service

Step 7 Install and open firewall port


To open firewall ports for http (80) and https (443) services

Install Firewall
#sudo yum install firewalld

Start firewall service


#sudo systemctl start firewalld.service
# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-service=https
# sudo firewall-cmd --reload

Step 8 Check Installed Version


Check the installed versions of packages on system
# php -v
# httpd -v
# mysql -V

Devscreencast, Inc

You might also like