windows server 2008 备份:
trac 的备份:
trac-admin c:\Trac\trac_db hotcopy c:\Trac\trac_db_bak
svn 的备份:
去windows server 2008 服务器上压缩C盘下面的SVN 安装目录。
linux 部署
trac: apt-get install -y apache2 libapache2-mod-wsgi sqlite python-setuptools unzip libsqlite3-dev
svn: apt-get install -y libapache2-svn apache2-utils subversion subversion-tools
svnmanager: apt-get install subversion apache2 php5 php5-cli php5-mysql php-pear mysql-server
trac 0.12 安装:
easy_install Babel==0.9.6
easy_install Genshi==0.6
python setup.py extract_messages
python setup.py update_catalog
python setup.py update_catalog
python setup.py check_catalog
python setup.py compile_catalog
python setup.py install
-----------------------------------------------------
新建一个比对案例:
mkdir /var/www/yangyang
chown -R www-data:www-data /var/www/yangyang
trac-admin /var/www/yangyang initenv
yangyang (案例名称)
tracd --port 9000 /var/www/yangyang
http://IP:9000/yangyang
----------------------------------------------------
mkdir /var/www/zaofans
将备份的trac 放在zaofans 下面解压:
unzip trac.bak.zip
mv trac.bak/ /var/www/zaofans
更改添加数据库一个增加一张.cache 的表。
sqlite3 trac.db
CREATE TABLE cache (
id text PRIMARY KEY,
generation integer
);
tracd --port 8000 /var/www/zaofans/
trac-admin /var/www/zaofans upgrade
trac-admin /var/www/zaofans wiki upgrade
http://ip:8000
trac-admin /var/www/zaofans/ deploy /var/www/zaofans/deploy
配置apache 安装目录:
vim /etc/apache/apache.conf
Alias /trac/zaofans/chrome/common /var/www/zaofans/deploy/htdocs/common
Alias /trac/zaofans/chrome/site /var/www/zaofans/deploy/htdocs/site
WSGIScriptAlias /trac/zaofans /var/www/zaofans/deploy/cgi-bin/trac.wsgi
<Directory "/var/www/zaofans/deploy/htdocs">
Order allow,deny
Allow from all
</Directory>
<Location "/trac/chrome/common/">
SetHandler None
</Location>
<Directory "/var/www/zaofans/deploy/cgi-bin">
WSGIApplicationGroup %{GLOBAL}
Order allow,deny
Allow from all
</Directory>
配置认证用户文件
<Location /trac/zaofans/login>
AuthType Basic
AuthName "Trac Login"
AuthUserFile /etc/subversion/passwd (配置一个认证用户的文件)
Require valid-user
</Location>
使用ldap 认证用户登陆文件
<Location /trac/zaofans/login>
AuthType Basic
AuthName "Trac Authorization Realm"
AuthBasicProvider ldap
AuthLDAPURL "ldap://192.168.46.120:389/ou=People,dc=zaofans,dc=com?uid?sub?(objectClass=person)"
require valid-user
</Location>
htpasswd -c /etc/subversion/passwd zhangyy (设置一个用于配置登陆的账号)
也可以直接将备份的passwd 文件复制过来
trac-admin /home/www/trac/ permission add zhangyy TRAC_ADMIN
service apache2 restart
http://ip/trac/zaofans
----------------------------------------------------------------------------------------------------
svn 的迁移
去windows server 2008 服务器上压缩C盘下面的SVN
上传至svn 服务器上。
mkdir /usr/local/svnrepos/
unzip svn.bak.zip
mv svn.bak /usr/local/svnrepos/
cd /usr/local/svnrepos/
chmod g+rws *
chmod o+rw *
cd /etc/apache2/site-available
cp -p 000-default.conf svn.conf
vim svn.conf
svnmanager:部署
mkdir -p /usr/local/svnrepos/
svnadmin create /usr/local/svnrepos/test/ 添加测试库:
chown -R www-data:www-data /usr/local/
vim /etc/apache2/apache2.conf
<Location /svn/>
DAV svn
SVNListParentPath on
SVNParentPath /usr/local/
AuthType Basic
AuthName "ZGSM SVN"
AuthUserFile /etc/subversion/passwdfile
AuthzSVNAccessFile /etc/subversion/accessfile
Require valid-user
</Location>
cd /etc/sbuversion/
touch passwdfile
touch accessfile
chown www-data:www-data passwdfile accessfile
测试:http://ip/svn/test/
http://nchc.dl.sourceforge.net/sourceforge/svnmanager/svnmanager-1.10.tar.gz
tar -zxvf svnmanager-1.10.tar.gz
mv svnmanager-1.10 svnmanager
cp -p svnmanager /var/www/html
pear install --alldeps VersionControl_SVN-0.5.1
vim /etc/apache2/apache2.conf
到最后增加:
<Directory "/var/www/html/svnmanager/">
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>
service mysqld start
#mysql
mysql>create database svn;
mysql>grant all on svn.* to svnmanager@localhost identified by "root.com";
mysql>flush privileges;
mysql>quit;
cd /var/www/html/svnmanager
cp -p config.php.linux config.php
vim config.php
<?php
$htpassword_cmd = "/usr/bin/htpasswd";
$svn_cmd = "/usr/bin/svn";
$svnadmin_cmd = "/usr/bin/svnadmin";
//Subversion locations
$svn_repos_loc = "/usr/local/svnrepos";
$svn_passwd_file = "/etc/subversion/passwdfile";
$svn_access_file = "/etc/sbuversion/accessfile";
//If the following is set, removing a repository will cause it to be
//moved to this location rather than being deleted.
$svn_trash_loc = "";
//$svnserve_user_file = "/var/www/repos/svnserve_passwd_file";
$svnserve_user_file="";
//SMTP Server for outgoing mail
$smtp_server = "smtp.mailserver.net";
$dsn = "mysqli://svnmanager:db-zaofans@localhost/svn";
$admin_name = "admin";
$admin_temp_password = "admin";
?>
service apache2 restart
http://ip/svnmanager
用admin账号登陆即可。