1. Install php
To install php 7, you must use the following command to install and enable epel and remi repository on Centos7 system.
Enter the code,
1
|
yum install http:
//rpms.remirepo.net/enterprise/remi-release-7.rpm
|
Next, you need to install yum-utils, which is a useful set of programs for managing yum repository and packages. It is basically a tool extends the default functionality of yum.
It can be used to manage (enable or disable) yum repository package and does not require any manual configuration and so on.
1
|
yum install yum-utils
|
One of the programs provided by yum-utils is yum-config-manager, you can use it to enable remi repository as the default repository to install a different version of PHP, as shown.
1
|
yum-config-manager --enable remi-php73
|
Now with the following command to install php 7 and all the necessary modules.
1
|
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
|
2. Install httpd
1
|
yum install httpd.x86_64
|
Modify the configuration file
Configuration /etc/httpd/conf/httpd.conf
1
|
96
行 ServerName
192.168
.
1.109
:
80
|
3. open port 80
Centos open ports
1
|
# firewall-cmd --zone=
public
--add-port=
80
/tcp --permanent
|
Centos close ports
1
|
# firewall-cmd --zone=
public
--remove-port=
8090
/tcp --permanent
|
Validate the configuration
1
|
# firewall-cmd --reload
|
4. Create a database
Log in MySQL
1
|
mysql -uroot -p
|
Enter at four commands
1
2
3
4
|
CREATE USER
'wordpress'
@
'localhost'
IDENTIFIED BY
'wordpress'
;
CREATE DATABASE IF NOT EXISTS `wordpress`
/*!40100 DEFAULT CHARACTER SET utf8 */
;
GRANT ALL PRIVILEGES ON *.* TO
'wordpress'
@localhost
;
FLUSH PRIVILEGES;
|
5. wordpress to upload / var / www / html
6. Modify wp-config-sample.php file named wp-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define(
'DB_NAME'
,
'数据库名'
);
/** MySQL数据库用户名 */
define(
'DB_USER'
,
'数据库用户名'
);
/** MySQL数据库密码 */
define(
'DB_PASSWORD'
,
'数据库密码'
);
/** MySQL主机 */
define(
'DB_HOST'
,
'localhost'
);
/** 创建数据表时默认的文字编码 */
define(
'DB_CHARSET'
,
'utf8'
);
/** 数据库整理类型。如不确定请勿更改 */
define(
'DB_COLLATE'
,
''
);
|
1. Install php
To install php 7, you must use the following command to install and enable epel and remi repository on Centos7 system.
Enter the code,
1
|
yum install http:
//rpms.remirepo.net/enterprise/remi-release-7.rpm
|
Next, you need to install yum-utils, which is a useful set of programs for managing yum repository and packages. It is basically a tool extends the default functionality of yum.
It can be used to manage (enable or disable) yum repository package and does not require any manual configuration and so on.
1
|
yum install yum-utils
|
One of the programs provided by yum-utils is yum-config-manager, you can use it to enable remi repository as the default repository to install a different version of PHP, as shown.
1
|
yum-config-manager --enable remi-php73
|
Now with the following command to install php 7 and all the necessary modules.
1
|
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
|
2. Install httpd
1
|
yum install httpd.x86_64
|
Modify the configuration file
Configuration /etc/httpd/conf/httpd.conf
1
|
96
行 ServerName
192.168
.
1.109
:
80
|
3. open port 80
Centos open ports
1
|
# firewall-cmd --zone=
public
--add-port=
80
/tcp --permanent
|
Centos close ports
1
|
# firewall-cmd --zone=
public
--remove-port=
8090
/tcp --permanent
|
Validate the configuration
1
|
# firewall-cmd --reload
|
4. Create a database
Log in MySQL
1
|
mysql -uroot -p
|
Enter at four commands
1
2
3
4
|
CREATE USER
'wordpress'
@
'localhost'
IDENTIFIED BY
'wordpress'
;
CREATE DATABASE IF NOT EXISTS `wordpress`
/*!40100 DEFAULT CHARACTER SET utf8 */
;
GRANT ALL PRIVILEGES ON *.* TO
'wordpress'
@localhost
;
FLUSH PRIVILEGES;
|
5. wordpress to upload / var / www / html
6. Modify wp-config-sample.php file named wp-config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define(
'DB_NAME'
,
'数据库名'
);
/** MySQL数据库用户名 */
define(
'DB_USER'
,
'数据库用户名'
);
/** MySQL数据库密码 */
define(
'DB_PASSWORD'
,
'数据库密码'
);
/** MySQL主机 */
define(
'DB_HOST'
,
'localhost'
);
/** 创建数据表时默认的文字编码 */
define(
'DB_CHARSET'
,
'utf8'
);
/** 数据库整理类型。如不确定请勿更改 */
define(
'DB_COLLATE'
,
''
);
|