CentOS 64位 部署Subversion 集成 Apache
服务器基本环境
++系统版本
[root@localhost ~]# cat /etc/redhat-release CentOS release 5.3 (Final) |
++系统位数
[root@localhost ~]# uname -a Linux localhost.localdomain 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009 x86_64 x86_64 x86_64 GNU/Linux |
++防火墙
[root@localhost ~]# service iptables stop [root@localhost ~]# service ip6tables stop [root@localhost ~]# chkconfig iptables off [root@localhost ~]# chkconfig ip6tables off |
++SElinux
[root@localhost ~]# perl -i -p -e 's/=enforcing/=disabled/g' /etc/selinux/config /** 此处需要重启生效 */ [root@localhost ~]# sestatus SELinux status: disabled |
++IPADDR
[root@localhost ~]# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 08:00:27:5D:6D:B2 inet addr:192.168.18.14 Bcast:192.168.255.255 Mask:255.255.0.0 inet6 addr: fe80::a00:27ff:fe5d:6db2/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:58608 errors:0 dropped:0 overruns:0 frame:0 TX packets:844 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:4553888 (4.3 MiB) TX bytes:103068 (100.6 KiB) Base address:0xd010 Memory:f0000000-f0020000 |
++版本选择
Apache | Openssl | Subversion |
2.2 | 0.9.8 | 1.6 |
2.4 | 1.0.0 | 1.7/1.8 |
安装程序
++openssl
SSL是Secure Socket Layer(安全套接层协议)的缩写,可以在Internet上提供秘密性传输.
[root@localhost ~]# wget http://www.openssl.org/source/openssl-0.9.8g.tar.gz [root@localhost ~]# tar -zxvf openssl-0.9.8g.tar.gz [root@localhost ~]# cd openssl-0.9.8g [root@localhost openssl-0.9.8g]# ./config -fPIC no-gost no-shared no-zlib [root@localhost openssl-0.9.8g]# make depend [root@localhost openssl-0.9.8g]# make install [root@localhost openssl-0.9.8g]# \cp /usr/local/ssl/bin/openssl /usr/bin/ [root@localhost openssl-0.9.8g]# openssl version OpenSSL 0.9.8g 19 Oct 2007 |
++apr
APR用于socket调度,apr是其中之一的开发包
[root@localhost ~]# wget http://centos.googlecode.com/files/apr-1.4.6.tar.gz [root@localhost ~]# tar -zxvf apr-1.4.6.tar.gz [root@localhost ~]# cd apr-1.4.6 [root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr [root@localhost apr-1.4.6]# make [root@localhost apr-1.4.6]# make install |
++apr-util
APR用于socket调度,apr-util是其中之一的开发包
[root@localhost ~]#wget http://centos.googlecode.com/files/apr-util-1.4.1.tar.gz [root@localhost ~]# tar -zxvf apr-util-1.4.1.tar.gz [root@localhost ~]# cd apr-util-1.4.1 [root@localhost apr-util-1.4.1]# ./configure ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config [root@localhost apr-util-1.4.1]# make [root@localhost apr-util-1.4.1]# make install |
/**
* --with-apr 用于指定apr的安装位置
*/
++httpd
apache服务器用于发布Subversion目录
[root@localhost ~]#wget http://centos.googlecode.com/files/httpd-2.2.22.tar.gz [root@localhost ~]# tar -zxvf httpd-2.2.22.tar.gz [root@localhost ~]# cd httpd-2.2.22 [root@localhost httpd-2.2.22]# ./configure --prefix=/local/local/apache --with-ssl=/usr/local/ssl --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config--enable-rewrite --enable-so --enable-dav --enable-dav-fs --enable-dav-lock --enable-ssl --enable-mods-shared=all ... /** 报错 */ checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures [root@localhost httpd-2.2.22]# yum install zlib* openssl-devel* --nogpgcheck [root@localhost httpd-2.2.22]# ./configure --prefix=/local/local/apache --with-ssl=/usr/local/ssl --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config--enable-rewrite --enable-so --enable-dav --enable-dav-fs --enable-dav-lock --enable-ssl --enable-mods-shared=all [root@localhost httpd-2.2.22]# make [root@localhost httpd-2.2.22]# make install |
/**
* --prefix 指定主目录安装位置
* --with-ssl 指定ssl主程序位置
* --with-apr 指定apr主程序位置
* --with-apr-util 指定apr-util主程序位置
* --enable-rewrite 基于规则的URL处理
* --enable-so 开启库支持
* --enable-dav 开启webDAV协议处理能力
* --enable-dav-fs 开启webDAV文件系统
* --enable-dav-lock 开启webDAV通用锁
* --enable-ssl 开启ssl
* --enable-mods-shared 开启空间共享目录
*/
++sqlite
sqlite是一款轻型的数据库
[root@localhost ~]# wget http://www.sqlite.org/sqlite-3.6.13.tar.gz [root@localhost ~]# tar -zxvf sqlite-3.6.13.tar.gz [root@localhost ~]# cd sqlite-3.6.13 [root@localhost sqlite-3.6.13]# ./configure --prefix=/usr/local/sqlite [root@localhost sqlite-3.6.13]# make [root@localhost sqlite-3.6.13]# make install [root@localhost sqlite-3.6.13]# \cp /usr/local/sqlite/bin/sqlite3 /usr/bin [root@localhost sqlite-3.6.13]# sqlite3 SQLite version 3.6.13 |
++neon
[root@localhost ~]# wget http://www.webdav.org/neon/neon-0.29.6.tar.gz [root@localhost ~]# tar -zxvf neon-0.29.6.tar.gz [root@localhost ~]# cd neon-0.29.6 [root@localhost neon-0.29.6]#./configure --prefix=/usr/local/neon --enable-shared --with-ssl --with-libs=/usr/local/ssl/lib --enable-webdav ... /** 报错 */ configure: error: no XML parser was found: expat or libxml 2.x required [root@localhost neon-0.29.6]# yum install libxml* --nogpgcheck [root@localhost neon-0.29.6]# ./configure --prefix=/usr/local/neon --enable-shared --with-ssl --with-libs=/usr/local/ssl/lib --enable-webdav [root@localhost neon-0.29.6]# make [root@localhost neon-0.29.6]# make install [root@localhost neon-0.29.6]# /usr/local/neon/bin/neon-config --version neon 0.29.6 |
/**
* --enable-shared 构建共享库
* --with-ssl ssl支持
* --with-libs 指定libs位置
* --enable-webdav 开启webDAV支持
*/
++Subversion
[root@localhost ~]#wget http://subversion.tigris.org/downloads/subversion-1.6.18.tar.gz [root@localhost ~]# tar -zxvf subversion-1.6.18.tar.gz [root@localhost ~]# cd subversion-1.6.18 [root@localhost subversion-1.6.18]# ./configure --prefix=/usr/local/svn-1.6.18 --with-apxs=/local/local/apache/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-ssl=/usr/local/ssl --with-neon=/usr/local/neon --with-sqlite=/usr/local/sqlite --enable-opeion-checking /** 报错 */ /usr/bin/ld: cannot find -lexpat collect2: ld returned 1 exit status [root@localhost subversion-1.6.18]# yum install expat* --nogpgcheck [root@localhost subversion-1.6.18]#./configure --prefix=/usr/local/svn-1.6.18 --with-apxs=/local/local/apache/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-ssl=/usr/local/ssl --with-neon=/usr/local/neon --with-sqlite=/usr/local/sqlite --enable-opeion-checking [root@localhost subversion-1.6.18]# make [root@localhost subversion-1.6.18]# make install [root@localhost subversion-1.6.18]# \cp /mapbar/app/svn-1.6.18/lib/* /usr/lib [root@localhost subversion-1.6.18]# \cp /mapbar/app/svn-1.6.18/bin/* /usr/bin [root@localhost subversion-1.6.18]# svn --version svn, version 1.6.18 (r1303927) |
Subversion配置
++检查apache配置文件
[root@localhost ~]# /usr/local/apache/bin/apachectl -t /** 报错 */ httpd: Syntax error on line mod_dav_svn.so into server lib bsvn_subr-1.so.0: undefined symbol: sqlite3_open_v2 [root@localhost ~]# ln -s /usr/local/sqlite/lib/libsqlite3.so.0.8.6 /usr/lib64 ln: creating symbolic link `/usr/lib64/libsqlite3.so.0.8.6' to `/usr/local/sqlite/lib/libsqlite3.so.0.8.6': File exists [root@localhost ~]# mv /usr/lib64/libsqlite3.so.0.8.6 /root/bak [root@localhost ~]# ln -s /usr/local/sqlite/lib/libsqlite3.so.0.8.6 /usr/lib64 [root@localhost ~]# ldconfig [root@localhost ~]# /usr/local/apache/bin/apachectl -t Syntax OK |
++配置apache虚拟主机
[root@localhost ~]# vim /usr/local/apache/conf/httpd.conf #Include conf/extra/httpd-vhosts.conf 去掉#号 [root@localhost ~]# vim/usr/local/apache/conf/extra/httpd-vhosts.conf 增加如下行配置虚拟主机 <VirtualHost *:80> //配置虚拟主机 ServerAdmin admin@test.com ServerName svn.test.com ErrorLog "logs/svn-error_log" CustomLog "logs/svn-access_log" common <Location /svn> DAV svn SVNParentPath /data/svn/repos //设置svn主目录 AuthType Basic AuthName "Subversion repository" AuthUserFile /data/svn/passwd //设置svn密码文件 AuthzSVNAccessFile /data/svn/auth //设置权限文件 Require valid-user </Location> </VirtualHost> |
++建立相关目录及文件
[root@localhost ~]# mkdir -p /data/svn/repos [root@localhost ~]# touch /data/svn/passwd [root@localhost ~]# touch /data/svn/auth |
++配置SVN账号
[root@localhost ~]# /usr/local/apache/bin/htpasswd -cm /data/svn/passwd tom [root@localhost ~]# /usr/local/apache/bin/htpasswd -m /data/svn/passwd jarry [root@localhost ~]# /usr/local/apache/bin/htpasswd -m /data/svn/passwd larry |
++创建SVN仓库
[root@localhost ~]# svnadmin create /data/svn/repos/demosvn01 [root@localhost ~]# svnadmin create /data/svn/repos/demosvn02 |
++配置SVN访问权限
[root@localhost ~]# vim /data/svn/auth 增加: [group] admin = tom,jarry \\设置组 [/] @admin = rw \\admin组对所有读写权限 [demosvn01:/] larry = rw \\larry用户对demosvn01仓库有读写权限 [demosvn02:/] larry = r \\larry用户对demosvn02仓库有读权限 |
启动apache后即可访问.(http://IP/svn/仓库名称)
--------------------------------------------------------------------------------------
版权所有,转载时必须以链接方式注明源地址,否则追究法律责任!
QQ : 413844436
Email : softomg@163.com
Blog : http://blog.youkuaiyun.com/softomg