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. MySQL_第三方数据库引擎_tokudb

    前阵子迁移zabbix到tokudb,整理部分操作笔记到这篇博文.       如果转载,请注明博文来源: www.cnblogs.com/xinysu/   ,版权归 博客园 苏家小萝卜 所有.望各 ...

  2. Android学习笔记-Button(按钮)

    Button是TextView的子类,所以TextView上很多属性也可以应用到Button 上!我们实际开发中对于Button的,无非是对按钮的几个状态做相应的操作,比如:按钮按下的时候 用一种颜色 ...

  3. MySQL优化 - 性能分析与查询优化

    优化应贯穿整个产品开发周期中,比如编写复杂SQL时查看执行计划,安装MySQL服务器时尽量合理配置(见过太多完全使用默认配置安装的情况),根据应用负载选择合理的硬件配置等. 1.性能分析 性能分析包含 ...

  4. 【RegExp】JavaScript中正则表达式判断匹配规则以及常用方法

    字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求几乎无处不在. 正则表达式是一种用来匹配字符串的强有力的武器.它的设计思想是用一种描述性的语言来给字符串定义一个规则,凡是符合规则的字符 ...

  5. Java基础之TCP与UDP

    OSI 7层参考模型 物理层 --> 数据链路层 --> 网络层 --> 传输层 --> 会话层 --> 表示层 --> 应用层 按此顺序称为拆包,反之为封包. T ...

  6. MATLAB的神经网络工具箱介绍

    一.使用matlab2010b以后的版本会有完整的神经网络工具箱,使用nnstart可以调出toolbox,然后选择需要的功能,导入数据,选择训练参数和每层神经元个数,最后训练会输出网络与结果. 二. ...

  7. 微信小程序开发

    一.基本的准备工作 1.工具安装 工具是有微信官方提供. 2.下载地址: windows32位:https://servicewechat.com/wxa-dev-logic/download_red ...

  8. 【python密码学编程】5.反转加密法

    #Reverse Cipher message = 'there can keep a secret,if two of them are dead.' translated = '' i = len ...

  9. JUnit4在Eclipse中的使用

    测试是项目开发中很重要的一环.实际上,建议的项目前期编写过程是:构思-> 编写单元测试代码-> 编写接口->编写实现类-> 测试实现类->编写主类....JUnit是一个 ...

  10. hibernate中对象的3种状态----瞬时态、持久态、脱管态

    Hibernate的对象有3种状态,分别为:瞬时态(Transient). 持久态(Persistent).脱管态(Detached).处于持久态的对象也称为PO(Persistence Object ...