博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
编译安装LAMP并实现wordpress
阅读量:4710 次
发布时间:2019-06-10

本文共 8628 字,大约阅读时间需要 28 分钟。

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.31httpd下载 http://httpd.apache.org/download.cgiwordpress下载 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]# lsapr-1.5.2.tar.bz2       mariadb-10.2.7-linux-x86_64.tar.gz  xcache-3.2.0.tar.gzapr-util-1.5.4.tar.bz2  php-7.1.7.tar.bz2httpd-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 -dapr-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 apacheapache: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               testaria_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 \\不解析名称

image

[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 \\初始化数据库

image

image

[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    
\\320行 DirectoryIndex index.php index.html
[root@danran apache24]# apachectl stop [root@danran apache24]# apachectl startAH00558: 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主页文件,测试连接本地数据库是否成功        
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/phpThe php-devel package is required for use of this command.[root@danran xcache-3.2.0]# phpize \\生成configure文件Configuring for:PHP Api Version:         20100412Zend Module Api No:      20100525Zend 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/

转载于:https://www.cnblogs.com/JevonWei/p/7300002.html

你可能感兴趣的文章
How to: Cancel a Task and Its Children
查看>>
VS2013 F12无法转到函数的定义处,总是从“元数据”获取的问题 ——解决方法...
查看>>
Cookie
查看>>
Python列表list对象方法总结
查看>>
Codeforces 1172A Nauuo and Cards
查看>>
1001种玩法 | Tryton:一个通用商务框架
查看>>
[BZOJ2151]种树
查看>>
怎样查看端口占用情况
查看>>
halcon 数字转字符串实现循环读取图片
查看>>
js 字面量 与 数组
查看>>
自用drupal 扩展汇总 及注意事项
查看>>
pch文件中调试模式的使用
查看>>
配置CentOS的静态IP
查看>>
什么是ValidationQuery?
查看>>
lunix的查看Tomcat目录下日志的快速操作
查看>>
DFS之全排列
查看>>
Process使用
查看>>
Win7旗舰版一直显示检查更新的问题
查看>>
@AspectJ 语法概要
查看>>
pre 标签的使用注意事项
查看>>