升级安装 MySQL 5.6.5-m8 和 nginx 1.1.19 

前几天接到邮件通知,MySQL 5.6.x 的分支发布了最新的测试版,也是第八个里程碑版本。值得一提的是,该次的版本,已经无限接近beta.

此外,nginx 由于爆了一个MP4 模块的内存的漏洞——CVE-2012-2089,当该模块被编译进去,并使用时,有被允许执行任意代码的风险。
具体见:http://nginx.org/en/security_advisories.html

注:如果我没记错的话,这已经是nginx这两个月以来,爆出的第二个漏洞了。

鉴于这两种情况,故而觉得很有必要升级更新。
下载这二者源码包,
7 wget http://dev.mysql.com/get/Downloads/MySQ ... ror/mysql/
9 wget http://nginx.org/download/nginx-1.1.19.tar.gz

删除旧版本文件:
[root@PowerPC pub]# rm mysql*
rm: remove regular file `mysql-5.6.4-m7.tar.gz'? y
rm: remove regular file `mysql-5.6.5-m8.tar.gz'? n
[root@PowerPC pub]# rm nginx*
rm: remove regular file `nginx-1.1.17.tar.gz'? y
rm: remove regular file `nginx-1.1.19.tar.gz'? n

之外,使用mysqldump 备份下数据库,以便之后恢复.

首先是MySQL,解压,进入目录。
我的cmake 参数:
[root@PowerPC mysql-5.6.5-m8]# cmake . \
> -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 \
> -DENABLED_PROFILING:BOOL=ON \
> -DENABLE_DEBUG_SYNC:BOOL=OFF \
> -DINNODB_COMPILER_HINTS:BOOL=OFF \
> -DINSTALL_BINDIR:STRING=../bin \
> -DINSTALL_DOCDIR:STRING=docs \
> -DINSTALL_DOCREADMEDIR:STRING=docs \
> -DINSTALL_INCLUDEDIR:STRING=include \
> -DINSTALL_INFODIR:STRING=docs \
> -DINSTALL_LAYOUT:STRING=STANDALONE \
> -DINSTALL_LIBDIR:STRING=lib \
> -DINSTALL_MANDIR:STRING=man \
> -DINSTALL_MYSQLDATADIR:STRING=data \
> -DINSTALL_MYSQLSHAREDIR:STRING=share \
> -DINSTALL_MYSQLTESTDIR:STRING=mysql-test \
> -DINSTALL_PLUGINDIR:STRING=lib/plugin \
> -DINSTALL_SBINDIR:STRING=../sbin \
> -DINSTALL_SCRIPTDIR:STRING=scripts \
> -DINSTALL_SHAREDIR:STRING=share \
> -DINSTALL_SQLBENCHDIR:STRING=bench \
> -DINSTALL_SUPPORTFILESDIR:STRING=support-files \
> -DMANUFACTURER:STRING='Built from Source by Sharl' \
> -DMYSQL_DATADIR:PATH=/usr/local/mysql/data \
> -DSYSCONFDIR:PATH=/etc/sysconfig/mysql/ \
> -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=OFF \
> -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF \
> -DWITH_EMBEDDED_SERVER:BOOL=OFF \
> -DWITH_EXTRA_CHARSETS:STRING=all \
> -DWITH_FEDERATED_STORAGE_ENGINE:BOOL=OFF \
> -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_LIBEDIT:BOOL=ON \
> -DWITH_LIBWRAP:BOOL=OFF \
> -DWITH_PARTITION_STORAGE_ENGINE:BOOL=OFF \
> -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=OFF \
> -DWITH_SSL:STRING=no \
> -DWITH_UNIT_TESTS:BOOL=OFF \
> -DWITH_ZLIB:STRING=bundled

有几点要注意的是:
1.readline 已经从该版本开始,被移除了。只剩libedit了。
2.该版本不能启用用于tcp 的 libwrap。否则在编译的时候会报错。
见下:

[ 96%] Building CXX object sql/CMakeFiles/sql.dir/mysqld.cc.o
mysqld.cc: In function ‘void handle_connections_sockets()’:
mysqld.cc:5851: error: ‘connection_tcpwrap_errors’ was not declared in this scope
make[2]: *** [sql/CMakeFiles/sql.dir/mysqld.cc.o] Error 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2


