wordpress部署
2019-06-11-WordPress
redhat系统
软件版本:
1 | |
安装依赖:
1 | |
1. 部署软件:
1.1 RPM安装Mysql:
在安装之前, 首先要查看的是, 系统中有没有已经安装过的情况, 键入
rpm -qa|grep mysql, 如果无任何显示,则表示没有安装过相关组件, 如果有, 则根据显示出来的名字, 键入rpm -e --nodeps XXXX(星号为你要删除的文件名字), 接着键入rpm -qa|grep mariadb, rpm 删除时如果有依赖关系, 可以用yum remove XXXX; 同样的步骤, 把出现的文件删除; 两步都完成后, 可以开始安装所需要的包了
1 | |
依次安装, 各包之间有依赖关系
1 | |
- 数据库目录:
1
/var/lib/mysql/ - 配置文件:
1
/usr/share/mysql #(mysql.server命令及配置文件) - 相关命令:
1
/usr/bin # (mysqladmin mysqldump等命令) - 启动脚本:
1
2
3
4
5
6
7/etc/rc.d/init.d/ # (启动脚本文件mysql的目录)
$ vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
...
skip-grant-tables # 添加
1.2 二进制安装Mysql:
1 | |
1.3 源码编译安装Mysql:
- 安装boost(若只是安装mysql, 不用安装, 编译引用解包路径即可)
1 | |
接下来配置如二进制安装方法
关于Mysql: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements解决方法:
1 | |
1.4 安装Apache:
安装依赖:
pcre
1
2
3tar -xzvf pcre-8.43.tar.gz
./configure --prefix=/usr/local/pcre
`make && make installapr
1
2
3tar -xzvf apr-1.7.0.tar.gz
./configure --prefix=/usr/local/apr
make && make installapr-util
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21$ tar -xzvf apr-util-1.6.1.tar.gz
$ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
$ useradd www -s /sbin/nologin
$ ./configure --prefix=/usr/local/apache24 \
--with-mysql=/usr/local/mysql \
--with-pcre=/usr/local/pcre \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-openssl=/usr/local/openssl \
--with-zlib=/usr/local/zlib \
--with-mpm=prefork \
--enable-modules=most \
--enable-rewrite \
--enable-shared=max \
--enable-so \
--enable-mpms-shared=all \
--enable-ssl \
--enable-cgi \
--enable-mpms-shared=all自启动脚本配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41/usr/local/apache/bin
vim httpd # 编辑自启动脚本
#!/bin/bash
# chkconfig:2345 80 90
# description:Apache httpd
function start_http()
{
/usr/local/apache24/bin/apachectl start
}
function stop_http()
{
/usr/local/apache24/bin/apachectl stop
}
case "$1" in
start)
start_http
;;
stop)
stop_http
;;
restart)
stop_http
start_http
;;
*)
echo "Usage : start | stop | restart"
;;
esac
$ chmod a+x httpd
$ cp -frp ./httpd /etc/init.d # -f强制合并, 不询问 -r递归合并 -p保持文件属性不变
$ systemctl daemon-reload
$ systemctl start httpd
$ chkconfig --add httpd # 设置开机自启
$ vim ./apache24/conf/httpd.conf
164 User deamon -->User www
165 Group deamon -->Group www
196 #ServerName www.example.com:80 -->ServerName localhost:80
$ firewall-cmd --permanent --add-service=http
$ firewall-cmd --permanent --add-service=http
$ firewall-cmd --reload测试: 192.168.10.130 –>It Works!
问题1:
- 服务不支持chkconfig的解决?
- 解决方法:
1
2
3
4httpd 脚本的开头要这样加:
#!/bin/bash
#chkconfig:345 61 61 # 此行的345参数表示, 在哪些运行级别启动
#description:Apache httpd # 此行必写,描述服务.
level<等级代号> 指定读系统服务要在哪一个执行等级中开启或关毕。
1
2
3
4
5
6
7#等级0表示:表示关机
#等级1表示:单用户模式
#等级2表示:无网络连接的多用户命令行模式
#等级3表示:有网络连接的多用户命令行模式
#等级4表示:不可用
#等级5表示:带图形界面的多用户模式
#等级6表示:重新启动
1.5 安装PHP7(http://pecl.php.net):
-
1
2
3
4
5
6$ wget wget https://nih.at/libzip/libzip-1.2.0.tar.gz
$ tar -xzvf libzip-1.2.0.tar.gz
$ cd libzip-1.2.0/
$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/libzip
$ make && make install 问题1:
- off_t undefined?
- 解决方法:
1
2
3
4
5
6$ export LD_LIBRARY_PATH=/usr/local/libgd/lib
$ echo '/usr/local/lib64 # error: off_t undefined;
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf
$ ldconfig -v
问题2:
- 如何让apache支持解析PHP?
- 解决方法:
编译PHP必须加 –with-apxs2=/usr/local/apache24/bin/apxs, 目的是在 /usr/local/apache24/modules 下生成对应的libphp7.so
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28$ ./configure \
--prefix=/usr/local/php73 \
--with-config-file-path=/usr/local/php73/etc \
--with-apxs2=/usr/local/apache24/bin/apxs \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--with-pdo-mysql=mysqlnd \
--enable-inline-optimization \
--enable-opcache --enable-fpm \
--with-fpm-user=www --with-fpm-group=www \
--with-gettext --with-iconv --with-mhash \
--with-openssl=/usr/local/openssl \
--enable-bcmath --enable-soap \
--with-libxml-dir --enable-libxml --enable-pcntl \
--enable-shmop --enable-sysvsem --enable-sockets \
--with-curl --with-zlib-dir=/usr/local/zlib \
--enable-zip --with-gd \
--with-png-dir=/usr/local/libpng \
--with-jpeg-dir=/usr/local/jpeg \
--with-freetype-dir=/usr/local/freetype \
--with-xpm-dir=/usr \
--with-libzip=/usr/local/libzip \
--without-pear --with-tidy=/usr/local/tidy \
--enable-xml --enable-mbregex \
--enable-mbstring --enable-ftp \
--with-xmlrpc --enable-session \
--enable-ctypephp.ini-production / php.ini-devlopmentphp.ini –>php.ini
php-fpm.conf.default –>php-fpm.conf
sapi/fpm/init.d.php-fpm –>/etc/rc.d/init.d/php-fpm
1 | |
注意: PHP7里的用户设置在如下文件中配置, 而不是在php-fpm.conf中
1 | |
注意 httpd.conf 配置:
1 | |
问题1: checking for libzip… not found configure: error: Please reinstall the libzip distribution
解决方法:参考
1 | |
问题2: error: ‘INT_MAX’ undeclared (first use in this function)
解决方法:
1 | |
问题3: configure: WARNING: unrecognized options: –with-mysql, –with-vpx-dir, –with-t1lib, –enable-gd-native-ttf, –with-mcrypt
解决方法:
- 对于PHP7, –with-mysql 不适用: 更改为
--with-pdo-mysql; - 对于64位系统, 出现 –with-t1lib 执行:
ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.socp -frp /usr/lib64/libXpm.so* /usr/lib
- 对于 –with-mcrypt: 从PHP7.2开始, Mcrypt no longer provided, 参考;
- 对于 –enable-gd-native-ttf: 同–with-mcrypt;
- 对于 –with-vpx-dir: 参考, 要激活 GD 支持, 配置 PHP 时加上 –with-gd[=DIR], DIR 是 GD 的基本安装目录, 要使用推荐的绑定的 GD 库版;
2. 测试:
1 | |
IP:80/wordpress
IP:80/wordpress/wp-login.php?loggedout=true
A Globally Recognized Avatar