標籤:開源軟體 管理工具 管理軟體 伺服器 服務端
實驗環境:
服務端:Centos 7 IP: 192.168.56.133
用戶端:window7
服務概述:
SVN(subversion)是版本管理工具,是CVS的接班人。目前,絕大多數開源軟體都使用SVN作為代碼版本管理軟體。常見的版本管理軟體有CVS、SVN、Git。
SVN運行模式:
模式一:SVN伺服器單獨運行 監聽:3690連接埠 訪問:svn://IP
模式二:SVN服務+Apache 監聽:80連接埠 訪問:http://IP 本實驗要實現的
一、安裝SVN、Apache軟體和中間組件
[[email protected] ~]# yum -y install subversion httpd mod_dav_svn
mod_dav_svn模組 : apache http 伺服器的外掛程式,可以讓版本庫通過http協議,在網站上展現。
查看是否安裝成功
[[email protected] ~]# svn --version
二、建立版本庫目錄和項目倉庫目錄
[[email protected] ~]# mkdir /var/www/repos //建立版本庫目錄
[[email protected] ~]# svnadmin create /var/www/repos/test //項目倉庫目錄
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />
#註:使用者權限配置我們使用apache的,這裡暫時不用svn內建
啟動SVN服務:
[[email protected] ~]# svnserve -d -r /var/www/repos/
-d表示以daemon方式(後台運行)運行
-r /var/www/repos指定svn根目錄是/var/www/repos
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />
三、配置Apache服務
(1)查看apache支援subversion兩個動態庫有沒有安裝成功
[[email protected] ~]# vi /etc/httpd/conf.modules.d/10-subversion.conf
#看到下面設定檔中兩個模組相關資訊,說明安裝成功。
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/8B/9F/wKioL1hTVPTwPExBAAASzdli02Y266.png-wh_500x0-wm_3-wmp_4-s_1827127941.png" title="1.png" alt="wKioL1hTVPTwPExBAAASzdli02Y266.png-wh_50" />
(2)配置apache通過mod_dav_svn模組訪問SVN伺服器
[[email protected] ~]# vi /etc/httpd/subversion.cof
<Location /svn> // Apache的虛擬目錄
DAV svn
SVNParentPath /var/www/repos //存放項目的真實目錄
AuthType Basic
AuthName "SVN server of test!" //認證是彈出的歡迎資訊
AuthUserFile /var/www/svn/repos/passwd //存放使用者名稱和密碼
AuthzSVNAccessFile /var/www/repos/svn/authz //存放使用者權限
Require valid-user
</Location>
(3)建立本地存取控制檔案/var/www/svn/passwd 後期通過httpd伺服器訪問svn時,會使用這個檔案中的使用者資訊驗證使用者和密碼。
[[email protected] ~]# mkdir /var/www/repos/svn
[[email protected] ~]# htpasswd -c /var/www/repos/svn/pass hq //使用者名稱可按需求修改
查看使用者名稱和密碼:
* 密碼是加密的 (密碼+使用者名稱 ) md5
(4)建立使用者權限檔案 /var/www/svn/authz
[[email protected] ~]# vi /var/www/svn/authz
[/] //這個表示在所有倉庫的根目錄下
hq=rw //表示hq使用者對所有倉庫根目錄下的軟體版本庫有rw許可權
(5)給目錄許可權,設定防火牆
[[email protected] ~]# chmod -R 777 /var/www/repos/
[[email protected] ~]# firewall-cmd --permanent --add-service=http
[[email protected] ~]# firewall-cmd --reload
(6)啟動Apache服務
[[email protected] ~]# systemctl enable httpd
[[email protected] ~]# systemctl restart httpd
四、訪問測試
訪問地址: http://192.168.56.133/svn/test
win7用戶端
http://tortoisesvn.net/about.zh.html
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />
註: 32位的軟體只能安裝在32位作業系統上。 我是64位,所以在安裝在64上。
下載安裝完成後,重啟電腦
在電腦中建立一檔案夾 滑鼠右鍵點擊“SVN CHeckout"
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/8B/9F/wKioL1hTVTyznR4CAAG7uYwQDZY521.png-wh_500x0-wm_3-wmp_4-s_475927230.png" title="2.png" alt="wKioL1hTVTyznR4CAAG7uYwQDZY521.png-wh_50" />
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/8B/9F/wKioL1hTVX_CUXomAAG3fkAiS64754.png-wh_500x0-wm_3-wmp_4-s_350043537.png" title="3.png" alt="wKioL1hTVX_CUXomAAG3fkAiS64754.png-wh_50" />
650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/8B/9F/wKioL1hTVdfzi033AAGkaN7Gxms219.png-wh_500x0-wm_3-wmp_4-s_3228341744.png" style="float:none;" title="4.png" alt="wKioL1hTVdfzi033AAGkaN7Gxms219.png-wh_50" />
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/8B/A3/wKiom1hTVdfzenxNAAFbSGFy4JU164.png-wh_500x0-wm_3-wmp_4-s_2401106162.png" style="float:none;" title="5.png" alt="wKiom1hTVdfzenxNAAFbSGFy4JU164.png-wh_50" />
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/8B/9F/wKioL1hTVdijbSUFAAEuh2eOehk981.png-wh_500x0-wm_3-wmp_4-s_2400729916.png" style="float:none;" title="6.png" alt="wKioL1hTVdijbSUFAAEuh2eOehk981.png-wh_50" />
如果彈出這個錯誤
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s5.51cto.com/wyfs02/M02/8B/A3/wKiom1hTVe6RcxZvAAFfznviUWc438.png-wh_500x0-wm_3-wmp_4-s_4004925855.png" title="7.png" alt="wKiom1hTVe6RcxZvAAFfznviUWc438.png-wh_50" />
查Apache的錯誤記錄檔
[[email protected] ~]# vim /var/log/httpd/error_log
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/8B/9F/wKioL1hTViOTg8RzAAAYK0M3qb0815.png-wh_500x0-wm_3-wmp_4-s_1941680492.png" title="9.png" alt="wKioL1hTViOTg8RzAAAYK0M3qb0815.png-wh_50" />
解決方案1:關閉SELlinux
解決方案2:
[[email protected] ~]# setsebool -P httpd_unified 1
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/8B/A3/wKiom1hTVjaw0BLOAAFX1_QacMg184.png-wh_500x0-wm_3-wmp_4-s_2251997258.png" title="8.png" alt="wKiom1hTVjaw0BLOAAFX1_QacMg184.png-wh_50" />
第一次寫Blog,請大家見諒!!謝謝!!
本文出自 “Dake” 部落格,請務必保留此出處http://8982757.blog.51cto.com/8972757/1883251
SVN+apache搭建一個版本控制伺服器