设为首页 收藏本站
查看: 925|回复: 0

[经验分享] Centos 6.5 Epel源——apache+SVN

[复制链接]

尚未签到

发表于 2018-11-21 13:48:27 | 显示全部楼层 |阅读模式
  1.实验环境

  svn server(subversion):192.168.40.129
  svn client(TortoiseSVN):下载地址(http://tortoisesvn.net/downloads.html)
  2.准备epel源
[root@localhost ~]# rpm  -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.HjLnDh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]更新epel源仓库:
[root@localhost ~]# yum repolist  3.安装相关软件包
[root@localhost ~]# yum -y install httpd httpd-devel mod_dav_svn subversion mod_ssl
httpd,mod_dav_svn,httpd-devel,mod_ssl支持WEB形式管理SVN
subversion (SVN服务器)  4.查看是否安装了svn模块
[root@localhost ~]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
#查看svn版本:
[root@localhost ~]# svn --version
svn, version 1.6.11 (r934486)
   compiled Mar  6 2014, 10:49:10
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository access (RA) modules are available:
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme  5.svn服务器的配置:
  新建一个目录用于存储SVN所有文件
[root@localhost ~]# mkdir /data/svn -p  

  新建一个版本仓库
[root@localhost ~]# svnadmin create /data/svn/
[root@localhost ~]# cd /data/svn/
[root@localhost svn]# ls
conf  db  format  hooks  locks  README.txt
#更改/data/svn属主属组:
[root@localhost svn]# chown -R apache.apache /data/svn/  6.配置subversion.conf
  加载mod_dav_svn模块,一般apache2己正常加载这两个模块  apache需要加载mod_dav_svn模块。如果apache是按照与预设目录安装的,mod_dav_svn模块应该会安装在apache安装位置(默认路径是/etc/httpd/)的 modules子目录内。同时apache的配置文件httpd.conf(默认路径为etc/httpd/conf/)中已经使用LoadModule指令加载了该模块(如果没有,手动添加)注意这个指令必须出现在其它的Subversion相关指令之前。还要加载mod_authz_svn.so模块。
[root@localhost conf.d]# vim /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

     DAV svn
#   SVNParentPath /var/www/svn
    SVNPath /data/svn
    SVNListParentPath on
#   # Limit write permission to list of valid users.
#   
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
      AuthType Basic
      AuthName "svn for project"
      AuthUserFile /data/svn/passwdfile
      AuthzSVNAccessFile /data/svn/accessfile
      Require valid-user
#   
  7.添加用户和密码:
[root@localhost conf.d]# htpasswd -c /data/svn/passwdfile kaibin
New password:
Re-type new password:
Adding password for user kaibin
[root@localhost conf.d]# htpasswd /data/svn/passwdfile zhangsan
New password:
Re-type new password:
Adding password for user zhangsan  8.重启apache
[root@localhost ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:  9、下面创建权限访问控制文件,可自行查看具体权限:
# vim /data/svn/accessfile
[/]
*=rw
[groups]
dev=kaibin
test=zhangsan
[svn-test:/]
@test=r
@dev=r
[repos:/test]
@test=rw
*=  10.启动svn服务器
[root@localhost svn]# svnserve -d -r /data/svn  11.用客户端登陆:
DSC0000.jpg

  12.svn常用命令
  svn服务器地址:192.168.40.129
  1.查看文件详情信息
[root@test ~]# svn info http://192.168.40.129/svn-test
Path: svn-test
URL: http://192.168.40.129/svn-test
Repository Root: http://192.168.40.120/svn-test
Repository UUID: ad541a1c-e001-4760-8689-1949c7d67214
Revision: 1
Node Kind: directory
Last Changed Author: kaibin
Last Changed Rev: 1
Last Changed Date: 2015-01-28 18:51:12 -0800 (Wed, 28 Jan 2015)  2.将文件checkout到本地/test
[root@test ~]# mkdir /test
[root@test ~]# svn checkout http://192.168.40.129/svn-test /test/
A    /test/新建文本文档.txt
Checked out revision 1.
[root@test ~]# cd /test/
[root@test test]# ls
新建文本文档.txt  

  3.将新建的文件提交到代码服务器上
[root@test test]# echo "This is a test" >> test.txt
[root@test test]# ls
test.txt  新建文本文档.txt
[root@test test]# svn add test.txt
A         test.txt  4.将修改的文件提交到版本库
[root@test test]# svn commit -m "This is a renew" test2.txt
Adding         test2.txt
Transmitting file data .
Committed revision 2.  5.更新到某个版本

  •   将hosts文件更新到版本4
[root@test svn-test]# svn update -r 4 hosts
U    hosts
Updated to revision 4.

  •   将所有文件更新到版本4
[root@test svn-test]# svn update
At revision 4.
[root@test svn-test]# svn -r 4 update
At revision 4.  6.显示文件和子目录状态
[root@test ~]# svn status -v svn-test/
                 4        4 kaibin       svn-test
                 4        4 kaibin       svn-test/hosts
                 4        1 kaibin       svn-test/新建文本文档.txt
[root@test ~]# cd svn-test/
[root@test svn-test]# svn status -v hosts
                 4        4 kaibin       hosts  第一列保持相同,第二列显示工作版本号,第三列显示最后一次修改人和版本号.
  7.查看日志
[root@test ~]# svn log svn-test/hosts
------------------------------------------------------------------------
r4 | kaibin | 2015-03-05 18:13:46 -0800 (Thu, 05 Mar 2015) | 1 line
xiu gai hosts wen jian..
------------------------------------------------------------------------
r3 | kaibin | 2015-03-05 17:20:38 -0800 (Thu, 05 Mar 2015) | 1 line
This is a test2.
------------------------------------------------------------------------
r2 | kaibin | 2015-03-05 17:19:58 -0800 (Thu, 05 Mar 2015) | 1 line
This is a test.
------------------------------------------------------------------------  8.比较版本之间的差异
[root@test ~]# svn diff -r 4:5 svn-test/hosts
Index: svn-test/hosts
===================================================================
--- svn-test/hosts    (revision 4)
+++ svn-test/hosts    (revision 5)
@@ -17,3 +17,4 @@
192.168.40.145    test.server03 test.server03.com
192.168.40.145    test.server03 test.server03.com
192.168.40.145    test.server03 test.server03.com
+192.168.40.148    test.server03 test.server03.com
[root@test ~]# svn diff -r 2:5 svn-test/hosts
Index: svn-test/hosts
===================================================================
--- svn-test/hosts    (revision 2)
+++ svn-test/hosts    (revision 5)
@@ -6,3 +6,15 @@
192.168.40.145    test.server03 test.server03.com
192.168.40.145    test.server03 test.server03.com
192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.145    test.server03 test.server03.com
+192.168.40.148    test.server03 test.server03.com  9.查看版本库下的文件和列表
[root@test ~]# svn list http://192.168.40.129/svn-test
hosts
新建文本文档.txt  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-637856-1-1.html 上篇帖子: apache 2.4 下篇帖子: 使用Apache配置Tomcat应用整合PHP论坛-Discuz
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表