码迷,mamicode.com
首页 > 其他好文 > 详细

源码安装SVN

时间:2017-12-21 20:46:13      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:prot   账号密码   awk   restart   name   configure   权限控制   final   create   

环境介绍

1 [root@bogon ~]# ip a |grep inet |grep brd |awk -F "[ /]+" ‘{print $3}‘
2 192.168.9.32
3 [root@bogon ~]# cat /etc/redhat-release
4 CentOS release 6.5 (Final)
5 [root@bogon ~]# uname -r
6 2.6.32-431.el6.x86_64
7 [root@bogon ~]# uname -m
8 x86_64

 


源码包下载地址

# apr和apr-util源码包下载地址;
    * http://archive.apache.org/dist/apr
# scons源码包下载地址;访问后根据需求下载相应的版本.
    * https://sourceforge.net/projects/scons/files/scons/
    
# serf源码包下载地址;
    * http://fossies.org/linux/www/serf-1.3.8.tar.gz
# svn源码包下载地址;选择相应的版本号下载.
    * http://www.apache.org/dist/subversion
# sqlite-amalgamation包的下载
    * http://www.sqlite.org/download.html

 


安装相关依赖包

yum install unzip expat-devel zlib-devel

 


上传所需源码包

[root@bogon soft]# ls
apr-1.6.2.tar.gz       scons-2.5.1.tar.gz               subversion-1.8.19.tar.gz
apr-util-1.6.0.tar.gz  serf-1.3.9.tar.gz
openssl-1.0.1g.tar.gz  sqlite-amalgamation-3210000.zip

 


安装相关源码包(apr--->apr-util--->scons--->openssl--->serf--->svn)

#  -*- apr源码安装 -*-
[root@bogon soft]# tar xf apr-1.6.2.tar.gz -C /usr/src/
[root@bogon soft]# cd /usr/src/apr-1.6.2/
[root@bogon apr-1.6.2]# ./configure --prefix=/usr/local/apr && make && make install
#  -*- apr-util源码安装 -*-
[root@bogon soft]# tar xf apr-util-1.6.0.tar.gz -C /usr/src/
[root@bogon soft]# cd /usr/src/apr-util-1.6.0/
[root@bogon soft]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config && make && make install
#********安装错误******
    * 报错提示: "xml/apr_xml.c:35:19: 错误:expat.h:没有那个文件或目录
xml/apr_xml.c:66: 错误:expected specifier-qualifier-list before ‘XML_Parser’"
    
    ** 解决办法: 提前yum安装expat-devel
#  -*- scons源码安装 -*-
[root@bogon soft]# tar xf scons-2.5.1.tar.gz -C /usr/src/
[root@bogon soft]# cd /usr/src/scons-2.5.1/
[root@bogon scons-2.5.1]# python setup.py install
#  -*- openssl源码安装 -*-
[root@bogon soft]# tar xf openssl-1.0.1g.tar.gz -C /usr/src/
[root@bogon soft]# cd /usr/src/openssl-1.0.1g/
[root@bogon openssl-1.0.1g]# CFLAGS=-fPIC ./config --prefix=/usr/local/openssl enable-shared && make && make install
[root@bogon openssl-1.0.1g]# vim /etc/profile
    export PATH=$PATH:/usr/local/openssl/bin        # 最后添加系统环境变量
[root@bogon openssl-1.0.1g]# source /etc/profile    # 声明全局变量
[root@bogon openssl-1.0.1g]# ln -s /usr/local/openssl/include/openssl /usr/include/openssl    # 添加系统软连接
#  -*- serf源码安装 -*-
[root@bogon soft]# tar xf serf-1.3.9.tar.gz -C /usr/src/
[root@bogon soft]# cd /usr/src/serf-1.3.9/
[root@bogon serf-1.3.9]# scons PREFIX=/usr/local/serf APR=/usr/local/apr/bin/apr-1-config APU=/usr/local/apr/bin/apr-1-config OPENSSL=/usr/local/openssl/
    * 报错提示: buckets/deflate_buckets.c:23:18: error: zlib.h: No such file or directory buckets/deflate_buckets.c:
    ** 解决办法: 提前yum安装zlib-devel
[root@bogon serf-1.3.9]# scons install
[root@bogon serf-1.3.9]# cd /usr/local/serf/lib/
[root@bogon lib]# cp libserf-1.so* /usr/local/lib   # 拷贝文件到系统目录
#  -*- svn源码安装 -*-
[root@bogon soft]# tar xf subversion-1.8.19.tar.gz -C /usr/src/
[root@bogon soft]# unzip sqlite-amalgamation-3210000.zip -d /usr/src/subversion-1.8.19/
[root@bogon soft]# cd /usr/src/subversion-1.8.19/
[root@bogon subversion-1.8.19]# mv sqlite-amalgamation-3210000/ sqlite-amalgamation
[root@bogon subversion-1.8.19]# ./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-serf=/usr/local/serf/ --with-openssl=/usr/local/openssl/ --enable-mod-activation
[root@bogon subversion-1.8.19]# make && make install
[root@bogon subversion-1.8.19]# vim /etc/profile
    export PATH=$PATH:/usr/local/openssl/bin:/usr/local/svn/bin
