s0x IT Services Tips Install Apache, PHP, MySQL on CentOS 7

Install Apache, PHP, MySQL on CentOS 7

Install Apache, PHP, MySQL on CentOS 7 post thumbnail image

This article shows you how to install Apache and PHP and MySQL CentOS 7. The default CentOS 7 image does not have access to repositories that support PHP version 5.6 and higher, so we need to enable a repository that does. The advantages of using yum to perform the installation (instead of the source code) is that yum also automatically installs future security updates and handles dependencies.

Install Apache

yum install httpd

systemctl start httpd

systemctl enable httpd.service

firewall-cmd --add-service=http --permanent

firewall-cmd --reload

Install PHP 7.3

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

yum-config-manager --enable remi-php73

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

php -v

Install MySQL

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

yum install mysql-server

service mysqld start

grep "A temporary password" /var/log/mysqld.log

*** [Note] A temporary password is generated for root@localhost: hjkygMukj5+t783


*** Follow prompts, answer Y to all

service mysqld restart

chkconfig mysqld on

mysql -u root -p

Change SSH Port from Default

vi /etc/ssh/sshd_config

*** The Port line should be in the first page of the file, as either Port 22 or commented out as #Port 22. Go to the line. Press Insert to enter edit mode. Remove the # if present and change the port number to the required value. Press the Esc key to return to command mode and enter :wq to write out the file and quit vi.

yum -y install policycoreutils-python

semanage port -a -t ssh_port_t -p tcp 2132

firewall-cmd --zone=public --add-port=2132/tcp --permanent

firewall-cmd --reload

systemctl restart sshd.service

That’s all, Enjoy 🙂

Related Post