天天看點

ubuntu server 安裝svn svnmanager ssl svn+apache2 內建

安裝svn和svn與apache內建的必要.so檔案 執行:

apt-get -y install libapache2-svn apache2-mpm-prefork subversion subversion-tools 
           

安裝完成後輸入

svn --version  
           

[img]http://dl.iteye.com/upload/attachment/249164/bf4e5668-d70a-3fe2-86af-3e5518a18d3c.jpg[/img]

測試是否安裝成功

如果安裝成功, 接着 SVN + apache 內建步驟:

在/etc/apache2/site-aviliables下建立dev-svn檔案指令如下:

sudo touch /etc/apache2/sites-aviliables/dev-svn  
           

編輯檔案

sudo vim /etc/apache2/sites-aviliales/dev-svn
           

在檔案中加入一下内容:

<Location /svn>   
           DAV svn   
           #/srv/svn是你的svn版本庫路徑   
           SVNParentPath /srv/svn   

           AuthType Basic   
           AuthName "Subversion Repository"  
           AuthUserFile /etc/apache2/dav_svn.passwd   

           AuthzSVNAccessFile /etc/apache2/dav_svn.authz   
           SVNListParentPath On   
          Require valid-user   
 </Location> 
           

[color=red]注意: 内容中的SVNParentPath /srv/svn 路徑如果系統中沒有的話,就手動建一個空檔案[/color]

使subversion 目錄能被 apache 程序所通路:

sudo chown -R www-data.www-data /srv/svn  
           

建立apache通路賬号檔案:

sudo mkdir /etc/apache2/dav_svn.passwd
           
sudo mkdir /etc/apache2/dav_svn.authz
           

[color=green]SVNManager安裝[/color]

安裝PHP支援類庫:

apt-get install php-pear 
           
pear install -a VersionControl_SVN-0.3.3
           

手動下載下傳svnmanager

[url]http://sourceforge.net/projects/svnmanager/files/[/url]

下載下傳後解壓到一個目錄下,我的解壓到了/opt目錄下

進入解壓後的svnmanager目錄下,修改config.php.linux複制為config.php

[img]http://dl.iteye.com/upload/attachment/249175/b334f7cb-1d14-3570-ae01-4623347ccb15.jpg[/img]

修改config.php檔案内容為:

[img]http://dl.iteye.com/upload/attachment/249180/d6b9ff96-a63f-3c63-958e-f4ec0ca6aaa4.jpg[/img][img]http://dl.iteye.com/upload/attachment/249182/19eda93a-46c1-3538-b2da-aeff8b2028c6.jpg[/img]

注意上圖中的配置

修改檔案,確定svnmanager有足夠權限通路

chmod 777 /etc/apache2/dav_svn.passwd   
chmod 777 /etc/apache2/dav_svn.authz  
           

資料庫的配置:

mysql –u root –p 
           
Mysql>create database svnmanager; 
Mysql>grant all privileges on svnmanager.* to 'svnmanager'@'localhost' identified by '[通路使用者密碼]'; 
Mysql>FLUSH PRIVILEGES; 
Mysql>quit;
           

注意:在執行grant語句是,例如:使用者密碼為password,那麼語句為

grant all privileges on svnmanager.* to 'svnmanager'@'localhost' identified by 'password';

要去掉“[]”括号

[color=green]安裝ssl [/color]

apt-get install openssl  
           
apt-get install ssl-cert  
           
a2enmod ssl 
           

建立apache下的ssl目錄:

mkdir /etc/apache2/ssl  
           

建立證書相關檔案

進入/etc/apache2/ssl目錄,建立私鈅,需要輸入兩次相同的關鍵字:

cd /etc/apache2/ssl
           
openssl genrsa -des3 -out my-server.key 1024  
           

建立證書:

openssl req -new -key my-server.key  -x509 -out my-server.crt -config /etc/ssl/openssl.cnf 
           

建立完證書後,每次重新開機apache,都會提示輸入密碼,這樣很不友善,如果系統重新開機,需要手工幹預,是以執行下面的指令可以省去這個步驟:

sudo openssl rsa -in my-server.key.org  -out my-server.key
           

[img]http://dl.iteye.com/upload/attachment/249190/804e1da2-664c-33cf-ae72-2347f6c7a40b.jpg[/img]

[img]http://dl.iteye.com/upload/attachment/249192/70118f5e-ca09-311d-bf98-602e5bd69bec.jpg[/img]

重新開機apache驗證是否成功

sudo /etc/init.d/apache2 restart
           

建立站點檔案/etc/apache2/sites-available/ssl

sudo touch /etc/apache2/sites-available/ssl 
           

添加内容:

ssl站點設為可運作:

a2ensite ssl 
           

到此svnmanager svn ssl已經配置成功!

測試:

https://192.168.2.119/svnmanager/
           

其中192.168.2.119修改你的IP位址

成功後的效果為:

[img]http://dl.iteye.com/upload/attachment/249194/039c610f-0ed3-384c-b282-2528505ab2ea.jpg[/img]

一般初始的使用者名密碼都為: admin