author:JevonWei

版权声明:原创作品


软件环境

centos7.3
apr-1.5.2.tar.bz2
apr-util-1.5.4.tar.bz2
httpd-2.4.27.tar.bz2
mariadb-10.2.7-linux-x86_64.tar.gz
php-7.1.7.tar.bz2
wordpress-4.8-zh_CN.tar.gz
xcache-3.2.0.tar.gz

下载源码包到系统下/usr/local/src目录

PHP下载地址 http://us3.php.net/downloads.php#v5.6.31
httpd下载 http://httpd.apache.org/download.cgi
wordpress下载 https://cn.wordpress.org/
mariadb下载 https://downloads.mariadb.org/mariadb/5.5.57/
ARP及ARP-util下载 http://httpd.apache.org/download.cgi#apache2.4 [danran@danran ~]$ yum -y groupinstall "Development Tools"
[root@danran ~]# setenforce 0
[root@danran ~]# iptables -F
[root@danran src]# ls
apr-1.5.2.tar.bz2 mariadb-10.2.7-linux-x86_64.tar.gz xcache-3.2.0.tar.gz
apr-util-1.5.4.tar.bz2 php-7.1.7.tar.bz2
httpd-2.4.27.tar.bz2 wordpress-4.8-zh_CN.tar.gz

编译apache

解压源码包文件

[root@danran src]# cd /usr/local/src
[root@danran src]# tar xf apr-1.5.2.tar.bz2
[root@danran src]# tar xf apr-util-1.5.4.tar.bz2
[root@danran src]# tar xf httpd-2.4.27.tar.bz2
[root@danran src]# ls apr-1.5.2 apr-util-1.5.4 httpd-2.4.27
[root@danran src]# ls apr-1.5.2 apr-util-1.5.4 httpd-2.4.27 -d
apr-1.5.2 apr-util-1.5.4 httpd-2.4.27

编译apr、apr-util、httpd

[root@danran src]# mv apr-1.5.2 httpd-2.4.27/srclib/apr
[root@danran src]# mv apr-util-1.5.4 httpd-2.4.27/srclib/apr-util
[root@danran src]# cd httpd-2.4.27/
[root@danran httpd-2.4.27]# ls srclib/
apr apr-util Makefile.in
[root@danran httpd-2.4.27]# ./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
[root@danran httpd-2.4.27]# make && make install
[root@danran src]# vim \\将httpd的路径和mysql路径添加到全局变量中 /etc/profile.d/apache24.sh
export PATH=/usr/local/apache24/bin:/usr/local/mysql/bin:$PATH
[root@danran src]# . /etc/profile.d/apache24.sh
[root@danran src]# echo $PATH
/usr/local/apache24/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@danran httpd-2.4.27]# apachectl start
[root@danran httpd-2.4.27]# ss -ntl
[root@danran local]# useradd -r apache -s /sbin/nologin -d /usr/local/httpd -m \\添加apache系统账号,家目录为/usr/local/httpd
[root@danran local]# getent passwd apache
apache:x:987:982::/usr/local/httpd:/sbin/nologin

编译二进制mariadb

[root@danran local]# rpm -qa "*mariadb*"
mariadb-libs-5.5.52-1.el7.x86_64
[root@danran local]# yum remove mariadb-libs.x86_64 \\将系统中原有的mariadb先删除,然后在编译安装
[root@danran local]# cd /usr/local/src
[root@danran src]# tar xf mariadb-10.2.7-linux-x86_64.tar.gz -C /usr/local/ \\解压到/usr/local目录下
4/
[root@danran src]# cd /usr/local/
[root@danran local]# ll -d mariadb-10.2.7-linux-x86_64/
drwxrwxr-x. 12 1021 1004 4096 Jul 12 03:15 mariadb-10.2.7-linux-x86_64/
[root@danran local]# ln -s mariadb-10.2.7-linux-x86_64/ mysql
[root@danran local]# ll -d mysql mariadb-10.2.7-linux-x86_64/
drwxrwxr-x. 12 1021 1004 4096 Jul 12 03:15 mariadb-10.2.7-linux-x86_64/
lrwxrwxrwx. 1 root root 28 Aug 7 10:23 mysql -> mariadb-10.2.7-linux-x86_64/
[root@danran local]# useradd -r mysql -s /sbin/nologin -d /usr/local/mysqldb -m \\创建apache系统账号
[root@danran local]# cd mysql
[root@danran mysql]# scripts/mysql_install_db --datadir=/usr/local/mysqldb --user=mysql \\创建数据库文件
[root@danran mysql]# ls /usr/local/mysqldb/
aria_log.00000001 ib_buffer_pool ib_logfile0 mysql test
aria_log_control ibdata1 ib_logfile1 performance_schema
[root@danran mysql]# ll -d /usr/local/mysqldb/
drwx------. 6 mysql mysql 253 Aug 7 10:30 /usr/local/mysqldb/
[root@danran mysql]# mkdir /etc/mysql
[root@danran mysql]# cp support-files/my-huge.cnf /etc/mysql/my.cnf \\复制mariadb的模板配置文件
[root@danran mysql]# vim /etc/mysql/my.cnf
[mysqld]加三行
datadir =/usr.local/mysqldb \\指定数据库文件
innodb_file_per_table = ON \\每个数据库都有单独的文件
skip_name_resolve = ON \\不解析名称

