编译安装LAMP并实现wordpress
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/
相关内容
编译安装LAMP并实现wordpress的更多相关文章
- ubuntu10.04编译安装LAMP
ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关 ...
- CentOS 6编译安装lamp,并分别安装event模块方式和FPM方式的PHP
任务目标: 编译安装LAMP 要求(1) 安装一个模块化的PHP 要求(2) 安装一个FPM的PHP 注意PHP需要最后一个安装,因为需要前两者的支持. 所以这里的安装次序为 1.httpd 2.Ma ...
- CentOS6.3 编译安装LAMP(1):准备工作
卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...
- 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 ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6
Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...
- 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 ...
- 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. ...
- 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. ...
- Linux下指定版本编译安装LAMP
说明: 操作系统:CentOS 6.5 64位 需求: 编译安装LAMP运行环境 各软件版本如下: MySQL:mysql-5.1.73 Apache:httpd-2.2.31 PHP:php-5.2 ...
随机推荐
- Android 性能测试——Heap Viewer 工具
Android 性能测试--Heap Viewer 工具 Heap Viewer能做什么? 实时查看App分配的内存大小和空闲内存大小 发现Memory Leaks Heap Viewer使用条件 5 ...
- java对Microsoft Document的操作--->对Excel的操作
起初,自己想对网站上爬取一些数据来写到Excel表格中,便在网上找了找java操作Excel接口,了解到Apache的POI接口可以对微软的文档进行操作,WIKI搜索的结果如下, HSSF - 提供读 ...
- storm从入门到放弃(一),storm介绍
背景:目前就职于国内最大的IT咨询公司,恰巧又是毕业季,所在部门招了100多个应届毕业生,本人要跟部门新人进行为期一个月的大数据入职培训,特此将整理的文档分享出来. 原文和作者一起讨论:http:// ...
- centos中安装mysql
一.首先输入指令 rpm -qa|grep mysql 检查操作系统中是否已经安装了MySQL 可以通过 yum list | grep mysql 命令来查看yum上提供的mysql数据库可下载的版 ...
- 拓扑排序 topsort详解
1.定义 对一个有向无环图G进行拓扑排序,是将G中所有顶点排成一个线性序列,通常,这样的线性序列称为满足拓扑次序(Topological Order)的序列,简称拓扑序列. 举例: h3 { marg ...
- Unity 发布的 WebGL 使用SendMessage传递多个参数
如果要实现Unity与浏览器的数据交互一般都会采用两种方式 方法一: Application.ExternalCall("SayHello","helloworld&qu ...
- Linux下栈溢出导致的core dump
1 问题产生 前两天在干活的时候,写好的一个daemon程序,一跑就core,连main函数都进不去.从来没见过这阵势的职场新人被吓尿了,幸好不是在生产环境上测试.找来同事帮忙,看了好久也没看出问题, ...
- [bzoj 1409] Password 矩阵快速幂+欧拉函数
考试的时候想到了矩阵快速幂+快速幂,但是忘(bu)了(hui)欧拉定理. 然后gg了35分. 题目显而易见,让求一个数的幂,幂是斐波那契数列里的一项,考虑到斐波那契也很大,所以我们就需要欧拉定理了 p ...
- python基础===Python 代码优化常见技巧
Python 代码优化常见技巧 代码优化能够让程序运行更快,它是在不改变程序运行结果的情况下使得程序的运行效率更高,根据 80/20 原则,实现程序的重构.优化.扩展以及文档相关的事情通常需要消耗 8 ...
- java自旋锁
一 Test-and-Set Lock 所谓测试设置是最基本的锁,每个线程共用一把锁,进入临界区之前看没有有线程在临界区,如果没有,则进入,并上锁,如果有则等待.java实践中利用了原子的设置stat ...


