CENTOS7 deployment Lamp phpMyAdmin, WordPress, Discuz

Source: Internet
Author: User
Tags install wordpress

Use Yum in CentOS7 to install httpd, mariadb, and PHP. And the deployment of phpMyAdmin, WordPress, discuz these three services.

The virtual host name is:

pma.lcs.com, installing phpMyAdmin

wp.lcs.com, install WordPress

dz.lcs.com, installing Discuz

HTTPD, mariadb server host IP address is 172.16.125.128,DNS server IP address is 172.16.125.125, the host IP address used for the test is 172.16.125.129.


installation Detailed steps :

First step : Install httpd;

[email protected] pma]# Yum install httpd

Step two : Install mariadb;

[email protected] pma]# Yum install mariadb-server mariadb

Step three : Install PHP and php-mysql;

[[email protected] pma]# Yum install php php-mysql

Fourth step: After the installation is complete, start the services and test them.

[[email protected] pma]# systemctl restart Httpd.service[[email protected] pma]# systemctl restart Mariadb.service

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/0D/wKiom1YQ0H-Dm0iZAAD8bnmorw4953.jpg "title=" 1.png " alt= "Wkiom1yq0h-dm0izaad8bnmorw4953.jpg"/>


To perform a service test:

Edit the/etc/httpd/conf/httpd.conf configuration file and add the following:

AddType application/x-httpd-php. Phpaddtype application/x-httpd-php-source. Phpsdirectoryindex index.php index.html

Under the/var/www/html/directory, create a index.php file that reads as follows:

<?php $link = mysql_connect ("localhost", "root", "");       if ($link) echo "OK";       else echo "Failure";       Mysql_close ();    Phpinfo (); ?>

Test results such as:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/0A/wKioL1YQ07CzFruAAAC3yBfJO8k669.jpg "title=" 2.png " alt= "Wkiol1yq07czfruaaac3ybfjo8k669.jpg"/>


To Create a virtual host :

1. Create a virtual host for installation phpMyAdmin, the host name is pma.lcs.com.

(1) First comment out the central host (in the/etc/httpd/conf/httpd.conf file);

Comment out this line documentroot "/var/www/html";

(2) Create a configuration file vhosts.conf for the virtual host under/etc/httpd/conf.d/this directory.

<virtualhost 172.16.125.128:80>         documentroot  /web/vhosts/pma                  ServerName pma.lcs.com                  ErrorLog /var/log/httpd/pmalog.err                  customlog /var/log/httpd/ pmalog.access common                  <Directory  "/WEB/VHOSTS/PMA" >                          options  None                          allowoverride none                          require all denied                           Require ip 172.16.0.0/255.255.0.0                  </directory></ Virtualhost>

(3) Add a record to the forward parsing library file on the DNS server host:

Pma.lcs.com. In A 172.16.125.128

Add nameserver 172.16.125.125 to the DNS server host's/etc/resolv.conf configuration file.

Add a pointing address to the DNS server in the network configuration file of the test host's/etc/sysconfig/network-scripts/ifcfg-eth0.

dns1=172.16.125.125

Test whether the virtual host can be parsed correctly:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/0B/wKioL1YQ2GLB6XoVAAECCQwI1EY304.jpg "title=" 3.png " alt= "Wkiol1yq2glb6xovaaeccqwi1ey304.jpg"/>

(4) Configure the local Yum source to install the php-mbstring package.

[email protected] pma]# Yum install php-mbstring

(5) Set the login password for the root user of mariadb

MariaDB [(None)]> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Linux '); MariaDB [(None)]> SET PASSWORD for ' root ' @ ' 127.0.0.1 ' = PASSWORD (' Linux ');

(6) Download the phpMyAdmin installation package, unzip it, and copy it to the site directory.

[Email protected] pma]# unzip Phpmyadmin-4.4.5-all-languages.zip[[email protected] pma]# cp-a Phpmyadmin-4.4.5-all-languages/web/vhosts/pma/pma

(7) Perform the test as shown in.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/0B/wKioL1YQ2frT6nBBAAEYwEgSjNU594.jpg "title=" 4.png " alt= "Wkiol1yq2frt6nbbaaeywegsjnu594.jpg"/>



2, configure the virtual host for WordPress.

(1) Add the following in the configuration file vhosts.conf of the virtual host in/etc/httpd/conf.d/this directory:

<virtualhost 172.16.125.128:80>         documentroot  /web/vhosts/wp         ServerName wp.lcs.com          ErrorLog /var/log/httpd/wplog.err          CustomLog /var/log/httpd/wp.access common          <Directory  "/web/vhosts/wp" >                  Options None                  AllowOverride None                  Require  all denied                  require ip 172.16.0.0/16                                             </Directory></VirtualHost>

(2) Add a record to the DNS server's forward parsing library file:

Wp.lcs.com. In A 172.16.125.128