[root@danran mysql]# cp support-files/mysql.server  /etc/init.d/mysqld \\复制服务文件到/etc/init.d/mysqld
[root@danran mysql]# chkconfig --add mysqld \\将服务添加到chkconfig管理中
[root@danran mysql]# service mysqld start \\启动数据库
[root@danran mysql]# vim /etc/profile.d/app.sh
export PATH=/usr/local/mysql/bin:/usr/local/apache24/bin:$PATH
[root@danran mysql]# mysql_secure_installation \\初始化数据库



[root@danran mysql]# mysql -uroot -p  \\登录数据库
Enter password:
MariaDB [(none)]> create database blogdb; \\创建blogdb数据库
MariaDB [(none)]> grant all on blogdb.* to wpuser@'192.168.198.%' identified by "danran"; \\新建wpuser@192.168.198.%用户,密码为"danran",并授予blog数据库内的所有权限
MariaDB [(none)]> quit \\退出数据库
[root@danran mysql]# mysql -uwpuser -h192.168.198.136 -pdanran \\登录数据库
MariaDB [(none)]> use blogdb;\\切换为blogdb数据库
MariaDB [blogdb]> quit

编译PHP(7.1.7版本)

[root@danran mysql]# cd /usr/local/src/
[root@danran src]# tar xf php-7.1.7.tar.bz2
编译php-7.1.7版本
[root@danran php-7.1.7]# ./configure --prefix=/usr/local/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24//bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2
编译php-5.4
[root@danran php-5.4]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 根据错误提示依次安装相应的程序开发包
[root@danran local]# yum -y install libxml2-devel bzip2-devel libmcrypt-devel \\安装相应软件包,需要用到epel安装源,libmcrypt-devel软件包来自epel源
[root@danran php-7.1.7]# ./configure --prefix=/usr/local/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24//bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 \\执行编译
[root@danran php-7.1.7]# make && make install
[root@danran php-7.1.7]# cp php.ini-production /etc/php.ini \\复制PHP的配置文件
[root@danran apache24]# vim /etc/httpd24/httpd.conf
AddType application/x-httpd-php .php \\398行
AddType application/x-httpd-php-source .phps <IfModule dir_module> \\320行
DirectoryIndex index.php index.html
</IfModule>
[root@danran apache24]# apachectl stop
[root@danran apache24]# apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using danran.com. Set the 'ServerName' directive globally to suppress this message
[root@danran apache24]# ss -ntl

测试

[root@danran apache24]# vim /usr/local/apache24/htdocs/index.php \\编辑php主页文件,测试连接本地数据库是否成功

    <?php
$mysqli=new mysqli("127.0.0.1","root","danran");
if(mysqli_connect_errno()){
echo "连接数据库失败!";
$mysqli=null;
exit;
}
echo "连接数据库成功!";
$mysqli->close();
?>

编译安装xcache

[root@danran src]# tar xvf xcache-3.2.0.tar.gz
[root@danran src]# cd xcache-3.2.0
[root@danran xcache-3.2.0]# phpize \\生成configure文件
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
[root@danran xcache-3.2.0]# phpize \\生成configure文件
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@danran xcache-3.2.0]# ll configure
-rwxr-xr-x. 1 root root 414469 Aug 4 20:14 configure
[root@danran xcache-3.2.0]# ./configure --enable-xcache --with-php-config=/usr/bin/php-config
[root@danran xcache-3.2.0]# make && make install \\默认安装在/usr/lib64/php/mpdules下
[root@danran xcache-3.2.0]# cp /root/xcache-3.2.0/xcache.ini /etc/php.d/ \\复制配置文件到/etc/目录下
[root@danran xcache-3.2.0]# systemctl restart httpd

安装wordpress

