Install LAMP and phpMyAdmin under CentOS7

wangking wrote
LAMP is the abbreviation of Linux+Apache+MySQL+PHP, which is a solution for building a web server. Starting from CENTOS 7, Red Hat recommends using MariaDB instead of MySQL. MariaDB is fully compatible with MYSQL, so in this article we also use MariaDB!

 

1. Before installing LAMP, install EPEL in order to install software other than the source, such as phpMyAdmin and other tools.

yum install epel-release

Tip: EPEL, the Extra Packages for Enterprise Linux, the enterprise version of linux additional package. This software repository has a lot of very commonly used software, and it is specially designed for RHEL. It is a good supplement to the RHEL standard yum source. It is completely free to use and maintained by the Fedora project, so if you are using RHEL, or CentOS , Scientific and other RHEL systems, you can use EPEL's yum source with confidence. 

 

2. Install Apache

a) yum install httpd 
b) systemctl start httpd #Start Apache 
c) systemctl enable httpd #Set startup

 3. Install MYSQL (MariaDB)

a) yum install mariadb-server mariadb
b) systemctl start mariadb #start mariadb
c) systemctl enable mariadb #set startup

 4. Set MariaDB password

mysql_secure_installation # will ask to enter the original password, just click Enter, the rest is to enter the new password and confirm the password

5. Install PHP

yum install -y php php-fpm php-mysql php-common php-devel php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel

 

6. Install phpMyAdmin

a) yum install phpmyadmin
b) vim /etc/httpd/conf.d/phpMyAdmin.conf #You can modify the point of Alias ​​in it.
c) chmod -R777 /var/lib/php/session #Modify session permissions so that phpmyadmin can access. This path is different for different system paths. You can find session.save_path in phpinfo() 

#Visit http://youipaddress/phpmyadmin, if you can access it, then you are successful!

 

7. Modify the Apache configuration (domain name binding, if you do not need a domain name, it is only for testing purposes, you can skip it...)

vim /etc/httpd/conf.d/vhost.conf 
//其实完全可以直接修改/etc/httpd/conf/httpd.conf文件,在最后一行来进行新增配置,但是为了不影响主配置,我们还是在/conf.d/文件夹下新增一个vhost.conf文件。
#如果有多个域名绑定,则新增多个VirtualHost,只有一个,则只需要填写一个VirtualHost

ServerName localhost
<VirtualHost *:80>

      ServerName www.4jcms.com
      DocumentRoot /var/www/html

</VirtualHost>

<VirtualHost *:80>

      ServerName up.4jcms.com
      DocumentRoot /var/www/html/uploads

</VirtualHost>

<VirtualHost *:80>

      ServerName res.4jcms.com
      DocumentRoot /var/www/html/resource

</VirtualHost>

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326690980&siteId=291194637