(3) test the virtual host wp.lcs.com can be correctly resolved:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/0B/wKioL1YQ4cuxPqP8AAHF8w3J7jY182.jpg "title=" 5.png " alt= "Wkiol1yq4cuxpqp8aahf8w3j7jy182.jpg"/>

(4) Build WordPress.

[[email protected] ~]# unzip Wordpress-4.3.1-zh_cn.zip[[email protected] ~]# cp-a Wordpress/web/vhosts/wp/wp[[email Pro Tected] wp]# pwd/web/vhosts/wp/wp[[email protected] wp]# mv wp-config-sample.php wp-config.php [[email protected] wp]# VI M wp-config.php

Modify the following in the wp-config.php configuration file:

Define (' db_name ', ' wpdb '); /** MySQL Database username */define (' Db_user ', ' wpuser '); /** MySQL Database Password */define (' Db_password ', ' wpuser ');

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/0E/wKiom1YQ4vrwJCXLAACD54G2svc857.jpg "title=" 6.png " alt= "Wkiom1yq4vrwjcxlaacd54g2svc857.jpg"/>

(5) Create the database as shown, as well as the corresponding user name and password, for the user Wpuser authorization to the database wpdb have full permissions.

MariaDB [(None)]> CREATE Database wpdb; Query OK, 1 row Affected (0.00 sec) MariaDB [(none)]> CREATE USER ' wpuser ' @ ' localhost ' identified by ' wpuser '; Query OK, 0 rows affected (0.03 sec) MariaDB [(none)]> CREATE USER ' wpuser ' @ ' l27.0.0.1 ' identified by ' wpuser '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(none)]> GRANT all on wpdb.* to ' wpuser ' @ ' localhost '; Query OK, 0 rows affected (0.02 sec) MariaDB [(none)]> GRANT all on wpdb.* to ' wpuser ' @ ' 127.0.0.1 '; Query OK, 0 rows affected (0.01 sec)

Pass the above steps to test. The first time you log in to this address, you will need to install it.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/0E/wKiom1YQ5HKA017AAAElFewIXnQ991.jpg "title=" 7.png " alt= "Wkiom1yq5hka017aaaelfewixnq991.jpg"/>


3. Configure the virtual host for Discuz .

(1) Add the following in the configuration file vhosts.conf of the virtual host in/etc/httpd/conf.d/this directory:

<VirtualHost 172.16.125.128:80>       DocumentRoot  "/web/ Vhosts/dz "       ServerName dz.lcs.com        errorlog /var/log/httpd/dzlog.err       customlog / var/log/httpd/dz.access common       <directory  "/web/vhosts/ DZ ">                   Options None                   AllowOverride None                   Require all denied                   require ip 172.16.0.0/ 16    &nBsp;  </directory></virtualhost> 

(2) Add a record to the DNS server's forward parsing library file:

Dz.lcs.com. In A 172.16.125.128

Test to see if the virtual hostname can be parsed correctly:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/0B/wKioL1YQ72jiqzJrAAFtLiZuq80458.jpg "title=" 9.png " alt= "Wkiol1yq72jiqzjraaftlizuq80458.jpg"/>

(3) Download the decompression Discuz_x3.2_tc_utf8.zip, there will be three files readme, upload, utility. Copy the upload to/web/vhosts/dz/dz.

[[email protected] ~]# unzip Discuz_x3.2_tc_utf8.zip[[email protected] ~]# ls[[email protected] ~]# cp-a Upload/web/vhos Ts/dz/dz

Modify the permissions of the/web/vhosts/dz/dz file under this folder.

[Email protected] dz]# pwd/web/vhosts/dz[[email protected] dz]# chmod-r 777 dz/*

(4) Start installing discuz and create the relevant database.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/0E/wKiom1YQ8dCzcP3pAAG3eC6nMA8996.jpg "title=" 2.png " alt= "Wkiom1yq8dczcp3paag3ec6nma8996.jpg"/>

To create the required database:

MariaDB [(None)]> CREATE DATABASE Forumdb; Query OK, 1 row Affected (0.00 sec) MariaDB [(none)]> CREATE USER ' forumuser ' @ ' localhost ' identified by ' forumuser '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(none)]> CREATE USER ' forumuser ' @ ' 127.0.0.1 ' identified by ' forumuser '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(none)]> GRANT all on forumdb.* to ' forumuser ' @ ' localhost '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(none)]> GRANT all on forumdb.* to ' forumuser ' @ ' 127.0.0.1 '; Query OK, 0 rows Affected (0.00 sec)

(5) Follow the operation, step by step to install, OK.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/0E/wKiom1YQ9Y_jRJ80AAHP4WTI1Ts225.jpg "title=" 3.png " alt= "Wkiom1yq9y_jrj80aahp4wti1ts225.jpg"/>

To log in, enter the administrator's account number and password to log in.

This article is from "angry, bird" blog, please make sure to keep this source http://angrybird.blog.51cto.com/10503706/1700139

CENTOS7 deployment Lamp phpMyAdmin, WordPress, Discuz

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.