升级VPS 

自国庆后一直没有怎么做自己的事情,因为实在是事情太多了~

终于在这几天有了些空闲的时间,可以做一些自己的事情了,也看到我服务器上正在跑的一些服务都有了新版本的诞生,故而决定果断跟进。

首先,下载需要安装的软件升级包:
10 wget http://downloads.php.net/stas/php-5.4.0beta2.tar.bz2
12 wget http://www.hiawatha-webserver.org/files ... 7.7.tar.gz
16 wget http://mysql.he.net/Downloads/MySQL-5.6 ... -m6.tar.gz
42 wget http://nginx.org/download/nginx-1.1.6.tar.gz
43 wget http://repo.varnish-cache.org/source/va ... 0.1.tar.gz

删除各自的修版本:
[root@PowerPC pub]# rm php*
rm: remove regular file `php-5.4.0alpha1.tar.bz2'? y
rm: remove regular file `php-5.4.0beta2.tar.bz2'? n
rm: remove regular file `phpBB-3.0.8.tar.bz2'? n
rm: remove regular file `phpinfo.php'? n
rm: remove regular file `phpMyAdmin-3.4.0-beta4-all-languages.tar.gz'? n
[root@PowerPC pub]# rm mysql*
rm: remove regular file `mysql-5.6.2-m5.tar.gz'? y
rm: remove regular file `mysql-5.6.3-m6.tar.gz'? n
[root@PowerPC pub]# rm hiawatha*
rm: remove regular file `hiawatha-7.6.tar.gz'? y
rm: remove regular file `hiawatha-7.7.tar.gz'? n
[root@PowerPC pub]# rm nginx*
rm: remove regular file `nginx-1.1.1.tar.gz'? y
rm: remove regular file `nginx-1.1.6.tar.gz'? n
[root@PowerPC pub]# rm varnish*
rm: remove regular file `varnish-3.0.1-rc1.tar.gz'? y
rm: remove regular file `varnish-3.0.1.tar.gz'? n

依次解压,结构如下:
[root@PowerPC ~]# ls
mysql-5.6.3-m6 pam_mysql-0.7RC1 varnish-3.0.1
hiawatha-7.7 nginx-1.1.6 php-5.4.0beta2

进入目录,首先是mysql:
我的cmake 参数:
[root@PowerPC mysql-5.6.3-m6]# cmake . \
> -DBACKUP_TEST:BOOL=OFF \
> -DCMAKE_BUILD_TYPE:STRING=Release \
> -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
> -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON \
> -DCOMMUNITY_BUILD:BOOL=ON \
> -DDISABLE_SHARED:BOOL=OFF \
> -DENABLE_DEBUG_SYNC:BOOL=OFF \
> -DINSTALL_BINDIR:STRING=../bin \
> -DINSTALL_LAYOUT:STRING=STANDALONE \
> -DINSTALL_SBINDIR:STRING=../sbin \
> -DMYSQL_DATADIR:PATH=/var/mysql \
> -DSYSCONFDIR:PATH=/etc/sysconfig/mysql \
> -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_DEBUG:BOOL=OFF \
> -DWITH_EMBEDDED_SERVER:BOOL=OFF \
> -DWITH_EXTRA_CHARSETS:STRING=all \
> -DWITH_FEDERATED_STORAGE_ENGINE:BOOL=ON \
> -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_LIBEDIT:BOOL=ON \
> -DWITH_LIBWRAP:BOOL=ON \
> -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
> -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
> -DWITH_READLINE:BOOL=OFF \
> -DWITH_SSL:STRING=no \
> -DWITH_UNIT_TESTS:BOOL=OFF \
> -DWITH_ZLIB:STRING=bundled

更多参见帮助:cmake . -LAH

之后,开始编译,安装.
make && make install

mysql安装完毕后,使用之前的数据库文件初始化数据库.
[root@PowerPC mysql]# scripts/mysql_install_db \
> --basedir=/usr/local/mysql \
> --datadir=/var/mysql \
> --user=mysql

恢复备份的配置文件:
mv bak/my.cnf /etc/sysconfig/mysql/
启动mysql:
mysqld_safe &
清理测试表,刷新权限表:
mysql_secure_installation

至此,mysql升级完成.

可是,我居然发现这次的mysql服务吃掉了我vps接近90%的内存,很是惊讶~
我想可能是由于我之前编译的时候,编译进了很多存储引擎的支持,如archive、blackhole等,杯具了,我又不想重新编译,故而在my.cnf 中禁用掉了其他的存储引擎,如 skip-federated.

这才好了一点,看来以后不能那么贪心了~

mysql 更新了,用于vsftpd 验证虚拟用户的pam_mysql 也得重新编译了。版本还是老版本 0.7RC1,进入目录:
我的configure:
[root@PowerPC pam_mysql-0.7RC1]# ./configure \
> --with-mysql=/usr/local/mysql

(仅)编译,make.完了之后,在当前目录下找到并把生成的pam_mysql.so 库替换掉之前的老版本。
[root@PowerPC pam_mysql-0.7RC1]# find . -name pam*.so
./.libs/pam_mysql.so

[root@PowerPC pam_mysql-0.7RC1]# cp ./.libs/pam_mysql.so /lib/security
cp: overwrite `/lib/security/pam_mysql.so'? y

