1、安裝環境php
Centos6.xhtml
apachemysql
subversionlinux
mysqlsql
php數據庫
執行yum命令安裝apache
yum install subversion httpd php mysql-server mod_dav_svn php-mysql php-pear php-mbstring
2、集成SVN和Apache
vim
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看是否有提示輸入用戶名密碼
3、安裝和配置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帳戶管理。