很久以前装了一个python2.4+trac0.12
使用的cgi+sqlite,很多不会的,后续进行了很多修改。最终成公司现有的版本
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql --with-extra-charsets="gbk gb2312 big5 utf8" --with-plugins=all --with-plugins=innobase
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
mv mysql.server mysqld
chkconfig --add mysqld
chmod +x mysqld
也可以到:http://download.csdn.net/source/2184235下载
AuthName subversion
AuthMySQLHost localhost
AuthMySQLUser root
AuthMySQLPassword chenyidong
AuthMySQLDB radius
AuthMySQLPort 3306
AuthMySQLUserTable admin
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLAuthoritative On
AuthMySQLEnable On
AuthMySQLPwEncryption none
Require valid-user
</Directory>
如要加密密码请使用:
AuthMySQLPwEncryption:密码的加密方式(none | crypt | scrambled | md5 | aes | sha1)
none 不加密
ceypt Unix的加密方式
scrambled mysql的加密方式
md5 md5加密方式
aes aes加密方式
sha1 sha1加密方式
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/local/bin/python
make
make install
Usage: trac-admin </path/to/projenv> [command [subcommand] [option ...]]
Invoking trac-admin without command starts interactive mode.
help Show documentation
initenv Create and initialize a new environment
Serving on 0.0.0.0:8080 view at http://127.0.0.1:8080/
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /opt/tracpro
# PythonOption TracEnv /opt/tracpro/mypro 这里是单项目时,好像不太好用,就用上面的
PythonOption TracUriRoot /trac/
PythonOption PYTHON_EGG_CACHE /tmp/egg-cache
AuthType Basic
AuthName "我新做的trac"
AuthUserFile /opt/etc/passwd
Require valid-user
</Location>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir n_frontend
PythonOption TracEnvParentDir /opt/tracpro
PythonOption TracUriRoot /trac/
PythonOption PYTHON_EGG_CACHE /tmp/egg-cache
AuthType Basic
AuthName "这里是新trac的mysql认证"
AuthMySQLAuthoritative on
AuthBasicAuthoritative off
AuthMySQLHost 数据库ip
AuthMySQLUser root
AuthMySQLPassword 数据库密码
AuthMySQLDB bugfree2
AuthMySQLUserTable bf_TestUser
AuthMySQLNameField UserName
AuthMySQLPasswordField UserPassword
AuthMySQLPwEncryption md5
Require valid-user
</Location>
2. 生成pot
python setup.py extract_messages
3. 编译po(这里可以指定编译为哪种语言,不指定就是全部)
python setup.py update_catalog
4. 检查你要的语言装了没
python setup.py update_catalog -l zh_CN
5. 编译为mo
python setup.py compile_catalog -f
6. 安装trac
python setup.py install
今天想换个python2.6,trac0.12.3,再重新装次,一次性完工。
1、安装python
先检查老版版本
python -V
2.4的
tar jxvf Python-2.6.5.tar.bz2
cd Python-2.6.5
./configure
make && make install
Python 默认安装目录在/usr/local/lib/python2.6
/usr/local/bin/python2.6 -V
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python2.6 /usr/bin/python
python -V
vim /usr/bin/yum
将首行显示的 !#/usr/bin/python 修改为 !#/usr/bin/python2.4
测试yum。 ok,python结束。
2、安装数据库,
SQLite或者MySQL
以前用的sqlite,后来装了mysql,可以同时用。不过,trac实在是不大,每个项目分开,用了一年多,才1M多,用mysql浪费。算了,这次还是全部都装。
rpm -qa | grep sqlite
没有装
sqlite-3.3.6-2、
python-sqlite-1.1.7-1.2.1版本可以换,无所谓。
mysql自己安装,不会问百度。
shell> useradd -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql --with-extra-charsets="gbk gb2312 big5 utf8" --with-plugins=all --with-plugins=innobase
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
mv mysql.server mysqld
chkconfig --add mysqld
chmod +x mysqld
如果以后trac想集成,最好装
mod_auth_mysql。就是让trac在apache上集成mysql验证的。
这里我装下吧,好久没搞过了。
下载补丁
http://sourceforge.net/tracker/?func=detail&aid=1437139&group_id=60218&atid=493464
下载:http://sourceforge.net/tracker/download.php?group_id=60218&atid=493464&file_id=168517&aid=1437139
也可以到:http://download.csdn.net/source/2184235下载
tar zxvf mod_auth_mysql-3.0.0.tar.gz
cd mod_auth_mysql-3.0.0
patch -p0 < apache22.diff
/usr/local/apache2/bin/apxs -c -L/usr/local/mysql/lib/mysql -I/usr/local/mysql/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
注 :这里是
-I/usr/local/mysql/include/mysql I是大写的i, 后面是小写的L
/usr/local/apache2/bin/apxs -i mod_auth_mysql.la
现在就可以在httpd.conf中加入
LoadModule mysql_auth_module modules/mod_auth_mysql.so
随便提下,apache怎么调用mysql表认证。
<Directory "/var/www/html/radius">
AuthType Basic
AuthName subversion
AuthMySQLHost localhost
AuthMySQLUser root
AuthMySQLPassword chenyidong
AuthMySQLDB radius
AuthMySQLPort 3306
AuthMySQLUserTable admin
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLAuthoritative On
AuthMySQLEnable On
AuthMySQLPwEncryption none
Require valid-user
</Directory>
如要加密密码请使用:
AuthMySQLPwEncryption:密码的加密方式(none | crypt | scrambled | md5 | aes | sha1)
none 不加密
ceypt Unix的加密方式
scrambled mysql的加密方式
md5 md5加密方式
aes aes加密方式
sha1 sha1加密方式
3、安装mod_python
以前安装trac的时候使用的cgi+apache,后来做整合,才切到mod_pyton。这个是比cgi好 ,恩,一开始就用mod_pyhon
wget http://apache.mirror.phpchina.com/httpd/modpython/mod_python-3.3.1.tgz 不过这里好像下不了了,把上次搞的直接贴出来,
3.3.1已经够了。
这里要注意,只有最新版本才支持2.2.2以上的apache。
tar xzvf mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/local/bin/python
make
make install
在make的时候,如果出现下面的错误:
connobject.c: In function '_conn_read':
connobject.c:142: error: request for member 'next' in something not a structure or union
apxs:Error: Command failed with rc=65536
make[1]: *** [mod_python.so] 错误 1
make[1]: Leaving directory `/tmp/mod_python-3.3.1/src'
make: *** [do_dso] 错误 2
connobject.c:142: error: request for member 'next' in something not a structure or union
apxs:Error: Command failed with rc=65536
make[1]: *** [mod_python.so] 错误 1
make[1]: Leaving directory `/tmp/mod_python-3.3.1/src'
make: *** [do_dso] 错误 2
修改src下的connobject.c
!(b == APR_BRIGADE_SENTINEL(b) ||
改成!(b == APR_BRIGADE_SENTINEL(bb) ||
重新安装
4、 安装setuptools
[如果你不想用easyInstall,此步可以省略,下面的步骤中我们确实没有用到easyInstall,但是,以后会用到的,我建议安装,好处,你会懂的]
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
Setuptools version 0.6c11 or greater has been installed.
(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)
python ez_setup.py -U setuptools
发现已经有了
5、安装ClearSliver(
页面模板引擎)
# tar -zxvf clearsilver-0.10.5.tar.gz
# cd clearsilver-0.10.5
# ./configure --with-python=/usr/bin/python --prefix=/usr/local --disable-ruby --disable-java --disable-apache --disable-csharp --disable-perl
# make
# make install
# cd python/
# python ./setup.py install
Finished processing dependencies for clearsilver==0.10.5
另外,说在网上有rpm包,python-clearsilver-0.10.4-4.fc5.rpm、clearsilver-0.10.4-4.fc5.rpm,没用过,自己编译算了。
6、 安装trac。
还是装0.12吧,因为有中文包,呵呵。
# tar zxvf Trac-0.12.3.tar.gz
# cd Trac-0.12.3
# python setup.py install
# mkdir /opt/tracpro #以后扔项目
# trac-admin
trac-admin - The Trac Administration Console 0.12.3
Usage: trac-admin </path/to/projenv> [command [subcommand] [option ...]]
Invoking trac-admin without command starts interactive mode.
help Show documentation
initenv Create and initialize a new environment
ok了。
# trac-admin /opt/tracpro/mypro initenv
输入项目名
输入数据库。
用SQLite直接回车即可
,用mysql后面介绍,这里用的SQLite,因为trac真心不大,用SQLite完全可以满足三年内的需求,当然,你要用mysql,我也没意见。
这里送两句话:
CREATE DATABASE tractest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
trac-admin [project-name] initenv [Project Name] mysql://trac:trac@localhost/[db_name] 修改mysql
想用mysql的,照抄,注:trac我要使用中文的,一定用utf8
友情提示
#chown apache.apache -R /opt/tracpro/mypro
#chmod 755 -R /opt/tracpro/mypro 或者直接777
测试:
# tracd --port 8080 /opt/tracpro/mypro/
Server starting in PID 16985.
Serving on 0.0.0.0:8080 view at http://127.0.0.1:8080/
7、 apache和trac集成
apache和trac集成,有多种验证方式,我只做过两种,这里重新做的,还是简单介绍下。(使用用apache认证的缺点不说了,自己用多了就会发现)
第一种、直接用apache的htpasswd,可以和svn集成。文本存储,方便看。
第二种、还记得之前“3”步骤 ,装了个
mod_auth_mysql,后面有些apache怎么调用mysql的表认证(这里的mysql表和之前建项目的mysql数据库是两个概念,你也可以把帐号、密码的表建在任意mysql数据库里。)
后面还有很多种,因为我没用,所以就不介绍了,不过,有点的记住,trac是不保存认证的。她只保存用户的名,成它的session里面的sid,做权限控制,也是靠这个id来控制的。
第一种:apache文本认证
在vim /usr/local/apache2/conf/httpd.conf
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /opt/tracpro
# PythonOption TracEnv /opt/tracpro/mypro 这里是单项目时,好像不太好用,就用上面的
PythonOption TracUriRoot /trac/
PythonOption PYTHON_EGG_CACHE /tmp/egg-cache
AuthType Basic
AuthName "我新做的trac"
AuthUserFile /opt/etc/passwd
Require valid-user
</Location>
注:使用了mod_python,第3步的时候我们编译过mod_python,在apache的httpd.conf里面添加LoadModule python_module modules/mod_python.so
AuthUserFile /opt/etc/passwd 是密码
/usr/local/apache2/bin/htpasswd -c /opt/tracpro/etc/passwd test
第一次创建密码加-c,后面就不用了
第二种、mysql认证
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir n_frontend
PythonOption TracEnvParentDir /opt/tracpro
PythonOption TracUriRoot /trac/
PythonOption PYTHON_EGG_CACHE /tmp/egg-cache
AuthType Basic
AuthName "这里是新trac的mysql认证"
AuthMySQLAuthoritative on
AuthBasicAuthoritative off
AuthMySQLHost 数据库ip
AuthMySQLUser root
AuthMySQLPassword 数据库密码
AuthMySQLDB bugfree2
AuthMySQLUserTable bf_TestUser
AuthMySQLNameField UserName
AuthMySQLPasswordField UserPassword
AuthMySQLPwEncryption md5
Require valid-user
</Location>
ok,到这里,登录用户都解决了。
但是,权限没有配
trac-admin /opt/tracpro/mypro permission add test TRAC_ADMIN
这样,这个test id就拥有看TRAC_ADMIN的权限了。
8、svn
这个先不写,懒,有时间再写。
9、汉化
你懂的,原版看了累。还是用中文版吧
http://trac.edgewall.org/wiki/TracL10N 怎么安装,这里有写
1. 安装babel
sudo easy_install babel
2. 生成pot
python setup.py extract_messages
3. 编译po(这里可以指定编译为哪种语言,不指定就是全部)
python setup.py update_catalog
4. 检查你要的语言装了没
python setup.py update_catalog -l zh_CN
5. 编译为mo
python setup.py compile_catalog -f
6. 安装trac
python setup.py install
注:重新安装时,apache要stop
10、插件
这里自己安装,trac还是有很多很好的插件的。
几个附件
http://download.csdn.net/detail/yllzl/4273070
http://download.csdn.net/detail/yllzl/4273085
http://download.csdn.net/detail/yllzl/4273081
http://trac-hacks.org/wiki/
几个附件
http://download.csdn.net/detail/yllzl/4273070
http://download.csdn.net/detail/yllzl/4273085
http://download.csdn.net/detail/yllzl/4273081