Centos 5 install SVN 1.7.X

Coming From: http://blog.csdn.net/pengyouchuan/article/details/8198667

可以在这里下载

http://subversion.apache.org/packages.html#centos


CentOS默认的yum --install subversion ,安装的是1.6版本

WANdisco (supported and certified by WANdiscorequires registration)

提供了安装脚本,方便好用

可以卸载yum的1.6版本,升级到1.7版本


sh内容


[python]  view plain copy
  1. #!/bin/bash  
  2.    
  3.   
  4. echo WANdisco Subversion Installer for CentOS 5  
  5. echo Please report bugs or feature suggestions to opensource@wandisco.com  
  6. echo   
  7. echo Gathering some information about your system...  
  8.   
  9. MINVERSION='2'  
  10. SVNVER='1.7.7'  
  11. NOW=$(date +"%b-%d-%y%s")  
  12.   
  13. #functions  
  14. gather_info () {  
  15.     ARCH=`uname -m`  
  16.     SVNSTATUS=`rpm -qa|grep ^subversion-[0-9]|awk 'BEGIN { FS = "-" } ; { print $1 }'`  
  17. }  
  18. check_tools () {  
  19.         COMMANDS="yum wget rpm"  
  20.         for C in $COMMANDS; do  
  21.                 if [ -z "$(which $C)" ] ; then  
  22.                         echo "This installer uses the $C command which was not found in \$PATH."  
  23.             exit 1  
  24.                 fi  
  25.         done  
  26. }  
  27.   
  28. check_centos_version ()  
  29. {  
  30.        if [ ! -e /etc/redhat-release ]; then  
  31.                 echo "No /etc/redhat-release file, exiting"  
  32.                 echo "You are most likely not using CentOS."  
  33.                 echo "Installers for other operating systems are available from our downloads page:"  
  34.                 echo "http://www.wandisco.com/subversion/download"  
  35.         echo "Exiting.."  
  36.                 exit 1  
  37.         fi;  
  38.     cat /etc/redhat-release |grep -e 5.[0-9]  
  39.     if [ $? == 0 ]; then  
  40.         echo "CentOS version 5.x confirmed.."  
  41.     else  
  42.                 echo "You are most likely using an incompatible version of CentOS."  
  43.         echo "This installer is made for CentOS 5.x"  
  44.                 echo "Installers for other operating systems are available from our downloads page:"  
  45.                 echo "http://www.wandisco.com/subversion/download"  
  46.                 exit 1  
  47.     fi;  
  48. }  
  49.   
  50.   
  51. check_is_root ()  
  52. {  
  53.     if [[ $EUID -ne 0 ]]; then  
  54.         echo "This script must be run as root" 1>&2  
  55.         exit 1  
  56.     fi    
  57. }  
  58. svn_remove_old ()  
  59. {  
  60.     if [ -f /etc/httpd/conf.d/subversion.conf ]; then  
  61.         echo Backing up /etc/httpd/conf.d/subversion.conf to /etc/httpd/conf.d/subversion.conf.backup-$NOW  
  62.         cp /etc/httpd/conf.d/subversion.conf /etc/httpd/subversion.conf.backup-$NOW  
  63.     fi  
  64.     echo Removing old packages...  
  65.     yum -y remove mod_dav_svn subversion subversion-devel subversion-perl subversion-python subversion-tools &>/dev/null  
  66. }  
  67. add_repo_config ()  
  68. {  
  69.         echo Adding repository configuration to /etc/yum.repos.d/  
  70.         echo '  
  71. # WANdisco Repo  
  72.   
  73. [WANdisco-dev]  
  74. name=WANdisco SVN Repo 1.7  
  75. enabled=1  
  76. baseurl=http://opensource.wandisco.com/centos/5/devel/RPMS/$basearch/  
  77. gpgcheck=1  
  78. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-WANdisco' >/etc/yum.repos.d/WANdisco-1.7.repo       
  79.     echo "Importing GPG key"  
  80.     wget http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco -O /tmp/RPM-GPG-KEY-WANdisco &>/dev/null  
  81.     rpm --import /tmp/RPM-GPG-KEY-WANdisco  
  82.     rm -rf /tmp/RPM-GPG-KEY-WANdisco  
  83.     echo " ------ Installing yum repo: Done ------"   
  84. }  
  85. install_svn ()  
  86. {  
  87.         echo Checking to see if you already have Subversion installed via rpm...  
  88.         if [[ "$SVNSTATUS" =~ subversion ]]; then  
  89.             echo Subversion is already installed on the system.  
  90.             echo Do you wish to replace the version of subversion currently installed with the WANdisco version?   
  91.         echo This action will remove the previous version from your system   
  92.         echo "[y/n]"  
  93.         read svn_install_confirm  
  94.         if [ "$svn_install_confirm" == "y" -o "$svn_install_confirm" == "Y" ]; then  
  95.             svn_remove_old  
  96.             add_repo_config  
  97.             echo          
  98.             echo Installing Subversion $SVNVER  
  99.             echo  
  100.             yum -y install subversion.$ARCH subversion-perl.$ARCH subversion-python.$ARCH subversion-javahl.$ARCH subversion-tools.$ARCH  
  101.             echo Would you like to install apache and the apache SVN modules?  
  102.             echo "[y/n]"  
  103.             read dav_svn_confirm  
  104.             if [ "$dav_svn_confirm" == "y" -o "$dav_svn_confirm" == "Y" ]; then  
  105.                 echo Installing apache and subversion modules  
  106.                 yum -y install mod_dav_svn.$ARCH httpd  
  107.                 echo "Installation complete."  
  108.                 echo "You can find the subversion configuration file for apache HTTPD at /etc/httpd/conf.d/subversion.conf"  
  109.                 echo "By default, the modules are commented out in subversion.conf."  
  110.                 echo "To enable the modules, please edit subversion.conf and remove the # infront of the LoadModule lines."  
  111.                 echo "You should then restart httpd (/etc/init.d/httpd restart)"  
  112.             fi  
  113.               
  114.             else  
  115.             echo "Install Cancelled"  
  116.             exit 1  
  117.         fi  
  118.   
  119.     else  
  120.         # Install SVN  
  121.         echo "Subversion is not currently installed"  
  122.         echo "Starting installation, are you sure you wish to continue?"  
  123.         echo "[y/n]"  
  124.         read svn_install_confirm  
  125.                 if [ "$svn_install_confirm" == "y" -o "$svn_install_confirm" == "Y" ]; then  
  126.             add_repo_config  
  127.                         echo  
  128.                         echo Installing Subversion $SVNVER  
  129.                         echo  
  130.             yum -y install subversion.$ARCH subversion-perl.$ARCH subversion-python.$ARCH subversion-tools.$ARCH  
  131.                         echo Would you like to install apache HTTPD and the apache SVN modules?  
  132.             echo "[y/n]"  
  133.                         read dav_svn_confirm  
  134.                         if [ "$dav_svn_confirm" == "y" -o "$dav_svn_confirm" == "Y" ]; then  
  135.                                 echo Installing apache and subversion modules  
  136.                 yum -y install mod_dav_svn.$ARCH httpd  
  137.                                 echo "Installation complete."  
  138.                                 echo "You can find the subversion configuration file for apache HTTPD at /etc/httpd/conf.d/subversion.conf"  
  139.                                 echo "By default, the modules are commented out in subversion.conf."  
  140.                                 echo "To enable the modules, please edit subversion.conf and remove the # infront of the LoadModule lines."  
  141.                                 echo "You should then restart httpd (/etc/init.d/httpd restart)"  
  142.                         fi  
  143.   
  144.                 else  
  145.                         echo "Install Cancelled"  
  146.                         exit 1  
  147.                 fi  
  148.           
  149.         fi  
  150.       
  151. }  
  152.   
  153. install_32 ()  
  154. {  
  155.         echo Installing for $ARCH  
  156.     install_svn  
  157. }  
  158. install_64 ()  
  159. {  
  160.         echo Installing for $ARCH  
  161.     install_svn  
  162. }  
  163.   
  164. #Main  
  165. check_is_root  
  166. check_centos_version  
  167. check_tools  
  168. gather_info  
  169.   
  170. echo Checking your system arch  
  171. if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]; then  
  172.     if [ "$ARCH" == "i686" ]; then  
  173.         ARCH="i386"  
  174.     fi;  
  175.     install_32  
  176. elif [ "$ARCH" == "x86_64" ];  
  177. then  
  178.     install_64  
  179. else   
  180.     echo Unsupported platform: $ARCH  
  181.     exit 1  
  182. fi  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值