所以,如果遇到了该错误。只能暂时禁用掉。
之后清除缓存:
make clean
rm CMakeCache.txt

再次编译,即可.

make 成功后,make install 安装至指定目录.

之后,运行scripts 文件夹下的mysql_install_db 脚本,初始化数据库。
然后运行 mysql_secure_installation,设置root 密码,删除测试表等。
最后,导入之前备份的数据库SQL文件。
若有需要,重新授权库/表.

还有,如果用到了pam_mysql 验证的话,则位于/lib/security/ 下的 pam_mysql.so 文件也需要重新编译。

下载pam_mysql的源码,解压,编译,参数里指定mysql 的主目录。
运行 make,就可以生成新的 pam_mysql.so 链接库了。替换即可。
别忘了 重建链接库表。
ldconfig -v

接下来是nginx,解压,进入目录:
我的configure:
[root@PowerPC nginx-1.1.19]# ./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=/var/run/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-http_xslt_module \
> --with-http_image_filter_module \
> --with-http_dav_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_ssi_module \
> --without-http_geo_module \
> --without-http_map_module \
> --without-http_rewrite_module \
> --without-http_proxy_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 \
> --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"


确认无误,make && make install.编译安装。
之后,恢复下之前备份的配置文件 nginx.conf.

检查下版本:
[root@PowerPC /]# nginx -v
nginx version: nginx/1.1.19

正确。

重启服务器,一切正常。
至此,升级工作完成。
[ ] ( 4108 次浏览 ) 永久链接 ( 3.1 / 2469 )
修复 Simple PHP Blog 的页面跳转错误 

我不知道这篇文章该不该写在这里,因为严格意义上来讲,它不算是GNU/Linux 相关的问题。

不过,考虑这个站点是架设在 sphpblog 上的,所以姑且算作是有点关系吧。

是这样的,自从我升级到sphpblog 7.0 以来,我发现一个问题,那就是每当我提交完文章,或者提交完相关的表单操作。

sphpblog 都会将我跳转到 "http://domain.comindex.php" 这个地址。

很明显,它忘了在域名和子级路径之间加“/”了。

这的确很坑爹。每次我都会被送到中国电信的114错误页面,莫名的恼火~

于是,今天正好有时间,看看源码。发现它是在保存完毕后,调用了一个叫“redirect_to_url()” 的函数来实现跳转。

而这个函数位于scripts 目录下的 sb_login.php 文件里,具体内容
参见SVN:http://sphpblog.svn.sourceforge.net/viewvc/sphpblog/trunk/scripts/sb_login.php?revision=217&view=markup

可以看到,该函数还用到了一个叫“baseurl()” 的函数,这个不去管它。

只要把178行的
header('Location: ' . $baseurl . $relative_url);
改成
header('Location: ' . $baseurl . "/" . $relative_url);
即可。

保存下。

看看,是不是跳转成功了?!

注:这已经不是"redirect_to_url()" 这个函数第一次出现问题了,之前也有过一次类似坑爹的问题.
参见官方tracker:
http://sourceforge.net/tracker/index.ph ... tid=645297
[ ] ( 1980 次浏览 ) 永久链接 ( 3.1 / 2382 )
CentOS 下让Nginx 目录列表使用本地时区 

之前我记得nginx 默认目录列表下文件的时间戳使用的是UTC时区。我一直想把它设置成使用指定时区,如CST.

为此,我曾经还在nginx 的邮件列表里面和别人讨论过这个问题,
参见:http://forum.nginx.org/read.php?2,214494,214494#msg-214494

不过当时是无果。之后,我也就放弃了。

不过,直到刚才,我无意中发现了“autoindex_localtime” 这个参数,在nginx 配置文档里面。

我才发现我绕了一个大弯~

于是乎,果断加入该syntax,结果如下:

server {
listen 82;
server_name ftp.xiazhengxin.name;
charset utf-8;
autoindex on;
autoindex_localtime on; # 使用本地时区
autoindex_exact_size off; # 使用可读大小
root /home/ftp/;
allow 127.0.0.1;
deny all;
}


保存下,重载配置文件.
nginx -s reload.

打开 http://ftp.xiazhengxin.name/xzx/sql/ 页面,果然所有备份的数据库文件的时间戳都是凌晨0点00分了。

这就对了~哈哈!困扰了我许久的坑爹的问题终于被解决了。

