centos6.8使用apache搭建svn服务
Posted 梦轻尘
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.8使用apache搭建svn服务相关的知识,希望对你有一定的参考价值。
服务器环境:
脚本如下:
#!/bin/bash yum install wget -y mv /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
yum install httpd httpd-devel subversion mod_dav_svn ntpdate -y
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 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 #加入这条配置,可以这样的形式访问版本库 http://IP/svn/(不加这条配置的话就需要后面接版本库的名字了,形如:http://ip/svn/版本库名) 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/" fi
友提:创建svn密码命令 htpasswd -m -b svn-user 用户名 密码
温馨提示:版本库路径为/home/svndata ,权限配置文件路径为/etc/subversion/svn_authz.conf,subversion配置文件所在路径为/etc/httpd/conf.d。
以上是关于centos6.8使用apache搭建svn服务的主要内容,如果未能解决你的问题,请参考以下文章
CentOS6.8 搭建SVN(版本控制系统)及SVN的使用