August 18, 2007 at 13:45:30 · Filed under Berkeley DB, CentOS, General
Berkeley DB是由美国Sleepycat Software公司开发的一套开放源代码的嵌入式数据库管理系统(已被Oracle收购),它为应用程序提供可伸缩的、高性能的、有事务保护功能的数据管理服务。
Berkeley DB为许多编程语言提供了实用的api接口,包括c、c++、java、perl、tcl、python和php等。所有同数据库相关的操作都由Berkeley DB函数库负责统一完成。
官方地址为:http://www.oracle.com/technology/products/berkeley-db/db/index.html
本文就先讲一下如何在CentOS下安装Berkeley DB数据库(其他系统类似)。
1、安装Berkeley DB
# cd /usr/local/src
# wget http://download.oracle.com/berkeley-db/db-4.6.18.tar.gz
# tar -zxvf db-4.6.18.tar.gz
# cd db-4.6.18
# cd build_unix
Berkeley DB默认是安装在/usr/local/BerkeleyDB.4.6目录下,其中4.6就是版本号,你也可以指定–prefix参数来设置安装目录。
# ../dist/configure --prefix=/usr/local/berkeleydb --enable-cxx
其中–enable-cxx就是编译C++库,这样才能编译Berkeley DB数据库的PHP扩展php_db4。
# echo '/usr/local/berkeleydb/lib/' >> /etc/ld.so.conf
# ldconfig
这2句的作用就是通知系统Berkeley DB的动态链接库在/usr/local/berkeleydb/lib/目录。
至此,Berkeley DB数据库已经安装完成。
Read more…
11 Comments »
August 8, 2007 at 09:00:57 · Filed under CentOS, FreeBSD, MySQL, Ubuntu
Jim Dowling为我们写了一个安装和管理MySQL集群(MySQL Cluster)的BASH脚本,支持安装本地集群和分布式集群,提问式的安装方式,非常方便,相信每个人都很容易上手。
http://www.jimdowling.info/ndbinstaller-trac/wiki/DetailedLocalhostInstall这里以图文的方式介绍了这个脚本的整个安装过程。
更多资料请访问:http://www.jimdowling.info/ndbinstaller-trac/
安装脚本下载(右键另存为)
wget http://www.jimdowling.info/ndbinstaller/ndbinstaller.sh
# or
svn co http://www.jimdowling.info/ndbinstaller/
No Comments »
June 28, 2007 at 12:49:57 · Filed under CentOS, FreeBSD, Ubuntu
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 {} \;
No Comments »
June 25, 2007 at 13:09:50 · Filed under CentOS, FreeBSD, SQLite, Ubuntu
很简单的一条命令:
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
1 Comment »
June 25, 2007 at 12:53:43 · Filed under 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…
2 Comments »
June 25, 2007 at 12:45:48 · Filed under CentOS, FreeBSD, General, MySQL, Ubuntu
实际上这种文章已经很多了,网上也到处都是,之所以写这篇文章,目的是为了解决其中一个问题。
# 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…
2 Comments »
June 25, 2007 at 12:32:32 · Filed under CentOS, 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…
No Comments »
June 19, 2007 at 13:54:49 · Filed under Apache, CentOS, Python, SQLite
本文将采用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…
No Comments »
October 22, 2006 at 23:49:22 · Filed under CentOS
公司服务器每天都会有上千的SSH失败尝试记录,一直不停的扫描,这些人真够无 聊的,没事吃饱了撑着,尽找些软件在那里穷举扫描(幸好服务器密码设置的够长够复杂)。
要一条一条将这些IP阻止显然治标不治本,于是找了个DenyHosts软件来代替的偶的手工活,吼吼:)
DenyHosts是Python语言写的一个程序,它会分析SSHD的日志文件,当发现重复的攻击时就会记录IP到/etc/hosts.deny文件,从而达到自动屏蔽IP的功能。
DenyHosts官方网站为:http://denyhosts.sourceforge.net
以下是安装记录(以CentOS 4.4, DenyHosts 2.5 为例)
Read more…
1 Comment »
October 21, 2006 at 10:47:50 · Filed under CentOS
1、安装SNMPD服务
# yum install net-snmp-utils
# vi /etc/snmp/snmpd.conf
把以下的内容注释掉:
# First, map the community name "public" into a "security name"
# sec.name source community
##com2sec notConfigUser default public
####
# Second, map the security name into a group name:
# groupName securityModel securityName
##group notConfigGroup v1 notConfigUser
##group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
##view systemview included .1.3.6.1.2.1.1
##view systemview included .1.3.6.1.2.1.25.1.1
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
##access notConfigGroup "" any noauth exact systemview none none
Read more…
1 Comment »