其实这个问题早就应该被干掉的。因为根据nginx svn 库的提交显示,"autoindex_localtime" 这个参数并不是最近才有的,而是早在2005年就被加入了nginx~ 囧

参见:http://trac.nginx.org/nginx/changeset/520/nginx

注:本文在撰写和测试时,参考了以下文档:
http://nginx.org/en/docs/http/ngx_http_ ... _localtime
[ ] ( 1828 次浏览 ) 永久链接 ( 2.9 / 2403 )
Linux Mint Lisa LXDE 恢复桌面默认右键菜单 

刚接触LXDE界面,感觉很清新。这种简洁、朴素的UI很是让我喜欢。

由于LXDE默认使用的openbox 窗口管理器,一次在设置桌面喜好的时候,不知道勾选了什么。导致桌面上的右键菜单变成了openbox的右键菜单了。

很是不习惯。特别是需要在桌面上建立个空白文档什么的。

在PCManFM(LXDE 默认的文件管理器)里是正常的。

通过仔细的查找,终于在“桌面偏好设置”里面找到了该选项。

或者在终端里运行:“pcmanfm --desktop-pref” 即可。

对比图见下:
使用openbox菜单:


使用系统默认菜单:


怎么样?是不是恢复了? :)

注:本文在撰写时,参考了以下文章:
http://forums.linuxmint.com/viewtopic.p ... mp;t=98427
[ ] ( 1799 次浏览 ) 永久链接 ( 3 / 2260 )
解决GNU/Linux 下 adobe flash player 乱码 

前两天刚安装好Linux Mint Lisa LXDE,今天打算去acfun.tv 看一些搞笑视频,结果发现一个很杯具的问题,那就是我浏览器的flash player 里面的中文字体全部变成方块了~

这个问题,我记得我以前解决过一次,那是我还在用Ubuntu的时候,看CNZZ 后台flash报表遇到的。

由于年代久远,实在是记不起来了,好像是字体的问题。

于是,果断谷歌。

网络上给出的答案基本就是删除位于 /etc/fonts/conf.d/ 下的 49-sansserif.conf 软链接文件。


sharl@sharl-laptop /etc/fonts/conf.d $ ls -lah | grep 49
lrwxrwxrwx 1 root root 31 2012-03-28 21:45 49-sansserif.conf -> ../conf.avail/49-sansserif.conf


可是,很遗憾的是,没鸟用。我试了。

真是坑爹阿,无奈只好再次搜索下~ 最后在launchpad 找到了关于这个问题的bug提交。

参见:https://bugs.launchpad.net/ubuntu/+source/flashplugin-nonfree/+bug/207198

我察,adobe f*ck you~

launchpad 里面给出了一些比较有用的解决方案,应该说是比较靠谱的~

即:
编辑zh-cn 对应的字体映射配置文件,69-language-selector-zh-cn.conf

sharl@sharl-laptop /etc/fonts/conf.d $ ls -lah | grep cn
lrwxrwxrwx 1 root root 53 2012-03-22 22:15 69-language-selector-zh-cn.conf -> /etc/fonts/conf.avail/69-language-selector-zh-cn.conf


把文泉驿的中文字体的优先级放到该列表的最上方,压过其他坑爹的字体。
修改后如下:

sharl@sharl-laptop /etc/fonts/conf.d $ cat 69-language-selector-zh-cn.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<match target="pattern">
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Serif</string>
<string>Bitstream Vera Serif</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans</string>
<string>Bitstream Vera Sans</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans Mono</string>
<string>Bitstream Vera Sans Mono</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>

</fontconfig>


保存之后,再重启浏览器,flash player 果然不乱码了~

查看下字体:

sharl@sharl-laptop /etc/fonts/conf.d $ fc-match -a | grep Wen
wqy-microhei.ttc: "WenQuanYi Micro Hei" "Regular"
wqy-microhei.ttc: "WenQuanYi Micro Hei Mono" "Regular"

应该是正常了。

最后我想说两点:
1.Adobe Flash Player 真烂~
2.国内不负责任的转载伤不起

注:本文在撰写的时候参考了一下文章:
http://forum.ubuntu.org.cn/viewtopic.ph ... 5#p1865165
[ ] ( 2235 次浏览 ) 永久链接 ( 3.1 / 2686 )

<< <上一页 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 下一页> >>