加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux下svn安装和使用(centos)

发布时间:2020-12-14 00:37:20 所属栏目:Linux 来源:网络整理
导读:1.安装svn 本地测试环境 centos6.5 # yum安装 yum -y install subversion# 查看svn版本 svnserve --version# 建立版本库目录mkdir /var/svnrepos# 启动svn服务svnserve -d -r /var/svnrepos# 查看进程 ps -ef |grep svnserve root 29215 1 0 10:16 ? 00:00:0

1.安装svn

本地测试环境 centos6.5

# yum安装 
yum -y install subversion
# 查看svn版本   
svnserve --version
# 建立版本库目录
mkdir /var/svnrepos
# 启动svn服务
svnserve -d -r /var/svnrepos
# 查看进程  
ps -ef |grep svnserve
    root     29215     1  0 10:16 ?        00:00:00 svnserve -d -r /var/svnrepos

2.建立版本库

创建一个新的Subversion项目

svnadmin create /var/svnrepos/test

配置用户访问

cd /var/svnrepos/test/conf
vi svnserve.conf
# 去掉前面注释    
anon-access=none
auth-access=write
password-db=passwd

添加认证用户

vi passwd
# 在[users]下面添加用户和密码 
[users]
username1=password
test=123456

3.客户端测试连接

svn co svn://ip/test
# 用户名:test  密码:123456

如果提示无法连接,请检查iptabales 端口是否开放

vi /etc/sysconfig/iptables
# 添加新开放端口
-A INPUT -p tcp -m tcp --dport 3690 -j ACCEPT
# 重启iptables
service iptables restart #centos6 
systemctl restart iptables.service #centos7

4.实现SVN与WEB同步(hook回调svn update)

假设WEB服务器根目录为/home/wwwroot/web

# checkout一份SVN
svn co svn://localhost/test /home/wwwroot/web

#修改权限为WEB用户
chown -R www:www /var/www/webroot/njlrxx

# 配置hook
cd /var/svnrepos/test/hooks/
cp post-commit.tmpl post-commit
vi post-commit

钩子的内容 start

#!/bin/sh

REPOS="$1"
REV="$2"

BASEPATH=/home/wwwroot/web
WEBPATH="$BASEPATH/"
export LANG=zh_CN.UTF-8
svn update $WEBPATH --username test --password 123456 --no-auth-cache

钩子的内容 end

chmod +x post-commit

最后操作是重启svn服务

# svn服务的
killall svnserve
# svn开启
svnserve -d -r /var/svnrepos

5.相关下载:

svn64位 客户端下载 <br />
链接:http://pan.baidu.com/s/1pLpRKZT 密码:kxj3

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读