[root@bogon subversion-1.8.19]# source /etc/profile
[root@bogon subversion-1.8.19]# vim /etc/ld.so.conf.d/libexpat.conf     # 编辑加入libexpat.so.1目录
    /usr/local/lib
[root@bogon subversion-1.8.19]# ldconfig -v     # 使配置生效

 


 

 

测试是否安装成功

 

[root@bogon ~]# svn help
[root@bogon ~]# svnserve --version
    svnserve, version 1.8.19 (r1800620)
       compiled Dec 20 2017, 10:07:39 on x86_64-unknown-linux-gnu
    Copyright (C) 2017 The Apache Software Foundation.
    This software consists of contributions made by many people;
    see the NOTICE file for more information.
    Subversion is open source software, see http://subversion.apache.org/
    The following repository back-end (FS) modules are available:
    * fs_fs : Module for working with a plain file (FSFS) repository.
[root@bogon ~]# svn --version
    svn, version 1.8.19 (r1800620)
       compiled Dec 20 2017, 10:07:39 on x86_64-unknown-linux-gnu
    Copyright (C) 2017 The Apache Software Foundation.
    This software consists of contributions made by many people;
    see the NOTICE file for more information.
    Subversion is open source software, see http://subversion.apache.org/
    The following repository access (RA) modules are available:
    * ra_svn : Module for accessing a repository using the svn network protocol.
      - handles ‘svn‘ scheme
    * ra_local : Module for accessing a repository on local disk.
      - handles ‘file‘ scheme
    * ra_serf : Module for accessing a repository via WebDAV protocol using serf.
      - using serf 1.3.9
      - handles ‘http‘ scheme
      - handles ‘https‘ scheme

 


 

 配置SVN

# 创建svn代码库
[root@bogon ~]# mkdir -pv /home/svn/    # 创建目录
mkdir: 已创建目录 "/home/svn/"
[root@bogon ~]# svnadmin create /home/svn/test  # 创建svn代码库,目录可以和上面建立的相同(/home/svn)
[root@bogon ~]# ls /home/svn/test/              # 创建代码库后自动生成以下文件及目录
conf  db  format  hooks  locks  README.txt
    * conf      # 放置配置文件的目录;
    * db        # 版本数据存储目录;
    * formate   # 存储一个整数的文件,此整数代表库层次结构版本;
    * hooks     # 存放版本库勾子目录;
    * locks     # 存储库锁目录,用来跟踪库的访问者;
# 配置svn代码库
[root@bogon ~]# cd /home/svn/test/conf/
[root@bogon conf]# vim svnserve.conf    # 配置全局文件;
    [general]
    anon-access=none        # 禁止匿名访问,设置为none;默认为read,参数: read\write\none;
    auth-access=write       # 授权用户写权限;
    password-db=passwd      # 用户账号密码文件路径,可以写绝对路径;
    authz-db=authz          # 访问控制权限文件路径,可以写绝对路径;
    realm=svn               # 每个SVN的认证名,会在认证提示里显示,建议写项目名称;
[root@bogon conf]# vim passwd   # 配置用户密码
    [users]
    osyunwei=123456
    test=123456
    test2=123456
[root@bogon conf]# vim authz    # 配置权限控制文件,设置用户可以访问的目录
    [groups]
    admin=osyunwei
    users=test,test2
    [/]                 # 表示根目录下的所有资源;
    @admin = rw
    * = r
    [repo:/test]

 

 


 

 启动SVN

[root@bogon ~]# svnserve -d -r /home/svn/test/ [ --listen-port 6060 ]    # 启动svn;默认端口为 3690;可通过后面指定启动端口;

 

 


 

设置SVN服务开机启动

[root@bogon ~]# vim /etc/init.d/svn
    #!/bin/bash
    # chkconfig: 235 85 85
    # processname: svn
    #SVN_PORT=6060
    SVN_HOME=/home/svn/test
    if [ ! -f "/usr/local/svn/bin/svnserve" ]
    then
        echo "svnserver startup:cannot start..."
        exit
    fi
    case "$1" in
    start)
        echo "Starting svnserve..."
        /usr/local/svn/bin/svnserve -d -r $SVN_HOME
        echo "Successfully..."
    ;;
    stop)
        echo "Stopping svnserve..."
        killall svnserve
        echo "Successfully..."
    ;;
    restart)
        $0 stop
        $0 start
    ;;
    *)
        echo "Usage: {start|stop|restart}"
        exit 1
    ;;
    esac
[root@bogon ~]# chmod +x /etc/init.d/svn    # 添加执行权限;
[root@bogon ~]# chkconfig svn on            # 设置开机自启;
# 测试svn
[root@bogon ~]# svn checkout svn://192.168.9.32 --username=osyunwei --password=123456   # 将文件下载到本地;
[root@bogon ~]# svn update --username=osyunwei --password=123456    # 更新上次修改后的版本库;

 


 

 

客户端连接SVN服务器

    连接地址:   svn://192.168.9.32

 

源码安装SVN

标签:prot   账号密码   awk   restart   name   configure   权限控制   final   create   

原文地址:http://www.cnblogs.com/haorong/p/8082235.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!