------------------------------------------分割线------------------------------------------
FTP地址:ftp://ftp1.linuxidc.com
用户名:ftp1.linuxidc.com
密码:
在 2015年LinuxIDC.com\1月\CentOS 6.5搭建Apache整合SVN 1.8.5服务器(多版本库权限配置)
------------------------------------------分割线------------------------------------------
3.依赖包的安装
tar zxvf apr-1.5.0.tar.gz
tar zxvf libtool-2.2.4.tar.gz
tar zxvf apr-util-1.5.3.tar.gz
cd apr-1.5.0
./configure --prefix=/usr/local/apr
make
make install
cd libtool-2.2.4
./configure --prefix=/usr/local/libtool
make
make install
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
tar zxvf pcre-8.33.tar.gz
tar zxvf httpd-2.4.7.tar.gz
cd pcre-8.33
./configure --prefix=/usr/local/pcre
make
make install
cd httpd-2.4.7
./configure --prefix=/usr/local/apache --enable-so --enable-dav --enable-dav-fs --enable-mnaintainet-mode --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
make
make install
tar xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make
make install
tar zxvf sqlite-autoconf-3080100.tar.gz
tar zxvf subversion-1.8.5.tar.gz
cd sqlite-autoconf-3080100
./configure --prefix=/usr/local/sqlite
make
make install
cd subversion-1.8.5
./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-sqlite=/usr/local/sqlite --enable-maintainer-mode --with-zlib=/usr/local/zlib
make
make install
=====================================
4.Apache和SVN命令环境设置
vi /etc/profile
PATH=/usr/local/apache/bin:$PATH
PATH=/usr/local/subversion/bin:$PATH
退出VI
source /etc/profile
=====================================
5.Apache配置
so文件复制
cp /usr/local/subversion/libexec/mod_authz_svn.so /usr/local/apache/modules/mod_authz_svn.so
cp /usr/local/subversion/libexec/mod_dav_svn.so /usr/local/apache/modules/mod_dav_svn.so
httpd.conf配置文件修改
vi /usr/local/apache/conf/httpd.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#svn
<Location /svn>
DAV svn
SVNParentPath /usr/svn
AuthType Basic
AuthName "Subversion repository"
#密码存储文件
AuthUserFile /usr/svn/auth.conf
Require valid-user
#用户访问目录的权限文件
AuthzSVNAccessFile /usr/svn/access.conf
</Location>
=====================================
6.SVN配置
mkdir /usr/svn
#创建版本库
svnadmin create /usr/svn/repos
#添加用户并设置密码:
htpasswd -c /usr/local/subversion/auth.conf test1
#输入两次密码
htpasswd /usr/local/subversion/auth.conf test2
#输入两次密码
#SVN用户访问目录权限配置文件
touch /usr/local/subversion/access.conf
vi /usr/local/subversion/access.conf
#用户组设置
[groups]
g1 = test1
g2 = test2
#版本库1,组1为读写权限,组2为只读
[repos1:/]
@g1 = rw
@g2 = r
* =
#版本库1下的mysvn文件夹组1为只读权限
[repos1:/mysvn]
@g1 = r
#版本库2
[repos2:/]
@g1 = rw
@g2 = rw
* =
#版本库3
[repos3:/]
@g1 = rw
@g2 = rw
#SVNSERVE.CONF配置文件修改
anon-access = none
auth-access = write
password-db = /usr/svn/auth.conf
authz-db = /usr/svn/access.conf
为SVN版本库文件添加读写权限
chmod -R 777 /usr/svn
启动SVN
svnserve -d -r /usr/svn --config-file /usr/svn/svnserve.conf
启动APACHE
/usr/local/apache/bin/apachectl start
=====================================
7.防火墙配置
iptables -P OUTPUT ACCEPT #默认策略
iptables -P FORWARD DROP #默认策略
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 3690 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #允许已建和相关的连接
iptables -P INPUT DROP #默认策略
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #允许已建和相关的连接
/etc/init.d/iptables save#保存iptables配置。
=====================================
8.关闭selinux
vi /etc/sysconfig/selinux
SELINUX=DISABLED
=====================================
客户端访问:
版本库1:
版本库2:
版本库3:
--------------------------------------分割线 --------------------------------------