首页 > 代码库 > centos6.8使用apache搭建svn服务

centos6.8使用apache搭建svn服务

服务器环境:

技术分享

脚本如下:

#!/bin/bash

yum install wget -y

mv /etc/etc/yum.repos.d/*.repo /tmp

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum clean all

chkconfig iptables off

/etc/init.d/iptables stop

sed -i ‘/SELINUX/s/enforcing/disabled/‘ /etc/selinux/config
setenforce 0

sed -i ‘#UseDNS yes/UseDNS no/g‘ /etc/ssh/sshd_config

echo ‘ntpdate ntp1.aliyun.com‘
ntpdate ntp1.aliyun.com echo ‘
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >> /var/spool/cron/root chmod 600 /var/spool/cron/root yum install httpd httpd-devel subversion mod_dav_svn ntpdate -y echo "开始创建目录和配置文件" mkdir -p /etc/subversion && cd /etc/subversion && touch svn-authz.conf svn-user echo "开始创建版本库" mkdir -p /home/svndata && chown -R apache.apache /home/svndata && svnadmin create /home/svndata/Department_Server && chown -R apache.apache /home/svndata/Department_Server echo "开始配置文件" cat <<EOF >/etc/subversion/svn-authz.conf [groups] admin = liuhuihuang mygirl = wangchenyan [/] liuhuihuang = rw * = r EOF if [ $? -eq 0 ];then echo "configure success" fi echo "开始备份subversion.conf配置文件和清空配置文件" cp /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.bak && true > /etc/httpd/conf.d/subversion.conf echo "开始写入新的配置文件" cat <<EOF >/etc/httpd/conf.d/subversion.conf <Location /svn> DAV svn SVNListParentPath on SVNParentPath /home/svndata AuthType Basic AuthName "Welcome To XL-svn Server" AuthzSVNAccessFile /etc/subversion/svn-authz.conf AuthUserFile /etc/subversion/svn-user Require valid-user </Location> EOF if [ $? -eq 0 ];then echo "configure success" fi echo "写入配置文件至http.conf" echo "LoadModule dav_svn_module modules/mod_dav_svn.so" >>/etc/httpd/conf/httpd.conf echo "LoadModule authz_svn_module modules/mod_authz_svn.so" >>/etc/httpd/conf/httpd.conf sed -i s/#ServerName www.example.com:80/ServerName localhost:80/g /etc/httpd/conf/httpd.conf echo "启动httpd服务" /etc/init.d/httpd start if [ $? -eq 0 ];then echo "svn服务搭建完成,请访问http:IP/svn/Department_Server" fi

温馨提示:版本库路径为/home/svndata ,权限配置文件路径为/etc/subversion/svn_authz.conf,subversion配置文件所在路径为/etc/httpd/conf.d。

centos6.8使用apache搭建svn服务