zoukankan      html  css  js  c++  java
  • 关于svn服务部署方案

    本文只记录我的笔记

    首先, 我是个懒人, 写好了shell, 直接上传把

    安装包:SvnPackages-chenglee

    第一, 无非就是搞掂依赖这一块

    #*************************************************************************
    #         > File Name: SuperRoot.sh
    #         > Author: chenglee
    #         > Main : chengkenlee@sina.com
    #         > Blog : http://www.cnblogs.com/chenglee/
    #         > Created Time : 2019年07月04日 星期四 20时43分25秒
    #*************************************************************************
    #!/bin/bash
    yum -y install zlib zlib-devel openssl openssl-devel expat-devel gcc gcc-c++ cmake lrzsz bzip2
    

    第二, 编译安装

    #*************************************************************************
    #         > File Name: SvnInstall.sh
    #         > Author: chenglee
    #         > Main : chengkenlee@sina.com
    #         > Blog : http://www.cnblogs.com/chenglee/
    #         > Created Time : 2019年07月04日 星期四 20时46分03秒
    #*************************************************************************
    #!/bin/bash
    ShowPath=$1
    InstallPath="$ShowPath/svn"
    ShellFoler=$(cd "$(dirname "$0")";pwd)
    
    function cheng(){
        mkdir -p $InstallPath/lib
        tar -zxvf SvnPackages.tar.gz && cd SvnPackages && ll
    }
    function apr(){
        cd $ShellFoler/SvnPackages
        tar -zxvf apr-1.6.5.tar.gz && cd apr-1.6.5 && mkdir $InstallPath/lib/apr
        ./configure --prefix=${InstallPath}/lib/apr && make && make install
    }
    function apr-util(){
        cd $ShellFoler/SvnPackages
        tar -zxvf apr-util-1.6.1.tar.gz && cd apr-util-1.6.1 && mkdir $InstallPath/lib/apr-util
        ./configure --prefix=$InstallPath/lib/apr-util --with-apr=$InstallPath/lib/apr && make && make install
    }
    function scons(){
        cd $ShellFoler/SvnPackages
        tar -zxvf scons-2.3.2.tar.gz && cd scons-2.3.2 && mkdir $InstallPath/lib/scons
        python setup.py install --prefix=$InstallPath/lib/scons
    }
    function serf(){
        cd $ShellFoler/SvnPackages
        tar xf serf-1.3.9.tar.bz2 && cd serf-1.3.9 && mkdir $InstallPath/lib/serf
        $InstallPath/lib/scons/bin/scons PREFIX=$InstallPath/lib/serf APR=$InstallPath/lib/apr APU=$InstallPath/lib/apr-util && $InstallPath/lib/scons/bin/scons install && cp $InstallPath/lib/serf/lib/libserf-1.so* /lib64/
    }
    function svn(){
        cd $ShellFoler/SvnPackages
        tar -zxvf subversion-1.12.0.tar.gz && unzip sqlite-amalgamation-3280000.zip -d subversion-1.12.0 && cd subversion-1.12.0 && mv sqlite-amalgamation-3280000 sqlite-amalgamation
        ./configure --prefix=$InstallPath --with-apr=${InstallPath}/lib/apr --with-apr-util=$InstallPath/lib/apr-util --with-serf=$InstallPath/lib/serf --with-lz4=internal --with-utf8proc=internal --enable-mod-activation && make && make install
    }
    
    #********************************************#
    #svnadmin create /home/svn/blog
    #svnserve -d -r /home/svn
    #********************************************#
    
    function main(){
        cheng
        apr
        apr-util
        scons
        serf
        svn
        echo "Install Sucess!!"
    (
    cat <<EOF
    #svn
    export SVN_HOME=$InstallPath
    export PATH=$SVN_HOME/bin:$PATH
    EOF
    ) >> /etc/profile
        echo "Please Input 'source /etc/profile'"
    }
    main
    

    使用方法是, 脚本+安装路径, 比如我要把svn安装到/usr/local下, 那么, 就是./install.sh /usr/local

    如此简单

    第三, 库问题

    #*************************************************************************
    #         > File Name: CreateRepo.sh
    #         > Author: chenglee
    #         > Main : chengkenlee@sina.com
    #         > Blog : http://www.cnblogs.com/chenglee/
    #         > Created Time : 2019年07月05日 星期五 09时29分10秒
    #*************************************************************************
    #!/bin/bash
    
    RepoName=$1
    RepoPath="/home/svn"
    
    function create(){
        svnadmin create $RepoPath/$RepoName
        sleep 1;
        echo "create repo is success!"
    }
    function authz(){
    (
    cat <<EOF
    [$RepoName:/]
    $RepoName = rw
    EOF
    ) >> $RepoPath/$RepoName/conf/authz
    }
    function passwd(){
        echo "$RepoName = 123456" >> $RepoPath/$RepoName/conf/passwd
    }
    function svnserve(){
        configfile="$RepoPath/$RepoName/conf/svnserve.conf"
        sed -i "s|# anon-access = read|anon-access = read|g" $configfile
        sed -i "s|# auth-access = write|auth-access = write|g" $configfile
        sed -i "s|# password-db = passwd|password-db = passwd|g" $configfile
        sed -i "s|# authz-db = authz|authz-db = authz|g" $configfile
    }
    function update(){
        authz
        passwd
        svnserve
        echo "update config is success!"
    }
    function restart(){
        ps aux | grep svnserve | grep -v grep | awk -F ' ' '{print$2}' | xargs kill -9
        sleep 1;
        #svnserve -d -r $RepoPath --log-file $RepoPath/SvnServer.log
        ./start.sh
        echo;
        echo;
        echo "Your RepoUrl is : [svn://IP/$RepoName]"
        echo "Your username and password  is : [$RepoName:123456]"
        echo;
        echo;
    }
    function main(){
        create
        update
        restart
    }
    main
    

    这是一键创建库, 默认连接账号是你的库名, 默认连接密码是123456, 再简单不过了, 执行的方式是, 脚本 + 库名

    别忘了, 后面要加库名

    第四, 启动

    #*************************************************************************
    #         > File Name: start.sh
    #         > Author: chenglee
    #         > Main : chengkenlee@sina.com
    #         > Blog : http://www.cnblogs.com/chenglee/
    #         > Created Time : 2019年07月05日 星期五 10时16分38秒
    #*************************************************************************
    #!/bin/bash
    RepoPath="/home/svn"
    
    svnserve -d -r $RepoPath --log-file $RepoPath/SvnServer.log

    到这里已经差不多搞掂了, 就是上面编译那一步耗费一点时间而已, 搭建这玩意5分钟之内搞掂, 精准

    然后就是小乌龟连接的那一步了,

    算了...

    就这样把,,,

    太简单, 过于讲解怕会扭曲意思。

  • 相关阅读:
    UNIX网络编程——TCP/IP简介
    UNIX环境高级编程——TCP/IP网络编程
    UNIX环境高级编程——网络编程常用函数及结构
    UNIX环境高级编程——网络基础概念
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
  • 原文地址:https://www.cnblogs.com/chenglee/p/11162379.html
Copyright © 2011-2022 走看看