Redhat快速安装LAMP和WordPress

一、安装环境

[root@lin_haobin ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)

二、基于yum方式安装httpd、php、mariadb

[root@lin_haobin ~]# yum -y install httpd
[root@lin_haobin ~]# yum -y install mariadb-server
[root@lin_haobin ~]# yum -y install php php-mysql

验证安装包

[root@lin_haobin ~]# rpm -qa|grep httpd
httpd-2.4.6-17.el7.x86_64
httpd-tools-2.4.6-17.el7.x86_64

[root@lin_haobin ~]# rpm -qa|grep php
php-pdo-5.4.16-21.el7.x86_64
php-common-5.4.16-21.el7.x86_64
php-mysql-5.4.16-21.el7.x86_64
php-5.4.16-21.el7.x86_64
php-cli-5.4.16-21.el7.x86_64

[root@lin_haobin ~]# rpm -qa|grep maria
mariadb-5.5.35-3.el7.x86_64
mariadb-server-5.5.35-3.el7.x86_64
mariadb-libs-5.5.35-3.el7.x86_64

启动httpd

[root@lin_haobin ~]# systemctl start httpd

验证httpd

[root@lin_haobin ~]# echo “The httpd is running.”>/var/www/html/index.html

在浏览器输入http://localhost 出现下面的页面则说明httpd安装成功
这里写图片描述

启动mariadb

[root@lin_haobin ~]# systemctl start mariadb

验证mariadb

[root@lin_haobin ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.35-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show variables like ‘version’;
+—————+—————-+
| Variable_name | Value |
+—————+—————-+
| version | 5.5.35-MariaDB |
+—————+—————-+
1 row in set (0.01 sec)

MariaDB [(none)]> exit
Bye

测试php

[root@lin_haobin ~]# echo ”
The PHP is running.
?php
phpinfo();
?>
“>/var/www/html/index.php

在浏览器输入http://localhost/index.php出现下面的页面则说明php安装成功

这里写图片描述

三、安装及配置Wordpress

将WordPress上传到服务器

[root@lin_haobin Desktop]# ll
total 9032
-rw-r–r–. 1 root root 9245300 Dec 11 16:04 wordpress-4.7.4-zh_CN.zip

解压WordPress,并解压到/var/www/html/目录下,并配置

[root@lin_haobin Desktop]# unzip -q wordpress-4.7.4-zh_CN.zip -d /var/www/html/
[root@lin_haobin Desktop]# cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
[root@lin_haobin Desktop]# vim /var/www/html/wordpress/wp-config.php
/* WordPress数据库的名称 /
define(‘DB_NAME’, ‘wordpress’);

/* MySQL数据库用户名 /
define(‘DB_USER’, ‘admin’);

/* MySQL数据库密码 /
define(‘DB_PASSWORD’, ‘admin’);

/* MySQL主机 /
define(‘DB_HOST’, ‘localhost’);

/* 创建数据表时默认的文字编码 /
define(‘DB_CHARSET’, ‘utf8’);

/* 数据库整理类型。如不确定请勿更改 /
define(‘DB_COLLATE’, ”);

创建wordpress数据库及用户

[root@lin_haobin Desktop]#mysql
MariaDB [(none)]> create database wordpress character set utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on wordpress.* to ‘admin’@’localhost’ identified by ‘admin’;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

配置wordpress

打开浏览器完成wordpress配置
在浏览器输入http://localhost/wordpress

这里写图片描述

填写信息,点击安装WordPress

这里写图片描述

输入密码,点击登录

这里写图片描述

这里写图片描述

出现上面的页面证明WordPress已经安装完成了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值