./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
看来是缺少pcre支持,那么补上: yum install pcre-devel pcre-static ,然后再执行一次。
这次是缺少openssl:
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
执行 yum install openssl-devel openssl-perl openssl-static ,然后再执行一次。
又又报错了:
checking for perl
+ perl version: v5.10.1 (*) built for x86_64-linux-thread-multi
Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
可以编译安装了,分别执行 make 和 make install 吧。
等执行完毕,用 ls /usr/local/nginx-1.12.0 命令可以看到安装目录下有文件生成,接下来执行nginx命令查看是否成功安装。
执行 /usr/local/nginx-1.12.0/sbin/nginx -t ,结果如下:
configure: error: xml2-config not found. Please check your libxml2 installation.
望文生义貌似是libxmls的缺少造成的。那么执行 yum install libxml2 libxml2-devel libxml2-static 补上我猜可能必要的开发环境。然后接着执行上述的预编译脚本。
又报错了:
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
这次是libcurl,补上 yum install libcurl libcurl-devel ,再来。
又又报错了:
checking for GD support... yes
checking for the location of libwebp... no
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 2... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-webp-dir=<DIR>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: png.h not found.
这次是和GD库又关,因为是和图像处理有关的扩展,所以jpeg、png、gif等图像开发环境是必要的。
但是我想尽可能少安装,所以先试试 yum install gd gd-devel 。然后执行预编译脚本。
gd库的检测通过了,但是出现了新的错误:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
这次是mcrypt库的问题,问题是CentOS6.9的yum库已经不支持mcrypt的安装,改用gcrypt了。没办法,自己下载吧。
根据php的官方文档:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:64 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:107 (FIND_CURSES)
cmake/readline.cmake:197 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:488 (MYSQL_CHECK_EDITLINE)
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-5.7.18/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-5.7.18/CMakeFiles/CMakeError.log".
查了一下,好像是缺ncurses组件。那就补上吧: yum install ncurses ncurses-devel ncurses-libs ncurses-static 。之后再次执行预编译。
再次执行却以更快的速度报一样的错,仔细一看原来少执行了一步操作: remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. 。好吧,删掉目录下的CMakeCache.txt文件 rm CMakeCache.txt ,然后再次执行。
这次顺利预编译完了:
接下来依次执行 make 和 make install 就行了。
编译的过程相当之慢,我去做其他事情好了。
Transaction Check Error:
installing package gcc-objc-4.4.7-18.el6.x86_64 needs 11MB on the /usr filesystem
installing package ecj-1:4.5.2-3.el6.x86_64 needs 21MB on the /usr filesystem
installing package libgnat-devel-4.4.7-18.el6.x86_64 needs 46MB on the /usr filesystem
installing package libgnat-4.4.7-18.el6.x86_64 needs 50MB on the /usr filesystem
installing package gcc-gnat-4.4.7-18.el6.x86_64 needs 73MB on the /usr filesystem
installing package jpackage-utils-0:1.7.5-3.16.el6.noarch needs 73MB on the /usr filesystem
installing package compat-gcc-34-c++-3.4.6-19.el6.x86_64 needs 162MB on the /usr filesystem
installing package gcc-java-4.4.7-18.el6.x86_64 needs 172MB on the /usr filesystem
installing package compat-gcc-34-3.4.6-19.el6.x86_64 needs 185MB on the /usr filesystem
installing package compat-libf2c-34-3.4.6-19.el6.x86_64 needs 185MB on the /usr filesystem
installing package libgcj-devel-4.4.7-18.el6.x86_64 needs 203MB on the /usr filesystem
installing package gcc-objc++-4.4.7-18.el6.x86_64 needs 213MB on the /usr filesystem
installing package java_cup-1:0.10k-5.el6.x86_64 needs 214MB on the /usr filesystem
installing package compat-gcc-34-g77-3.4.6-19.el6.x86_64 needs 220MB on the /usr filesystem
installing package sinjdoc-0.5-9.1.el6.x86_64 needs 223MB on the /usr filesystem
installing package libobjc-4.4.7-18.el6.x86_64 needs 223MB on the /usr filesystem
installing package java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 needs 223MB on the /usr filesystem
Error Summary
-------------
Disk Requirements:
At least 223MB more space needed on the /usr filesystem.
这叫老夫如何是好,网上查查怎么加硬盘或者重新分区之类的吧。实在不行只能重装了。
网上看了看,可能要用到fdisk和Virtual Box Manager。我都不太熟而且好麻烦QAQ,算了算了,重装一个虚拟机吧orz
这次分30G给/usr/local,总没问题了吧。
等等等等,仔细看了一下,发现容量都是被下载的软件包和解压包给占据了,只要把它们删掉就好。
CMake Error at cmake/boost.cmake:81 (MESSAGE):
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
This CMake script will look for boost in <directory>. If it is not there,
it will download and unpack it (in that directory) for you.
If you are inside a firewall, you may need to use an http proxy:
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mysql-5.7.18/CMakeFiles/CMakeOutput.log".
See also "/usr/local/src/mysql-5.7.18/CMakeFiles/CMakeError.log".
想想应该是预编译时boost的包含路径有问题,应该包含安装生成文件里的include目录。那么,依次执行 rm CMakeCache.txt 和 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.7.18 -DWITH_BOOST=/usr/local/boost-1.59.0/include 。
结果ok。接下来执行 make 和 make install 就可以了。
漫长的等待过程,去干点别的吧。
终...终于好了。
接下来就是初始化了。
按照文档,要先修改安装目录和文件所属组和所属用户 chgrp -R mysql /usr/local/mysql-5.7.18 chown -R mysql /usr/local/mysql-5.7.18 。
接下来创建一个放数据库文件、socket文件、pid文件和配置文件的目录,就放在/var目录下好了
2017-04-24T10:27:35.480795Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-24T10:27:36.378470Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-04-24T10:27:36.557201Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-24T10:27:36.666538Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a2c08f2f-28d8-11e7-b53a-08002728b6d3.
2017-04-24T10:27:36.673556Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-04-24T10:27:36.676216Z 1 [Note] A temporary password is generated for root@localhost: jyJoLj>9G_!-
接下来试着启动服务 /usr/local/mysql-5.7.18/bin/mysqld --defaults-file=/var/local/mysql-5.7.18/etc/my.cnf & ,按 Ctrl + C 退出控制台占用,执行 /usr/local/mysql-5.7.18/bin/mysql --defaults-file=/var/local/mysql-5.7.18/etc/my.cnf -u root -p ,之后要输入密码。后面的密码来自之前初始化后成功的提示的最后一行。
5.8版本规定进入MySQL后并不能执行任何操作,必须先改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; 。且密码必须大于8位,包含字符数字字母,真是烦死了。