天天看點

基于submin 來管理Subversion倉庫

1/安裝svn,建立版本庫

yum install subversion

mkdir /data/svn -p

svnadmin create /data/svn/oudianyun

2、下載下傳安裝submin

mkdir /usr/local/submin -p

#wget 不下來,直接複制下載下傳連結web頁面下載下傳

tar zxf submin-1.2.10.tar.gz

cd submin-1.2.10/bin

python ./install.py /usr/local/submin/

/usr/local/submin/bin/submin-admin create default

yum  install  apr apr-util

yum install mod_dav_svn

這裡會自動生成一些檔案,這裡authz是管理使用者的權限;htpasswd是管理使用者的密碼;

userproperties是管理使用者的其他資訊(郵箱等);default.conf是主配置檔案,

之後需要修改;最後一個檔案是和apache的整合,需要添加到apache的主配置檔案裡面。

#添加環境變量檔案:

1

2

3

4

<code>######submin######</code>

<code>SUBMIN_HOME=</code><code>/usr/local/submin</code>

<code>export</code> <code>SUBMIN_HOME</code>

<code>export</code> <code>PATH=${PATH}:${SUBMIN_HOME}</code><code>/bin</code>

3、安裝apache

yum install httpd -y

#添加以下行

vim /etc/httpd/conf/httpd.conf 

Include /etc/submin/default-apache-cgi.conf

4、配置submin的相關檔案

ln -s /etc/submin/default-apache-cgi.conf /etc/httpd/conf.d/submin.conf

這個檔案之後需手動修改,做連結目的友善管理

cp /var/lib/submin/authz /data/svn

cp /var/lib/submin/htpasswd /data/svn

cp /var/lib/submin/userproperties.conf /data/svn

把submin的使用者資訊檔案複制到我們自己之前建立的svn庫的根目錄中

rm -rf /var/lib/submin/svn/

ln -s /data/svn /var/lib/submin/svn

chown -R apache:apache /data/svn

因為要用apache登入,是以這裡把svn庫根目錄的使用者進行修改

vim /etc/submin/default.conf

5

6

7

8

9

10

11

12

13

14

<code>[svn]</code>

<code>authz_file = </code><code>/data/svn/authz</code>

<code>userprop_file = </code><code>/data/svn/userproperties</code><code>.conf</code>

<code>access_file = </code><code>/data/svn/htpasswd</code>

<code>repositories = </code><code>/data/svn</code>

<code>[www]</code>

<code>base_url = </code><code>/submin</code>

<code>svn_base_url = </code><code>/svn</code>

<code>#添加這行,否則web頁面建庫報錯。</code>

<code>trac_base_url = </code><code>/svn</code>

<code>[backend]</code>

<code>bindir = </code><code>/usr/local/submin/share/submin/bin</code>

<code>[generated]</code>

<code>session_salt = </code><code>/CMXp8k8wuOlQgC3</code>

修改submin.conf

15

16

17

18

19

20

21

22

23

24

<code>vim </code><code>/etc/httpd/conf</code><code>.d</code><code>/submin</code><code>.conf</code>

<code>    </code><code>Alias </code><code>/submin</code> <code>/usr/local/submin/share/submin/www</code>

<code>    </code><code>&lt;Directory </code><code>/usr/local/submin/share/submin/www</code><code>&gt;</code>

<code>        </code><code>Order allow,deny</code>

<code>        </code><code>Allow from all</code>

<code>        </code><code>Options ExecCGI FollowSymLinks</code>

<code>        </code><code>AddHandler cgi-script py cgi pl</code>

<code>        </code><code>SetEnv SUBMIN_CONF </code><code>/etc/submin/default</code><code>.conf</code>

<code>        </code><code>RewriteEngine on</code>

<code>        </code><code>RewriteBase </code><code>/submin</code>

<code>        </code><code>RewriteCond %{REQUEST_FILENAME} !-f</code>

<code>        </code><code>RewriteRule ^(.+)$ submin.cgi/$1</code>

<code>        </code><code>RewriteRule ^/?$ submin.cgi/</code>

<code>    </code><code>&lt;</code><code>/Directory</code><code>&gt;</code>

<code>    </code><code>&lt;Location </code><code>/svn</code><code>&gt;</code>

<code>        </code><code>DAV svn</code>

<code>        </code><code>SVNParentPath </code><code>/data/svn</code>

<code>        </code><code>AuthType Basic</code>

<code>        </code><code>AuthName </code><code>"Subversion repository"</code>

<code>        </code><code>AuthUserFile </code><code>/data/svn/htpasswd</code>

<code>        </code><code>AuthzSVNAccessFile </code><code>/data/svn/authz</code>

<code>        </code><code>Satisfy Any</code>

<code>        </code><code>Require valid-user</code>

<code>    </code><code>&lt;</code><code>/Location</code><code>&gt;</code>

/etc/init.d/httpd restart

http://192.168.121.128/submin   預設使用者密碼admin  admin

登入後再web頁面修改密碼;

<a href="http://s4.51cto.com/wyfs02/M02/8A/2A/wKioL1gpv_ezOUZZAAGye3_4kaM888.png-wh_500x0-wm_3-wmp_4-s_2441104563.png" target="_blank"></a>

建立一個svn倉庫:

<a href="https://s1.51cto.com/wyfs02/M01/8E/96/wKiom1jGNC2QxczJAAD0JuSPdCY224.png" target="_blank"></a>

#伺服器端的svn倉庫同時也是可以看到的。

<a href="https://s4.51cto.com/wyfs02/M01/8E/94/wKioL1jGNH6yxJsuAAAfvDzoxg0099.png" target="_blank"></a>

#測試建立個使用者授權:submin對使用者的密碼是有要求的,太短登入不了的,測試時發現的。

使用者lisi登入檢視:

<a href="https://s4.51cto.com/wyfs02/M01/8E/94/wKioL1jGO22izxLHAAEVVGVAePQ892.png" target="_blank"></a>

#建立使用者,密碼需要輸入2次哦:

<a href="https://s2.51cto.com/wyfs02/M02/8F/8D/wKiom1jknZCg0F_GAADcYwWaVzU549.png" target="_blank"></a>

windows用戶端軟體chkout和commit測試:

chkout完成。

<a href="https://s5.51cto.com/wyfs02/M00/8E/97/wKiom1jGSm-wIh8MAAE-6FrJZLQ054.png" target="_blank"></a>

commit送出測試:

<a href="https://s1.51cto.com/wyfs02/M01/8E/96/wKioL1jGSuygscrAAAEsGh-sgGk058.png" target="_blank"></a>

commit 完全ok。

<a href="https://s1.51cto.com/wyfs02/M02/8E/97/wKiom1jGSwTRVowQAAFJbzO0s54378.png" target="_blank"></a>

本文轉自青衫解衣 51CTO部落格,原文連結:http://blog.51cto.com/215687833/1872800