不是太容易. Pain past is pleasure, anyway.
1. 为了使用认证的htpasswd,安装:
aptitude install apache2-utils
2. 安装SVN和其python的binding, 创建svn项目:
aptitude install subversion python-subversion
创建svn项目:
svnadmin create /home/svn/funcat
权限:
chown -R www-data:www-data /home/svn/funcat/
chmod -R g+ws /home/svn/funcat/
3. 安装Trac:
这里是取最新版本, 而不是直接aptitude.
wget http://ftp.edgewall.com/pub/trac/Trac-0.11.1.tar.gz
tar xvvzf Trac-0.11.1.tar.gz
python setup.py install
4. 新建Trac项目:
创建数据库, 一定要指定character set为utf8
create database trac defalt character set utf8
trac-admin /home/trac/funcat initenv
按照说明, 自己设置.
5. 后续工作:
1. copy /cgi-bin to /home/trac/
2. mkdir /home/trac/truman/htdocs
设置logo:
trac.ini里的head-logo部分:
site/logo.png, 代表htdocs下的logo.png文件
vim funcat/conf/trac.conf
把charset改为utf-8
6. 配置lighttpd:
- $HTTP["host"] =~ "www.xcda.cn"{
- server.document-root = "/home/trac/",
- server.errorlog = "/var/log/lighttpd/trac_err.log",
- accesslog.filename = "/var/log/lighttpd/trac_access.log",
- fastcgi.server = ("/trac" =>
- ("trac" =>
- ("socket" => "/tmp/trac-fastcgi.sock",
- "bin-path" => "/home/trac/cgi-bin/trac.fcgi",
- "check-local" => "disable",
- "bin-environment" =>
- (
- "TRAC_ENV" => "/home/trac/funcat",
- )
- )
- )
- ),
- auth.backend = "htpasswd",
- auth.backend.htpasswd.userfile = "/usr/local/sbin/htpasswd.htaccess",
- auth.require = (
- "/trac/" =>(
- "method"=>"basic",
- "realm"=>"funcat",
- "require"=>"valid-user"
- )
- )
- }
7. 权限设置:
这里采取htpasswd文件的办法.
创建, 添加一个用户:
htpasswd -c /var/lib/trac/project01/htpasswd.htaccess daniel
会提醒输入密码/re输入密码.
8. 把这个用户添加到Trac:
trac-admin /home/trac/truman/ permission add daniel TRAC_ADMIN
9启动svn
svnserve -d -r /home/svn/funcat