#安装subversion及apache和python的相应模块
yum install -y subversion mod_dav_svn mod_python python-setuptools
#下载安装python模板clearsilver
wget
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
wget
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
#建svn及trac目录
mkdir /srv/svn
mkdir /srv/trac/
#安装Trac
wget
tar zxvf Trac-0.11.4.tar.gz
cd Trac-0.11.4
python setup.py build && python setup.py install
#新建svn项目
svnadmin create /srv/svn/project
#新建trac项目
trac-admin /srv/trac/project initenv
#按提示操作,`Path to repository` is: /srv/svn/project
#改文件所属为apache
chown -R apache.apache /srv/svn/project
chown -R apache.apache /srv/trac/project
#新建svn的apache配置文件
echo -e "\nDAV svn\nSVNPath /srv/svn/project\nAuthType Basic\nAuthName \"project Repository\"\nAuthzSVNAccessFile /srv/svn/svn-acl-conf\nAuthUserFile /srv/svn/project.htpasswd\nRequire valid-user\n" >> /etc/httpd/conf.d/subversion.conf
#生成svn的用户名密码
touch /srv/svn/project.htpasswd
htpasswd -m /srv/svn/project.htpasswd svnroot
#生成svn用户所对应的acl权限
echo -e "[project:/]\nsvnroot = rw" >> /srv/svn/svn-acl-conf
echo -e "\nSetHandler mod_python\nPythonHandler trac.web.modpython_frontend\nPythonOption TracEnv /srv/trac/project\nPythonOption TracUriRoot /trac/project\n\n\nAuthType Basic\nAuthName \"trac\"\nAuthUserFile /srv/trac/project.htpasswd\nRequire valid-user\n" >> /etc/httpd/conf.d/trac.conf
#生成trac的用户名密码
touch /srv/trac/project.htpasswd
htpasswd -m /srv/trac/project.htpasswd tracroot
#生成tracroot用户的权限
trac-admin /srv/trac/project permission add tracroot TRAC_ADMIN
#重启apache
service httpd restart
#SVN:
#Trac:
添加新用户:htpasswd -m /srv/svn/project.htpasswd username
echo -e "username = rw" >> /srv/svn/svn-acl-conf
备份脚本
#!/bin/sh
svnadmin hotcopy /srv/svn/project /srv/svn_bak/project/
cd /srv/svn_bak
tar -zcvf /srv/svn_bak/project_svn_.`date +%Y-%m-%d_%T`.tar.gz project/
rm -rf /srv/svn_bak/project/
trac-admin /srv/trac/project hotcopy /srv/trac_bak/project/
cd /srv/trac_bak
tar -zcvf /srv/trac_bak/project_trac_.`date +%Y-%m-%d_%T`.tar.gz project/
rm -rf /srv/trac_bak/project/
阅读(1652) | 评论(0) | 转发(0) |