[root@danran apache24]# cd /usr/local/src/
[root@danran src]# tar xf wordpress-4.8-zh_CN.tar.gz
[root@danran src]# mv wordpress /usr/local/apache24/htdocs/blog
[root@danran src]# cd /usr/local/apache24/htdocs/blog/
[root@danran blog]# cp wp-config-sample.php wp-config.php \\复制PHP连接数据库的配置文件 [root@danran htdocs]# setfacl -m u:daemon:rwx blog/

[root@danran blog]# vim wp-config.php // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'blogdb'); /** MySQL数据库用户名 */
define('DB_USER', 'wpuser'); /** MySQL数据库密码 */
define('DB_PASSWORD', 'danran'); /** MySQL主机 */
define('DB_HOST', 'localhost'); /** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8'); /** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', ''); /**#@+
* 身份认证密钥与盐。

登录wordpress

http://172.16.253.108/blog/

相关内容

http://119.23.52.191/lamp/

编译安装LAMP并实现wordpress的更多相关文章

  1. ubuntu10.04编译安装LAMP

    ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关 ...

  2. CentOS 6编译安装lamp,并分别安装event模块方式和FPM方式的PHP

    任务目标: 编译安装LAMP 要求(1) 安装一个模块化的PHP 要求(2) 安装一个FPM的PHP 注意PHP需要最后一个安装,因为需要前两者的支持. 所以这里的安装次序为 1.httpd 2.Ma ...

  3. CentOS6.3 编译安装LAMP(1):准备工作

    卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...

  4. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

    所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...

  5. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6

    Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...

  6. CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25

    所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...

  7. CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17

    所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar. ...

  8. CentOS6.3 编译安装LAMP(4):编译安装 PHP5.3.27

    所需源码包: /usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar. ...

  9. Linux下指定版本编译安装LAMP

    说明: 操作系统:CentOS 6.5 64位 需求: 编译安装LAMP运行环境 各软件版本如下: MySQL:mysql-5.1.73 Apache:httpd-2.2.31 PHP:php-5.2 ...

随机推荐

  1. echarts3.0使用总结

    echarts的使用和例子传送门 1.安装echarts npm install echarts --save 这里配置好了,直接输入 npm install //下载插件 npm start //运 ...

  2. proxifier配合ss,实现全局代理

    proxfixer配合ss的话,基本可以实现全局代理,分应用代理,或者玩外服的游戏(一般的游戏默认不走代理,本软件可以强制应用代理)      由于ss使用的是sockets5代理,一般情况下只有浏览 ...

  3. 安徽省2016“京胜杯”程序设计大赛_H_单身晚会

    单身晚会 Time Limit: 1000 MS Memory Limit: 65536 KB Total Submissions: 53 Accepted: 16 Description ​ZJ和Z ...

  4. [技术] OIer的C++标准库 : 字符串库<string>

    引入 上次我在博客里介绍了OI中可能用到的STL中的功能, 今天我们接着来发掘C++标准库中能为OI所用的部分. 众所周知, OI中经常用到字符串相关的处理, 这时善用字符串库可以使一些操作更加简洁易 ...

  5. Aleta病毒

    文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份!!! 文件一定要及时备份 ...

  6. 【机器学习笔记之五】用ARIMA模型做需求预测用ARIMA模型做需求预测

    本文结构: 时间序列分析? 什么是ARIMA? ARIMA数学模型? input,output 是什么? 怎么用?-代码实例 常见问题? 时间序列分析? 时间序列,就是按时间顺序排列的,随时间变化的数 ...

  7. 不安分的this

    不安分的this 前言:关于javascript中的this,上网一搜一大片的文章.惊! 而我个人认为要想分清this,就有必要先搞清楚“对象”. 目录: 一.函数对象的认识 二.this 一.函数对 ...

  8. 关于HTML应用中的实操细节

    在编写HTML程序时,初阶段在打编码时容易忽视语法方面的问题,如大小写,中英文切换标点等.正常在编码时出现语法问题自己很难发现,所以刚开始练习特别要注重语法方面的规范,另外在编码时要有规范的书写方式, ...

  9. javascript面向对象属性函数用法(defineProperty与getOwnPropertyDescriptor)

    defineProperty用于设置一个对象的属性描述符,属性描述符有4个:[[Configurable]], [[Enumerable]], [[Writable]],[[Value]] 当一个属性 ...

  10. C/C++ 知识点---LIB和DLL的区别与使用(网摘)

    LIB和DLL的区别与使用 原文出处:[远风工作室] 共有两种库:一种是LIB包含了函数所在的DLL文件和文件中函数位置的信息(入口),代码由运行时加载在进程空间中的DLL提供,称为动态链接库dyna ...