编译安装 PHP 5.3.4 通过 

前段时间,php 发布了5.3.4版本,修复了在 PHP-FPM SAPI 方面的一些bug,于是便打算跟进了.

先完全卸载掉之前的php 版本,下载最新的5.3.4源码包(http://www.php.net/distributions/php-5.3.4.tar.bz2),解压,进入目录

我的configure:
[root@PowerPC php-5.3.4]# ./configure \
> --prefix=/usr/local/php \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/php \
> --localstatedir=/var/run \
> --disable-cli \
> --enable-embed=no \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-path=/etc/php.ini \
> --with-config-file-scan-dir=/etc/sysconfig/php \
> --with-exec-dir=/usr/local/bin \
> --disable-ipv6 \
> --with-openssl \
> --with-kerberos \
> --with-pcre-regex \
> --with-zlib \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --with-curlwrappers \
> --enable-dba=shared \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --enable-gd-native-ttf \
> --with-gettext \
> --with-mhash \
> --with-imap \
> --with-kerberos \
> --with-imap-ssl \
> --enable-intl \
> --with-ldap \
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/usr/local/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/usr/local/bin/mysql_config \
> --enable-soap \
> --enable-sockets \
> --enable-sqlite-utf8 \
> --enable-wddx \
> --with-xmlrpc \
> --with-xsl \
> --enable-zip \
> --enable-zend-multibyte \
> --without-pear

检查依赖。报错了,

checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... /tmp/mysql.sock
configure: error: Cannot find libmysqlclient under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!


是mysql 安装目录不完整的问题,解决方案:
1.进入mysql 安装根目录
2.ln -s /usr/local/lib lib

make distclean ,再次检查依赖,通过了。

接下来,make 编译,时间会比较长。耐心等待……
编译完成后,make install 安装即可.


[root@PowerPC php-5.3.4]# make install
Installing PHP SAPI module: fpm
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Installing PHP FPM binary: /usr/local/sbin/
Installing PHP FPM config: /etc/sysconfig/php/
Installing PHP FPM man page: /usr/local/php/man/man8/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PDO headers: /usr/local/php/include/php/ext/pdo/


测试下php,

[root@PowerPC php-5.3.4]# php-fpm -v
PHP 5.3.4 (fpm-fcgi) (built: Dec 17 2010 09:23:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

一切正常。再把之前备份的配置文件放到 /etc/sysconfig/php 下,启动php-fpm 就OK了.

至此,php 升级安装完成.
[ ] ( 2219 次浏览 ) 永久链接 ( 3.1 / 2379 )
编译安装 nginx 0.9.0 通过 

今天接到nginx 邮件通知,nginx 0.9.x 开发分支的第一个版本发布了.想想看nginx 0.8.x 进入稳定分支没几天,作者又开始了,真是闲不住呀.而我的nginx 现在还停在 0.8.50,连稳定版都没赶上,本来就打算升级的,这下正好,直接进 0.9.x 了.

下载最新的源码包,解压,进入目录
我的configure:
[root@PowerPC nginx-0.9.0]# ./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_flv_module \
> --with-http_gzip_static_module \
> --without-http_geo_module \
> --without-http_map_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/proxy.tmp \
> --http-proxy-temp-path=/tmp/nginx/body.tmp \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module

检查依赖,没有任何问题. configure 给出了编译小结(见下):
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1 library is not used
+ 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/body.tmp"
nginx http proxy temporary files: "/tmp/nginx/proxy.tmp"

在确认安装路径和配置路径等等都没有问题后,make 编译.接下来安装至指定目录, make install.(复制一些二进制文件和配置文件 以及man手册……)

make[1]: Entering directory `/root/nginx-0.9.0'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/sbin' || mkdir -p '/usr/local/sbin'
test ! -f '/usr/local/sbin/nginx' || mv '/usr/local/sbin/nginx' '/usr/local/sbin/nginx.old'
cp objs/nginx '/usr/local/sbin/nginx'
test -d '/etc/sysconfig/nginx' || mkdir -p '/etc/sysconfig/nginx'
cp conf/koi-win '/etc/sysconfig/nginx'
cp conf/koi-utf '/etc/sysconfig/nginx'
cp conf/win-utf '/etc/sysconfig/nginx'
test -f '/etc/sysconfig/nginx/mime.types' || cp conf/mime.types '/etc/sysconfig/nginx'
cp conf/mime.types '/etc/sysconfig/nginx/mime.types.default'
test -f '/etc/sysconfig/nginx/fastcgi_params' || cp conf/fastcgi_params '/etc/sysconfig/nginx'
cp conf/fastcgi_params '/etc/sysconfig/nginx/fastcgi_params.default'
test -f '/etc/sysconfig/nginx/fastcgi.conf' || cp conf/fastcgi.conf '/etc/sysconfig/nginx'
cp conf/fastcgi.conf '/etc/sysconfig/nginx/fastcgi.conf.default'
test -f '/etc/sysconfig/nginx/uwsgi_params' || cp conf/uwsgi_params '/etc/sysconfig/nginx'
cp conf/uwsgi_params '/etc/sysconfig/nginx/uwsgi_params.default'
test -f '/etc/sysconfig/nginx/scgi_params' || cp conf/scgi_params '/etc/sysconfig/nginx'
cp conf/scgi_params '/etc/sysconfig/nginx/scgi_params.default'
test -f '/etc/sysconfig/nginx/nginx.conf' || cp conf/nginx.conf '/etc/sysconfig/nginx/nginx.conf'
cp conf/nginx.conf '/etc/sysconfig/nginx/nginx.conf.default'
test -d '/var/run' || mkdir -p '/var/run'
test -d '/var/log/nginx' || mkdir -p '/var/log/nginx'
test -d '/usr/local/nginx/html' || cp -r html '/usr/local/nginx'
test -d '/var/log/nginx' || mkdir -p '/var/log/nginx'
make[1]: Leaving directory `/root/nginx-0.9.0'


至此,安装完成.
将之前备份的配置文件覆盖同名文件 /etc/sysconfig/nginx/nginx.conf,且确保存在可被写入的文件夹 /tmp/nginx.即可启动 nginx.

本地测试一下,
[root@PowerPC nginx]# curl localhost:83
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/0.9.0</center>
</body>
</html>

查看下版本,
[root@PowerPC nginx]# nginx -v
nginx: nginx version: nginx/0.9.0

恩,一切OK.
[ ] ( 3702 次浏览 ) 永久链接 ( 3 / 2502 )
在ubuntu上安装fcitx 4.0.0 (PPA源) 

Fcitx - Free Chinese Input Toy of X,简称小企鹅输入法。是我比较喜欢的linux下的中文输入法。

以前ibus 不行的时候我一直在用,不过随着ibus越来越好也就没怎么用过~懒得换了。
不过最近fcitx发布了4.0.0版本,听网友们说体验很好,而且新增的一款皮肤也很给力,故而打算试试了。。。

众所周知,fcitx 从3.6.3版本开始就不再提供deb包了(测试版除外),不过fcitx官方维护了一个PPA的源,所以我就直接从PPA安装了.
PPA源地址是:https://launchpad.net/~wengxt/+archive/fcitx-nightly

打开终端,按照 sudo add-apt-repository ppa:user/ppa-name 这样的格式,
运行: sudo add-apt-repository ppa:wengxt/fcitx-nightly
添加PPA的源,自动添加/验证公钥后就可以了。

之后别忘了: sudo apt-get update ,更新下软件库.

这下就可以安装fcitx了.
sudo apt-get install fcitx fcitx-config
注:由于ubuntu官方源里面也有fcitx,可能会和PPA的搞混,这点经过测试是不用担心。

安装完了后,运行 im-switch, 选中 fcitx 就可以设为默认输入法了.
此时可以运行 fcitx-config 配置下小企鹅,比如候选词的数量、皮肤、模糊音、快捷键等等。
这里要说下,小企鹅默认的上下翻页是 - 和 = ,而我则习惯用 page up 和 page down,可以在快捷键里面改掉。

- 改成 PGUP, = 改成 PGDN. 保存即可.如图

最后,重启x 使输入法生效.
sudo service gdm restart
[ ] ( 2903 次浏览 ) 永久链接 ( 3 / 2514 )
编译安装 MySQL Community Server 5.1.53 通过 

刚刚搞好VPS没几天,今天接到MySQL 邮件通知,MySQL Community Server 5.1.53 GA 发布了。修复了一些bug,不算多。

不过想想还是升级了。因为上个版本的mysql安装的 /var 目录有些问题,导致多出了好些个表。那些目录删又删不得,看着实在别扭,故而打算重新安装了.

首先,在安装之前,先导出需要备份的几个表。这次要一个个导出,不能像以前一样(用 --all-databases),图省事导出全部了.

mysqldump -u root -p database1 database2 database3 > DBbak.sql 即可.

然后rm掉之前的mysql.下载最新5.1.53的源码包。解压,进入目录

我的configure:
[root@PowerPC mysql-5.1.53]# ./configure \
> --prefix=/usr/local/mysql \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/mysql \
> --localstatedir=/var/run/mysql \ #这里变了
> --enable-profiling \
> --disable-largefile \
> --with-charset=utf8 \
> --with-extra-charsets=all \
> --with-system-type=PowerOS \
> --with-machine-type=PowerPC \
> --with-server-suffix=By_Sharl \
> --with-unix-socket-path=/tmp/mysql.sock \
> --with-mysqld-user=mysql \
> --with-zlib-dir=bundled \
> --with-low-memory \
> --with-plugins=all \
> --with-embedded-server \
> --without-geometry \
> --with-embedded-privilege-control \
> --without-docs \
> --without-man

检查依赖,没有任何问题,然后就是 make && make install.编译安装.
一切OK后,老规矩:
复制support-files 下的中等配置 my-medium.cnf 到 /etc 下.
cp support-files/my-medium.cnf /etc/my.cnf

接下来安装数据库,mysql_install_db.
这个时候,确保指定的var 目录可被mysql 写入。
chown -R mysql /var/run/mysql

再然后 mysql_secure_installation, 安全模式安装mysql.
在设置完密码,删掉测试表后。就可以启动mysql了.
mysqld_safe --user=mysql &.

启动成功后,导入之前备份的表数据.
mysql -u root -p < dbbak.sql.
由于我没有备份mysql.user表,所以以前的用户都丢失了。此时最好再重新授权一下。
grant all on database1.table2 to 'user3'@'localhost' identified by 'password4'.
最好再刷新下权限表。一切就OK了。MySQL 升级完成.
[ ] ( 3569 次浏览 ) 永久链接 ( 3 / 2342 )
在Centos 上安装 配置 vsftpd 2.3.2 

早就像换掉proftpd 了,虽然它类似apache httpd 的配置文件格式很友好,不过体积太大最终还是让我抛弃了它。

还是 vsftpd 吧,下载最新版本2.3.2,解压,进入目录

众所周知,vsftpd 提供现成的Makefile,源码安装极其简单。直接make && make install.

我现在所要做的就是让vsftpd 支持虚拟用户登录,而且用户表是从mysql 里的vsftpd 库中的users里面读出来的.

首先确保本地有pam_mysql.so 库文件,没有的话,去 pam-mysql.sf.net 下载源码自编译一个.这里不赘述.

复制 vsftpd 源码包下的 vsftpd.conf 到 /etc 下.
复制 RedHat 目录下的 vsftpd.pam 到 /etc/pam.d 目录下,并改名为 ftp.

ftp 内容为:

[root@PowerPC ~]# cat /etc/pam.d/ftp
#%PAM-1.0
auth required /lib/security/pam_mysql.so user=ftp passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2
account required /lib/security/pam_mysql.so user=ftp passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=name passwdcolumn=password crypt=2


同时确保mysql 里面有vsftpd数据库,里面有一张users的表.
字段见描述:

mysql> describe vsftpd.users;
+----------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | char(50) | NO | | NULL | |
| password | char(50) | NO | | NULL | |
+----------+----------+------+-----+---------+----------------+
3 rows in set (0.00 sec)


可以插入几条测试数据.

之后,再编辑下/etc/vsftpd.conf 文件,关键的一部分如下:

guest_enable=YES
guest_username=ftp
ftp_username=ftp
user_sub_token=$USER
local_root=/home/ftp/$USER
user_config_dir=/etc/sysconfig/vsftpd #用于重载一些特殊用户的配置
virtual_use_local_privs=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
nopriv_user=ftp
chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/sysconfig/vsftpd/ftpusers
#该文件里包含所有需要被chroot() 用户的列表。一个一行.


这样一来的话就差不多了。
killall vsftpd 杀掉 vsftpd 进程.
重启ftp. vsftpd &.

试试看 ftp 127.0.0.1,应该可以登录了.

至此,vsftpd + pam_mysql 虚拟用户配置完成.

注:关于vsftpd 的更多选项,
参见:http://vsftpd.beasts.org/vsftpd_conf.html
或者 man vsftpd.conf .
[ ] ( 3196 次浏览 ) 永久链接 ( 3 / 2525 )

<< <上一页 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 下一页> >>