Home mail me! Syndicate this site using RSS

Archive for June, 2007


Ubuntu电子杂志第二期发布

本期的内容包括:
* Flavour of the Month – Kubuntu
* How-To – Ubuntu on the Intel Mac Mini, Virtual Private Networking, Learning Scribus Part 2 and Ubuntu for your Grandma!
* Review – System 76 Darter
* Top 5 – Widgets
* MyDesktop, MyPC and more!

Issue 2 of Full Circle Magazine

之前的两个版本都有出其他语言的翻译版,不知道啥时候会出中文的,还是很期待!

下载地址:http://www.fullcirclemagazine.org/issue-2
官方网址:http://www.fullcirclemagazine.org

MYSQL命令行导出XML格式数据

使用“-X”这个选项即可。

# mysql -X -u root -e "use mysql; select * from user;"

输出结果如下:

<?xml version="1.0"?>
 
<resultset statement="select * from user">
  <row>
        <field name="Host">localhost</field>
        <field name="User">root</field>
        <field name="Password"></field>
        <field name="Select_priv">Y</field>
        <field name="Insert_priv">Y</field>
        <field name="Update_priv">Y</field>
        <field name="Delete_priv">Y</field>
        <field name="Create_priv">Y</field>
        <field name="Drop_priv">Y</field>
        <field name="Reload_priv">Y</field>
        <field name="Shutdown_priv">Y</field>
        <field name="Process_priv">Y</field>
        <field name="File_priv">Y</field>
        <field name="Grant_priv">Y</field>
        <field name="References_priv">Y</field>
        <field name="Index_priv">Y</field>
        <field name="Alter_priv">Y</field>
        <field name="Show_db_priv">Y</field>
        <field name="Super_priv">Y</field>
        <field name="Create_tmp_table_priv">Y</field>
        <field name="Lock_tables_priv">Y</field>
        <field name="Execute_priv">Y</field>
        <field name="Repl_slave_priv">Y</field>
        <field name="Repl_client_priv">Y</field>
        <field name="Create_view_priv">Y</field>
        <field name="Show_view_priv">Y</field>
        <field name="Create_routine_priv">Y</field>
        <field name="Alter_routine_priv">Y</field>
        <field name="Create_user_priv">Y</field>
        <field name="ssl_type"></field>
        <field name="ssl_cipher"></field>
        <field name="x509_issuer"></field>
        <field name="x509_subject"></field>
        <field name="max_questions">0</field>
        <field name="max_updates">0</field>
        <field name="max_connections">0</field>
        <field name="max_user_connections">0</field>
  </row>
</resultset>

Find命令技巧

find命令功能其实很强,针对某些特定条件的日志文件特别有效,下面列举几个技巧:

1.查找90天以前的文件,并用LS列出全名

# find /data/webdata -mtime +90 -type f -exec ls -l -h {} \;

2.查找修改时间超过90天的文件

# find /data/webdata -mtime +90

3.查找修改时间超过90天,并且不包含click_15和click_16目录的文件

# find /data/webdata -mtime +90 \( -path /data/webdata/click_15 -o -path /data/webdata/click_16 \) -prune -o -print

4.查找修改时间超过90天,并需确认删除

# find /data/webdata -mtime +90 -ok rm -R {} \;

Upgrade SQLite2 to SQLite3

很简单的一条命令:

sqlite2 mydb.db .dump | sqlite3 mydb-new.db

如果需要很多数据库,写个简单的脚本即可。

#!/bin/bash
#
# description: Upgrade SQLite2 to SQLite3
#
 
DBPATH="/data/db"
 
for oldfile in $(find ${DBPATH} -name "*.db"); do
        newfile="${oldfile}.bak"
        sqlite2 $oldfile .dump | sqlite3 $newfile
        mv -f $newfile $oldfile
        echo $newfile
        echo $oldfile

CentOS 源

贴一下偶常用的源
1、FOR CentOS 4.4

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.be10.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4
 
#released updates 
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.be10.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4
 
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirror.be10.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirror.be10.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirror.be10.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://mirror.be10.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.be10.com/centos/RPM-GPG-KEY-centos4

Read more…

自行编译安装PHP

实际上这种文章已经很多了,网上也到处都是,之所以写这篇文章,目的是为了解决其中一个问题。

# cd /usr/local/src
# wget http://cn.php.net/distributions/php-5.2.3.tar.gz
# tar -zxvf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-exec-dir=/usr/bin --with-freetype-dir --with-png-dir=/usr/local --with-gd=shared --enable-gd-native-ttf --with-iconv --with-jpeg-dir=/usr/local --with-openssl --with-png --with-pcre-regex --with-zlib --with-layout=GNU --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-memory-limit --enable-shmop --with-mime-magic=/usr/share/file/magic.mime --with-apxs2=/usr/sbin/apxs --with-sqlite --with-pdo-sqlite --without-pear --disable-xmlwriter --disable-xmlreader --disable-xml --disable-simplexml --disable-libxml --disable-dom --disable-ipv6 --disable-json --disable-hash --with-mysql --with-pdo-mysql

很多人在执行到这一步的时候,会出现以下问题:
Read more…

CentOS 5.0 下架设Memcached服务器

1、下载安装包

# cd /usr/local/src
# wget http://www.monkey.org/~provos/libevent-1.3b.tar.gz
# wget http://danga.com/memcached/dist/memcached-1.2.2.tar.gz

2、开始安装
安装libevent

# tar -zxvf libevent-1.3b.tar.gz
# cd libevent-1.3b.tar.gz
# ./configure
# make
# make install

Read more…

发布最新编译的PHP中文手册

一直觉得很奇怪,为什么PHP官方编译的PHP中文手册的索引是乱码,而自己编译的就没问题,难道那人是台湾人?或是比较喜欢用繁体字?搞的那么多国内用户看着繁体不爽,主要是索引乱码不爽。

因为自己前几年写的自己动手编译PHP手册的底稿已不存在,故在网上搜了一下,发现多如牛毛,几乎都是转载偶的那篇文章,同时也觉得可笑,以后自己的文章要是不见了,到网上一搜没准都能找到,不管有多老,呵呵。

下面附上2007年6月20日编译的PHP中文手册下载。php_manual_zh.chm.tar.gz

备注:请大家下载后,将文件名改为php_manual_zh.chm.tar.gz再解压缩,因为WordPress的原因自动将.tar.gz后缀的文件名改为tar.gz了。

CentOS下安装Subversion&Trac

本文将采用Apache 2.2.3+Subversion1.4.2+Python 2.4.3+SQLite 3.3.6+Trac 0.10.4架设。

服务器IP为:192.168.1.200

1、Apache、Subversion、Python和SQLite均采用默认安装即可,yum即可安装。

# yum install httpd httpd-devel swig subversion mod_dav_svn sqlite python python-devel python-sqlite mod_python

2、配置Subversion

下面将使用myapp这个仓库来配置Subversion

# mkdir -p /var/www/svn
 
# cd /var/www/svn
 
# svnadmin create myapp
 
# chown -R apache:apache myapp
 
# vi /etc/httpd/conf.d/subversion.conf

Read more…