svnlook: Expected FS format ’2′; found format ’4′

原来在fc12安装的svn是:
[deli@athena ~]$ rpm -qa|grep subversion
subversion-javahl-1.6.13-1.fc12.1.i686
subversion-libs-1.6.13-1.fc12.1.i686
subversion-1.6.13-1.fc12.1.i686

将旧的代码仓库数据移到新的服务器,装的是 rhel 5.4, svn手动安装 subversion-1.6.9。
可以 update,但提交代码时发现:

svnlook: Expected FS format ’2′; found format ’4′

也是同样的 svn版本,可能新的服务器是64位。只好先把svn降级了。

mv resp resp_bak.20110121
svnadmin create --pre-1.5-compatible resp
svnadmin dump resp_bak.20110121 |svnadmin load resp
svnserve -d -r /var/svn/web/resp

重新 commit, ok.

Bluehost安装svn

环境:

Bluehost: 64位主机,可以通过 uname -a 命令查询,含有 x86_64 的就是64位系统了。
svn: 目前最新稳定版本1.6.15。

Bluehost用户目录下有个.local 目录,显然是为用户装自己的软件而提供的,那么以后我们要装的软件,都应该放在 $HOME/.local 目录下(来源:http://helpdesk.bluehost.com/index.php/kb/article/000530)。

整个过程如下:

mkdir ~/src
cd ~/src

wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.15.tar.gz

tar xvf subversion-deps-1.6.15.tar.gz
cd subversion-1.6.15
cd apr
./configure -prefix=$HOME/.local
make; make install

cd ..
cd apr-util/
./configure -prefix=$HOME/.local --with-apr=$HOME./local
make; make install

cd ..
cd neon/
./configure -enable-shared -prefix=$HOME/.local
make; make install
cd ..
rm subversion-1.6.15 -rf

tar xvf subversion-1.6.15.tar.gz
cd subversion-1.6.15
wget http://www.sqlite.org/sqlite-amalgamation-3.6.13.tar.gz
tar xvf sqlite-amalgamation-3.6.13.tar.gz
mkdir sqlite-amalgamation
cp sqlite-3.6.13/sqlite3.c sqlite-amalgamation

./configure --prefix=$HOME/.local --without-berkeley-db --with-zlib=/usr/ --with-ssl LDFLAGS="-L/lib64"
make; make install 

后面报错:

cp .libs/mod_dav_svn.soT /usr/lib64/httpd/modules/mod_dav_svn.so
cp: cannot create regular file `/usr/lib64/httpd/modules/mod_dav_svn.so’: Read-only file system

没关系,我只是用来做svn client就行了。

最后,
vi ~/.bashrc
export PATH=$HOME/.local/bin:$PATH

Bluehost没法安装mod_python

$ httpd -l
发现没装上 mod_python,网上搜一下,没找到有用的东西,于是给bluehost提交了一个ticket,希望他们能帮我装上。不多久就得到回复了:

Hello,
Thank you for choosing Bluehost. I understand you wish to use an apache module for Python. Unfortunately we do not offer mod_python and since it requires a recompile of apache we will be unable to implement it for you.

看样子是需要把之前写的程序改为CGI了。

python makes me happy :)

这几天用 Python写了个Android Market web client,新手上路,却出奇的顺利!apache2 + mod_python, mod_python 里的req很好用。本想用ruby写的,可是ruby对protobuf支持不是很好,php更没份了,在jsp与psp犹豫了一下,还是选择了后者。我问wayhome,有没有python psp的资料,他愣住了,说没有,psp是什么?我再补充,不是psp游戏机哦,是Python Server Pages,你搞python这么久不会没听说过?后来他说写cgi都用PEP333。搞什么,弄了大半天,原来psp是早已过时不用的技术了。

听说python的框架Django牛气轰轰,堪比Ruby之Rails,我翻了一下,弄懂这玩意,也需要花不少时间。弄几个页面,还是写cgi快,维护BBS都用C写过cgi,还怕不会用脚本写cgi? python的语法跟ruby差不多,以前在曾厝庵学生公寓图书馆看过一个下午,长时间不用也忘记光了,工作中很少用到,好像是安装项目管理软件Trac调试过,不过看apache error log,一般问题都可以诊断出错误位置。

人生真是阴差阳错。一直关注C/C++, PHP,Ruby,我想不会再学Java,Python之类的了。没想到今年工作主要是写Java程序 :( 用什么,就学什么,现学现用。哲学家告诉我们:变化是永恒的,没有一劳永逸。

参考资料:
http://modpython.org/live/current/doc-html/pyapi-psp.html
http://www.python.org/dev/peps/pep-0333/
http://www.djangobook.com/en/2.0/chapter01/

安装日志分析工具awstats

之前用Google Analytics分析网站,觉得多一次请求,对用户不太好,于是自己分析统计apache log。大约花了一个小时安装测试awstats,比预期的要顺利。

服务器是fedora,用yum安装很快。
[root@athena~]# yum install awstats

用默认的安装方法,/etc/httpd/conf.d/ 目录下面已经有了awstats.conf,如果没有,复制一个过去
# cp /usr/share/awstats/tools/httpd_conf /etc/httpd/conf.d/awstats.conf

编辑 /etc/httpd/conf.d/awstats.conf文件,默认的是:

<Directory "/usr/share/awstats/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from 127.0.0.1
</Directory>

如果是外面的服务器,将 127.0.0.1改为 all

[root@athena~]# cp /etc/awstats/awstats.module.conf /etc/awstats/awstats.broncho.cn.conf
编辑/etc/awstats/awstats.broncho.cn.conf, 修改下面三项即可:
SiteDomain="broncho.cn"
LogFile="/var/log/httpd/broncho.cn_access_log.%YYYY-0%MM-0%DD-0"
Lang="cn"

[root@athena~]# cd /usr/share/awstats/wwwroot/cgi-bin
[root@athena cgi-bin]# ./awstats.pl -update -config=broncho.cn

发现:

Create/Update database for config “/etc/awstats/awstats.broncho.cn.conf” by AWStats version 6.8 (build 1.910)
From data in log file “/var/log/httpd/broncho.cn_access_log.20100927″…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file /var/log/httpd/broncho.cn_access_log.20100927 must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:1
This means each line in your web server log file need to have “combined log format” like this:
111.22.33.44 – - [10/Jan/2001:02:14:14 +0200] “GET / HTTP/1.1″ 200 1234 “http://www.fromserver.com/from.htm” “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”
And this is an example of records AWStats found in your log file (the record number 50 in your log):
113.227.9.179 – - [27/Sep/2010:10:34:49 +0800] “GET /forum/styles/prosilver_se/theme/images/border_right.gif HTTP/1.1″ 200 124
Setup (‘/etc/awstats/awstats.broncho.cn.conf’ file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in ‘docs’ directory).

原来的日志按天分割的:

CustomLog “|/usr/local/sbin/cronolog /var/log/httpd/broncho.cn_access_log.%Y%m%d” common

按错误提示,修改为:

CustomLog "|/usr/local/sbin/cronolog /var/log/httpd/broncho.cn_access_log.%Y%m%d" combined

浏览 http://192.168.1.222/awstats/awstats.pl?config=broncho.cn 就可以看到效果。

定时分析日志,在服务器负载比较低的时候,一般是凌晨3,4点。

[root@athena~]# vim /usr/share/awstats/wwwroot/cgi-bin/awstats.sh

#!/bin/bash

cd /usr/share/awstats/wwwroot/cgi-bin
perl awstats.pl -update -config=broncho.cn

[root@athena~]# chmod 755 /usr/share/awstats/wwwroot/cgi-bin/awstats.sh

[root@athena~]# crontab -e
0 3 * * * /usr/share/awstats/wwwroot/cgi-bin/awstats.sh

Pages: 1 2 Next