一、環境
CentOS 6.5x64 Apache/2.2.15 php-5.3.3 mysql-5.1.73
除了上面的軟件外,還有幾個包關係到後面的安裝:
php-mysql
php-pear
mod_dav_svn
直接用yum安裝
二、集成SVN和Apache
1.創建倉庫
[root@CentOSx64 ~]# mkdir -p /home/svn/repos [root@CentOSx64 ~]# svnadmin create /home/svn/repos/test [root@CentOSx64 ~]# chown -R apache:apache /home/svn
2.配置apache
在/etc/httpd/conf.d/subversion.conf目錄下查看
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so #svn使用,順序也要這樣
<Location /svn> DAV svn SVNParentPath /home/svn/repos SVNListParentPath on #這個是多版本特有的 # # # Limit write permission to list of valid users. # <LimitExcept GET PROPFIND OPTIONS REPORT> # # Require SSL connection for password protection. # # SSLRequireSSL # AuthType Basic AuthName "subversion repository" AuthUserFile /home/svn/repos/passwdfile AuthzSVNAccessFile /home/svn/repos/accessfile Require valid-user # </LimitExcept> </Location>
3.創建密碼文件及訪問文件
cd /home/svn/repos
touch passwdfile accessfile
chown apache:apache accessfile passwdfile
三、安裝和配置svnmanager
1.下載svnmanager
http://nchc.dl.sourceforge.net/sourceforge/svnmanager/svnmanager-1.03.tgz
解壓並放置到/var/www/html/下
[root@CentOSx64 ~]# tar xf svnmanager-1.03.tgz -C /var/www/html/
[root@CentOSx64 html]# ln -sv svnmanager-1.03/ svnmanager
2.安裝VersionControl_SVN
還記得我們最開始提到的php-pear包,安裝這個包後會有/usr/bin/pear命令,我們使用它來安裝VersionControl_SVN,最新的版本爲0.3.1,輸入下面的命令:
#pear install --alldeps VersionControl_SVN-0.3.1
3.向http.conf文件添加新內容
#vim /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數據庫
mysql> create database svn; mysql> grant all privileges on svn.* to 'svnmanager'@'localhost' identified by "123456"; mysql> flush privileges; mysql> quit
5.更改svnmanager的配置文件
[root@CentOSx64 ~]# cd /var/www/html/svnmanager
[root@CentOSx64 svnmanager]# cp config.php.linux config.php
[root@CentOSx64 svnmanager]# vim config.php
<?php // // SVNManager config.php file for Linux based servers // //Shell command's $htpassword_cmd = "/usr/bin/htpasswd"; $svn_cmd = "/usr/bin/svn"; $svnadmin_cmd = "/usr/bin/svnadmin"; //Subversion locations $svn_repos_loc = "/home/svn/repos"; $svn_passwd_file = "/home/svn/repos/passwdfile"; $svn_access_file = "/home/svn/repos/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 = ""; // If $svnserve_user_file is defined, then SVNManager will create a // user/password file suitable for use with SVNSERVE // // When not set, this feature isn't enabled. // // Warning: When enabled, this mode requires that passwords are stored in the database readable! // // Note: When is feature is enabled later, passwords need to be re-set before they are included in // the svnserve user file. // //$svnserve_user_file = "/var/www/repos/svnserve_passwd_file"; $svnserve_user_file=""; //SMTP Server for outgoing mail $smtp_server = "smtp.mailserver.net"; //Data Source Name (only tested with mysql and sqlite!!) // // Use the createtables.sql script to build the tables in a mysql database // // An empty SQLite database will automatically be generated with the first // startup! // //Please note that if you change the directory for a SQLite database that you //choose a location that is not accessible via web!! // $dsn = "mysqli://svnmanager:123456@localhost/svn"; //The following location is not readable from internet by means of an .htaccess file //$dsn = "sqlite://svnmanager/svnmanager.db"; //Administrator account $admin_name = "admin"; $admin_temp_password = "admin"; // If $post_create_script is defined, then this script / command will be // executed after a repository is created. // When the script/command is executed the one and only parameter will be // the physical location of the repository. // This might copy a default set of hooks or config files // // $post_create_script = "newrepo-script"; ?>
6.驗證
重啓apache,然後從瀏覽器裏輸入http://IP/svnmanager,
會自動建svn的數據表,在刷新後輸入用戶名爲admin,密碼爲admin.
記得進入用建立一個管理員帳號,因爲admin一次後失效。
四、漢化
漢化包我也沒有找到。這是已經漢化的版本
1.更改/etc/php.ini文件,設置default_charset='gb2312' 或 default_charset='gbk‘
2.更改/etc/httpd/conf/httpd.conf文件,設置AddDefaultCharset GB2312 或AddDefaultCharset GB2312
重啓apache之後就可以看到中文頁面了