这时候,重启vsftpd,就应该生效了~
killall vsftpd
ldconfig -v #别忘了刷新系统链接库
vsftpd &

接下来,php:
我的configure:
[root@PowerPC php-5.4.0beta2]# ./configure \
> --prefix=/usr/local/php \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/php \
> --localstatedir=/var \
> --disable-cli \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-path=/etc/sysconfig/php/php.ini \
> --with-config-file-scan-dir=/etc/sysconfig/php \
> --disable-ipv6 \
> --with-zlib \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-dba=shared \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --enable-gd-native-ttf \
> --with-mhash \
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/usr/local/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/usr/local/bin/mysql_config \
> --with-pdo-mysql=/usr/local/mysql \
> --with-libedit \
> --enable-soap \
> --enable-sockets \
> --enable-wddx \
> --with-xmlrpc \
> --with-xsl \
> --enable-zip \
> --without-pear

检查依赖,没有问题。之后编译,安装。
make && make install.

完了之后,恢复下之前备份过的配置文件,php-fpm.conf、php.ini 即可.

紧接着,web 服务器,先是hiawatha,最新的7.7版本是一个安全修复版,推荐更新:
我的configure:
[root@PowerPC hiawatha-7.7]# ./configure \
> --prefix=/usr/local/hiawatha \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --disable-largefile \
> --enable-chroot \
> --enable-command \
> --disable-ipv6 \
> --disable-monitor \
> --disable-ssl

检查依赖,编译,安装,都很顺利。
make && make install.

最后,恢复下配置文件 hiawatha.conf、php-fcgi.conf(主要是这两个)。

然后是nginx,最新的开发版:
我的configure:
[root@PowerPC nginx-1.1.6]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/tmp/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-http_image_filter_module \
> --with-http_sub_module \
> --with-http_dav_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request \
> --http-proxy-temp-path=/tmp/nginx/proxy \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,系统给出编译概况:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx/request"
nginx http proxy temporary files: "/tmp/nginx/proxy"


确认无误后,make && make install 编译,安装。
一切OK后,依然恢复下配置文件 nginx.conf

最后就是一个web缓存服务器varnish,前天下载时候还是3.0.1版本,今天就发布了3.0.2版本,囧rz
我的configure:
[root@PowerPC varnish-3.0.2]# ./configure \
> --prefix=/usr/local/varnish \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --disable-largefile \
> --enable-kqueue \
> --enable-epoll \
> --enable-ports \
> --with-jemalloc

检查依赖,没问题。编译,安装.
make && make install

最后,还是别忘了恢复下配置文件。

至此,服务器升级完毕。

评论