Redhat快速安装LAMP和WordPress

作者:青山常在人不老   阅读 (2171)  |  收藏 (0)  |  点赞 (0)

摘要

本文讲解了如何在Redhat系统里卖弄安装Wordpress,以及安装Mysql。当然,安装wordpress必须安装PHP环境,就包含httpd


原文链接: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需要输入密码,如果你使用的是密约而不是密码,请参考我的另一篇文章将登陆方式修改成密码:亚马逊linux服务器在使用 SSH 登录到 EC2 实例时,如何启用密码登录而不是使用密钥对? 

验证httpd

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

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

image.png

启动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 "<?php phpinfo(); ?>" > /var/www/html/index.php

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

image.png

三、安装及配置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/目录下,并配置(注意,解压后,此处不配置下面的信息也可以,如果此处不配置,则在首次运行wordpress时自动出现配置此项的页面,我的这篇文章就没有在此处配置)

[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

image.png

填写信息,点击安装WordPress

image.png

由于上面我没有配置数据库信息,因此此处要求我配置数据库信息,按照上面创建的用户名为admin,密码也为admin进行配置,其余不需要修改

提交


输入密码,点击登录


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

分类   默认分组
字数   3003

博客标签    redhat 安装wordpress   linux安装wordpress   wordpress安装   PHP环境安装  

评论