一、安装环境
Centos6.x
apache
subversion
mysql
php
执行yum命令安装
yum install subversion httpd php mysql-server mod_dav_svn php-mysql php-pear php-mbstring
二、集成SVN和Apache
1.创建仓库
#mkdir -p /var/svn/repos #mkdir -p /var/svn/trash #svnadmin create /var/svn/repos/test #chown -R apache:apache /var/svn #chown -R
2.配置apache
#vim /etc/httpd/conf.d/ <Location /svn/> DAV svn SVNListParentPath on SVNParentPath /var/svn/repos #仓库路径 AuthType Basic AuthName "ZGSM SVN" AuthUserFile /var/svn/passwdfile AuthzSVNAccessFile /var/svn/accessfile Require valid-user </Location>
3.创建密码文件及访问文件
#touch /var/svn/passwdfile #touch /var/svn/accessfile #chown apache:apche passwdfile accessfile
4.启动apache并验证svn
#service httpd start
在浏览器里输入http://192.168.x.x/svn/test看是否有提示输入用户名密码
三、安装和配置svnmanager
1.下载svnmanager解压并放置到/var/www/html/下
#tar zxvf svnmanager-1.0x.tgz #mv svnmanager-1.0x svnmanager #mv svnmanager /var/www/html/
2.安装VersionControl_SVN
还记得我们最开始提到的php-pear包,安装这个包后会有/usr/bin/pear命令,我们使用它来安装VersionControl_SVN,最新的版本为0.3.1,输入下面的命令:
#pear install --alldeps VersionControl_SVN-0.3.1
3.向http.conf文件添加新内容
#vi /etc/httpd/conf/httpd.conf 添加如下内容是为了更安全: <Directory "/var/www/html/svnmanager/"> AllowOverride None Order deny,allow Deny from all Allow from all </Directory>
4.创建svnmanager使用的mysql数据库
#service mysqld start #mysql mysql>create database svn; mysql>grant all on svn.* to svnmanager@localhost identified by "111111"; mysql>flush privileges; mysql>quit;
5.更改svnmanager的配置文件
#cd /var/www/html/svnmanager/ #mv config.php.linux config.php #vi config.php 改为如下内容: <?php $htpassword_cmd = "/usr/bin/htpasswd"; $svn_cmd = "/usr/bin/svn"; $svnadmin_cmd = "/usr/bin/svnadmin"; //Subversion locations $svn_repos_loc = "/var/svn/repos"; $svn_passwd_file = "/var/svn/passwdfile"; $svn_access_file = "/var/svn/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 = "/var/svn/trash"; //$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:111111@localhost/svn"; $admin_name = "admin"; $admin_temp_password = "admin"; ?>
上方配置文件可能会缺项,每一项都要填好,务必保证全部文件 文件夹有读写权限,可以都给apache
6.验证
重启apache,然后从浏览器里输入http://192.168.x.x/svnmanager
第一次会用提示All tables are missing.
Creating requried tables...
Please reload page!
刷新就好了,输入初始用户名密码。
进去后注册一个admin账户,然后admin用户就不可用了。使用新的admin账户管理。