#
# 转载请注明出处: http://yemaosheng.com
# 将以下代码直接贴到命令行中运行即可
#
#改用国内的yum源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save
wget http://centos.ustc.edu.cn/CentOS-Base.repo
sed -i 's#gpgcheck=1#gpgcheck=0#' CentOS-Base.repo
#安装subversion及apache和python的相应模块
yum install -y subversion mod_dav_svn mod_python python-setuptools
#下载安装python模板clearsilver
wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/clearsilver/python-clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
#建svn及trac目录
mkdir /srv/svn
mkdir /srv/trac/
#安装Trac
wget http://ftp.edgewall.com/pub/trac/Trac-0.11.4.tar.gz
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 "<Location /svn/project>\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</Location>" >> /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 "<Location /trac/project>\nSetHandler mod_python\nPythonHandler trac.web.modpython_frontend\nPythonOption TracEnv /srv/trac/project\nPythonOption TracUriRoot /trac/project\n</Location>\n<Location "/trac/project/login">\nAuthType Basic\nAuthName \"trac\"\nAuthUserFile /srv/trac/project.htpasswd\nRequire valid-user\n</Location>" >> /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: http://127.0.0.1/svn/project/
#Trac: http://127.0.0.1/trac/project/ |
#
# 转载请注明出处: http://yemaosheng.com
# 将以下代码直接贴到命令行中运行即可
#
#改用国内的yum源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save
wget http://centos.ustc.edu.cn/CentOS-Base.repo
sed -i 's#gpgcheck=1#gpgcheck=0#' CentOS-Base.repo
#安装subversion及apache和python的相应模块
yum install -y subversion mod_dav_svn mod_python python-setuptools
#下载安装python模板clearsilver
wget http://dag.wieers.com/rpm/packages/clearsilver/clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i clearsilver-0.10.4-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/clearsilver/python-clearsilver-0.10.4-1.el5.rf.i386.rpm
rpm -i python-clearsilver-0.10.4-1.el5.rf.i386.rpm
#建svn及trac目录
mkdir /srv/svn
mkdir /srv/trac/
#安装Trac
wget http://ftp.edgewall.com/pub/trac/Trac-0.11.4.tar.gz
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 "<Location /svn/project>\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</Location>" >> /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 "<Location /trac/project>\nSetHandler mod_python\nPythonHandler trac.web.modpython_frontend\nPythonOption TracEnv /srv/trac/project\nPythonOption TracUriRoot /trac/project\n</Location>\n<Location "/trac/project/login">\nAuthType Basic\nAuthName \"trac\"\nAuthUserFile /srv/trac/project.htpasswd\nRequire valid-user\n</Location>" >> /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: http://127.0.0.1/svn/project/
#Trac: http://127.0.0.1/trac/project/
备份脚本
#!/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/ |
#!/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/
Related Posts