在linux上部署svn

  • A+
所属分类:运维教程

一、svn的安装

yum -y install subversion
#通过yum安装svn服务

二、创建目录并初始化

mkdir /tmp/svn
#在/tmp下创建目录svn,这里只是举个例子,可在其它目录创建
svnadmin create /tmp/svn/repos
#初始化该目录,命名为/tmp/svn/repos

三、导入代码

需要准备代码,所以我们创建一个模拟目录以及文件:

mkdir /tmp/www
cd /tmp/www
mkdir trunk branches tags
cd trunk
echo html > a.html

上面的命令很简单,就不给大家解释了,如有问题,可在下面留言!

svn import /tmp/www file:///tmp/svn/repos -m "banben1"
#将/tmp/www目录的代码导入到/tmp/svn/repos里,并标识banben1

四、启动服务

vim /etc/init.d/svnserve
#修改启动配置文件
args="--deamon --pid-file=${pidfile} -r /tmp/svn"
#将这一行改为如上所示,主要修改启动服务调用目录
service svnserve start
#修改好后,启动服务即可

五、打开上传权限

vim /tmp/svn/repos/conf/svnserve.conf
#修改配置文件,开启上传权限
anon-access = read
auth-access = write
password-db = passwd
realm = My shell project
#将以上四行的注释去掉,使其生效
vim /tmp/svn/repos/conf/passwd
#修改配置文件,添加用户身份
dev = client
#添加用户格式如上,前面是用户名,后为密码,中间等号,等号两边要有空格

六、代码同步

  • 代码下载:
cd /var/www/html
#我们进入apache根目录,进行代码同步
svn checkout svn://192.168.18.250/repos
#同步这台主机的repos目录中的代码
  • 代码上传:
cd /var/www/html/repos/trunk
#进入同步后的目录
echo test > index.html
#模拟代码更新
svn add index.html
#标记新版本的代码文件
svn commit -m "banben2"
#提交上传,并标识banben2
  • 版本更新:
svn update  
#通过命令可以同步代码版本
  • 问答中心
  • 微信小程序扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:26   其中:访客  26   博主  0

    • avatar more...

      I think this is one of the most vital info for me. And i’m glad reading your article. But wanna remark on few general things, The site style is great, the articles is really excellent : D. Good job, cheers

      • avatar grolyrtolemcs

        Thanks for another wonderful article. Where else could anyone get that type of info in such an ideal way of writing? I have a presentation next week, and I’m on the look for such information.

        • avatar cbd oil that works 2020

          Its like you learn my thoughts! You appear to grasp so much approximately this, like you
          wrote the guide in it or something. I feel that you can do with a few % to force
          the message home a bit, but instead of that, this is fantastic blog.
          An excellent read. I will definitely be back.

          • avatar cbd oil that works 2020

            I really like your blog.. very nice colors
            & theme. Did you make this website yourself or did you hire someone to do it for you?
            Plz respond as I’m looking to design my own blog and would like to know where u got
            this from. appreciate it

            • avatar https://slips.de

              Actually no matter if someone doesn’t understand after that its up to other visitors that
              they will help, so here it takes place.

              • avatar tinyurl.com

                I’m very pleased to uncover this great site.
                I wanted to thank you for your time due to this fantastic read!!
                I definitely really liked every part of it and I have you
                bookmarked to check out new things in your web site.