• CentOS7编译安装SVN(subversion1.9.7)


    参考连接0:http://www.programering.com/a/MDMzYDMwATg.html
    参考连接1:http://www.zsythink.net/archives/1318
    0.系统信息
    系统版本:CentOS7.3 x86_64
    1.安装依赖包

    yum -y groupinstall "Development tools"
    yum -y install expat-devel pcre pcre-devel openssl-devel

    2.1安装apr-1.6.3

    mkdir /usr/svnpackage
    cd /usr/svnpackage
    wget https://mirrors.aliyun.com/apache/apr/apr-1.6.3.tar.gz 
    tar zxf apr-1.6.3.tar.gz
    cd apr-1.6.3
    ./configure --prefix=/usr/apr
    make && make install

    2.2安装apr-util-1.6.1

    wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz
    tar zx apr-util-1.6.1.tar.gz
    cd apr-util-1.6.1
    ./configure --prefix=/usr/apr-util --with-apr=/usr/apr/bin/apr
    make && make install

    2.3安装zlib-1.2.11

    wget http://www.zlib.net/zlib-1.2.11.tar.gz
    tar zxf zlib-1.2.11.tar.gz
    cd zlib-1.2.11
    ./configure /*默认安装路径即可*/
    make &&make install

    2.4安装sqlite-autoconf-3210000

    wget http://www.sqlite.com/2017/sqlite-autoconf-3210000.tar.gz
    tar zxf sqlite-autoconf-3210000.tar.gz
    cd sqlite-autoconf-3210000
    ./configure
    make && make install

    2.5安装openssl1.0.1u 

    wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
    wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2l.tar.gz
    tar zxf openssl1.0.1u.tar.gz
    cd openssl1.0.1u
    ./config --prefix=/usr/local/openssl -fPIC no-gost /*这里的参数一定要添加,不然后面编译http后会出现问题*/
    make depend
    make install

    2.6安装scons-3.0.1

    #编译安装
      wget https://nchc.dl.sourceforge.net/project/scons/scons/3.0.1/scons-3.0.1.tar.gz   mkdir scons   tar zxf scons-local-3.0.1.tar.gz -C /usr/svnpackage/scons   cd scons   python scons.py install #rpm安装   wget https://nchc.dl.sourceforge.net/project/scons/scons/3.0.0/scons-3.0.0-1.noarch.rpm   rpm -ivh scons-3.0.0-1.noarch.rpm

    2.7安装serf

    wget https://mirrors.aliyun.com/apache/serf/serf-1.3.9.tar.bz2
    tar jxf serf-1.3.9.tar.bz2
    cd serf-1.3.9
    scons PREFIX=/usr/local/serlf APR=/usr/apr/bin/apr-1-config APU=/usr/apr-util/bin/apu-1-config OPENSSL=/usr/lcoal/openssl
    /*巨坑:此处会提示报错 File "/usr/svnpackage/serf-1.3.9/SConstruct", line 186
    print 'Warning: Used unknown variables:', ', '.join(unknown.keys())
    SyntaxError: invalid syntax
    这里可以把/usr/svnpackage/serf-1.3.9/SConstruct内的185,186行注释掉,然后在安装*/
    scons install
    #安装完成后,将serf的lib库追加到动态链接库
    echo "/usr/local/serf/lib" >> /etc/ld.so.conf
    ldconfig -v

    2.8安装httpd-2.4.28

    wget https://mirrors.aliyun.com/apache/httpd/httpd-2.4.28.tar.gz
    tar zxf httpd-2.4.28.tar.gz
    cd httpd-2.4.28
    ./configure --prefix=/usr/local/apache2 --with-apr=/usr/apr/bin/apr-1-config --with-apr-util=/usr/apr-util/bin/apu-1-config --enable-so --enable-dav --enable-maintainer-mode --enable-rewrite --enable-ssl --with-ssl=/usr/local/openssl
    make && make install
    #设置http自启动
    cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
    vim /etc/init.d/httpd
    #在#!/bin/sh的下面加入
    #chkconfig:2345 85 35
    #设置httpd开机自启动
    chkconfig httpd on
    #检查确认,2345级别为on
    chkconfig --list httpd
    #添加环境变量
    vim /etc/profile.d/svn_path
    export HTTPD_HOME=/usr/local/apache2/bin
    export PATH=$HTTPD_HOME:$PATH
    #设置生效:
    source /etc/profile

    2.9安装subversion-1.9.7

    wget https://mirrors.aliyun.com/apache/subversion/subversion-1.9.7.tar.gz
    ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/apr/bin/apr-1-config --with-apr-util=/usr/apr-util/bin/apu-1-config --with-zlib --enable-maintainer-mode --with-serf=/usr/local/serf
    make && make install
    #设置环境变量
    vim /etc/profile.d/svn_path
    export SVN_HOME=/usr/local/svn/bin
    export PATH=$SVN_HOME:$PATH
    #退出,设置生效:
    source /etc/profile #如果在编译过程中提示缺少*.h文件,可以找到对应的文件,软连接到/usr/include中,如果缺少库文件,如提示usr/bin/ld: cannot find -lxxx,可以到对应的安装文件的lib下,使用ln -s命令软连接到/usr/lib64目录下。 # 安装完成查看版本信息:svnserve --version #创建svn根目录:
    mkdir /data #启动svn:
    svnserve -d -r /data

    3.http与svn的关联
      3.1.拷贝关联所需模块

    cp /usr/local/svn/libexec/mod_authz_svn.so /usr/local/apache2/modules/
    cp /usr/local/svn/libexec/mod_dav_svn.so /usr/local/apache2/modules/

      3.2.设置location,在/usr/local/apache2/conf/httpd.conf末尾添加如下内容

    #for svn
    #加载整合SVN所需的模块
    LoadModule dav_svn_module modules/mod_dav_svn.so
    LoadModule authz_svn_module modules/mod_authz_svn.so
    #设置对应的location,路径为/,
    #设置SVNParentPath设置为svn的仓库总根目录,此处为/data,配合location /,可以直接浏览器中输入http:/IP/直接
    访问至/data下的svn仓库目录
    #AuthzSVNAccessFile设置SVN权限配置文件路径
    #AuthUserFile设置svn用户名密码配置文件路径
    <Location />
    DAV svn
    SVNParentPath /data
    SVNListParentPath on
    SVNAutoversioning on
    SVNReposName "svn"
    AuthzSVNAccessFile /data/authz.conf
    AuthType Basic
    AuthName "svn repo auth"
    AuthUserFile /data/passwd.conf
    Require valid-user
    </Location>
    #for svn

      3.3.配置daemon用户的访问权限

    chown -R daemon /data
    chown -R 755 /data

      3.4.创建用户 

    htpasswd -c /data/passwd.conf username  /*首次创建用户需添加-c选项来创建passwd.conf文件,后续不能再使用此选项*/

      3.5.配置权限控制文件

      vim /data/authz.conf

    ##################################################################
    [groups] #<groupname1>=<username1>,<username2> admin=pengyang #[<versionLib>:projectName/directory] #@<groupsname> = <authorities> #<username> = <authorities> [/] @admin = rw [test:/test1] #指定用户xiaoming可以读写test仓库中test1目录的文件 pengyang = rw xiaoming = rw ###################################################################

    4.配置私钥证书

    openssl genrsa 2048 > /data/server.key
    openssl req -new -key /data/server.key > /data/server.csr
    Country Name=CN
    State or Province Name=guangdong
    Locality Name=shenzhen
    Organization Name=hangsheng new engrgy
    Common Name=svnserver
    Email Address=<可省略>
    A challenge password=<空,填写后启动httpd需输入密码>
    An optionnal company name=可选公司名,不填
    openssl req -x509 -days 36500 -key /data/server.key -in /data/server.csr > /data/server.crt
    cp /data/server.key /usr/local/apache2/conf
    cp /data/server.crt /usr/local/apache2/conf
    #设置http的支持ssl
    vim /usr/local/apache2/conf/httpd.conf
    #去掉Include conf/extra/httpd-ssl.conf前的#号
    #确定httpd-ssl.conf配置中的证书与私钥指定正确
    vim /usr/local/apache2/conf/extra/httpd-ssl.conf
    #存在以下两行:
    SSLCertificateFile "/usr/local/apache2/conf/server.crt"
    SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"
    #修改svn对应的location
    vim /usr/local/apache2/conf/httpd.conf
    #添加"SSLRequireSSL"至DAV svn的下一行
    #重启http服务器

    至此,SVN安装完成,如有错误之处还请各位指正,以免误导大家!

  • 相关阅读:
    迷你资源管理器
    简单工厂和单例的一些事
    面向对象的七大原则
    继承和多态的一些事
    体检套餐系统
    信仰
    魔兽争霸系统
    优化MySchool总结习题
    事务,视图及索引
    [LeetCode] Combinations
  • 原文地址:https://www.cnblogs.com/saonian/p/8397801.html
Copyright © 2020-2023  润新知