Install LAMP on CentOS 7

Install LAMP on CentOS 7

1. Clear and upgrade the system
yum clean all
yum -y update
hostname localhost
systemctl stop firewalld
systemctl disable firewalld

2. Install CSF
cd /usr/src
rm -fv csf.tgz
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

3. Configure CSF
nano /etc/csf/csf.conf

enter
csf -r

Save and exit.

4. Change the OpenSSH default port (optional)
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
nano /etc/ssh/sshd_config
Find Port 22, change it to another port, and allow it in CSF.

Save and exit.
Restart the service:
systemctl restart sshd.service

5. Install Apache

a. Clear old services:
yum -y install httpd

b. Set up the domain name directory (change example.com to your own domain name)
mkdir -p /var/www/example.com/public_html
chown -R $USER:$USER /var/www/example.com/public_html
chmod -R 755 /var/www
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled

c. Edit the configuration file
nano /etc/httpd/conf/httpd.conf
Put IncludeOptional sites-enabled/*.conf at the bottom of the file

d. Save and exit.
nano /etc/httpd/sites-available/example.com.conf

e. Add the following to the website configuration file (change example.com to your own domain name)

 ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/example.com/public_html ErrorLog /var/www/example.com/error.log CustomLog /var/www/example.com/requests.log combined

f. Save and exit.
ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf
apachectl restart

6. Install CertBot (Use lets-encrypt to create SSL certificates)
yum install epel-release
yum install certbot
certbot certonly

Here are the installation commands:
certbot renew –dry-run
certbot renew –quiet

7. Install PHP 5.6
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epe…t-7.noarch.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath

8. Install MySQL
yum -y install mariadb-server mariadb
systemctl start mariadb
mysql_secure_installation

9. Install phpMyAdmin
yum -y install phpmyadmin
nano /etc/httpd/conf.d/phpMyAdmin.conf
Change 127.0.0.1 to your independent IP
Alias ​​/phpMyAdmin /usr/share/phpMyAdmin (change /phpMyAdmin to /usr/share/phpMyAdmin)

10. Restart the service
systemctl restart httpd.service

via: http://www.webhostingtalk.com/showthread.php?t=1588551

<<:  CloudAtCost 512MB memory vmware vps Canada simple review

>>:  IdeaStack: $5/month/1GB memory/30GB space/1TB traffic/KVM/Seattle/windows

Recommend

Wable: $8/month/2GB RAM/50GB SSD/6TB bandwidth/9 IP/OpenVZ

Wable, a foreign hosting provider, is characteriz...

HostHatch: $5/month/1GB memory/1.5TB space/2TB traffic/KVM/Los Angeles/Sweden

HostHatch, a long-established hosting provider, h...

HOSTINGandVPS:$30/year/3GB RAM/50GB SSD space/5TB bandwidth/OpenVZ/Canada

HOSTINGandVPS is a British hosting provider that ...

IonSwitch: $17.5/year/512MB memory/5GB SSD space/500GB traffic/KVM/Seattle

IonSwitch is a hosting provider established in Fe...