编译安装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 ...
随机推荐
- css 过渡和 变形
一.过渡(transition) transition-property: 指定具有过渡效果的CSS样式属性名 1.默认值: all 2.仅具有中间值(CSS样式值是数值的)的CSS样式具有过渡效果 ...
- FFT_ad采样速率
调用quartus的ip核测量频率和幅值,可以把程序分成四大部分.第一部分是AD采样模块,本次实验用的是ad828,最高采样率为70M, 根据奈贵斯特采样定律 Fs > 2Fc,即采样率要大于信 ...
- 使用maven搭建环境
今天第一次用maven创建springmvc工程,下载配置都很成功,但用命令行创建项目时遇到一些问题: 1.命令行显示命令不为内部或外部命令: 解决方法:使用管理员模式打开命令行 2. 显示到如下图所 ...
- 起床困难综合症[NOI2014]
[题解] 并不算很困难的贪心题.位运算毕竟是针对每一位的,从前向后处理,如果某一位1比0更优且可取1就使它为1.比较0和1的结果要单取这一位来看,但是题目中所给的参数并没有必要全部二进制分解,直接用十 ...
- React Native 系列(六) -- PropTypes
前言 本系列是基于React Native版本号0.44.3写的.在我们之前的通过props实现组件间传值的时候,大家有没有发现在父组件传递值过去,在子控件获取props的时候没有提示,那么如何能实现 ...
- 微信小程序添加、删除class’
终于等到公司开发小程序了,学习的时候不觉得有什么,实际开发就会出现各种问题. 今天第一天开发就遇到问题了. 项目需求,要一个平时的nav导航栏,这玩意用jQuery两行代码解决了,可是小程序不允许操作 ...
- Andrew Ng机器学习课程笔记(五)之应用机器学习的建议
Andrew Ng机器学习课程笔记(五)之 应用机器学习的建议 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7368472.h ...
- python——字符串 & 正则表达
raw字符串(原始字符串) 所见即所得,例如r''My's\n'' Python转义字符 在需要在字符中使用特殊字符时,python用反斜杠(\)转义字符.如下表: 转义字符 描述 \(在行尾时) 续 ...
- 【leetcode】147. Insertion Sort List
Sort a linked list using insertion sort. 链表的插入排序. 需要创建一个虚拟节点.注意点就是不要节点之间断了. class Solution { public: ...
- 简单选择排序 Selection Sort 和树形选择排序 Tree Selection Sort
选择排序 Selection Sort 选择排序的基本思想是:每一趟在剩余未排序的若干记录中选取关键字最小的(也可以是最大的,本文中均考虑排升序)记录作为有序序列中下一个记录. 如第i趟选择排序就是在 ...


