centos环境下安装apache + php + svn + svnadmin
#安装环境
32位 CentOS 6.3 或 32位 CentOS 6.0
#------------------------------------------------------
查询操作系统
lsb_release -a
#------------------------------------------------------
#软件列表
#------------------------------------------------------
apr-1.5.0.tar.bz2
apr-util-1.5.3.tar.bz2
zlib-1.2.8.tar.gz
sqlite-autoconf-3080200.tar.gz
openssl-1.0.1e.tar.gz
pcre-8.34.tar.gz
httpd-2.4.6.tar.gz
subversion-1.8.3.tar.bz2
sqlite-amalgamation-3080200.zip
php-5.5.6.tar.gz
svnadmin-1.6.2.zip
#安装基础依赖软件包apr apr-util zlib sqlite-autoconf openssl pcre
#------------------------------------------------------------------
#安装apr
tar -xvf apr-1.5.0.tar.bz2
cd apr-1.5.0
./configure --prefix=/usr/local/apr
make && make install
#安装apr-util
tar -xvf apr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
#安装zlib
tar -xvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make && make install
#安装sqlite
tar -xvf sqlite-autoconf-3080200.tar.gz
cd sqlite-autoconf-3080200
./configure --prefix=/usr/local/sqlite-autoconf
make && make install
#安装openssl
tar zxf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config --prefix=/usr/local/openssl --shared
make && make install
#安装pcre
tar -xvf pcre-8.34.tar.gz
cd pcre-8.34
./configure --prefix=/usr/local/pcre
make && make install
#安装pcre是异常报错configure: error: You need a C++ compiler for C++ support
#解决办法:
#yum install -y gcc gcc-c++
#安装Apache
#------------------------------------------------------------------
tar -xvf httpd-2.4.6.tar.gz
cd httpd-2.4.6
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl --enable-module=so --enable-dav --enable-so --enable-dav-fs --enable-ssl --enable-proxy --enable-proxy-http
make && make install
cp /etc/init.d/httpd /etc/init.d/httpd.bak-20140127
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
cd /usr/local/apache2/conf
cp httpd.conf httpd.conf.bak
useradd -M apache
#如果异常提示useradd: user 'apache' already exists
#则执行usermod -s /bin/bash apache
#测试 su - apache
#找到 User 和 Group 并修改成 User apache 和 Group apache 保存并退出
#找到 ServerName 并修改成ServerName localhost:80
#去掉该行的注释 LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#安装Subversion
#------------------------------------------------------------------
tar -xvf subversion-1.8.3.tar.bz2
unzip sqlite-amalgamation-3080200.zip
mv sqlite-amalgamation-3080200 sqlite-amalgamation
mv sqlite-amalgamation subversion-1.8.3/
cd subversion-1.8.3
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
vi /etc/profile
#在最下面增加 export PATH=$PATH:/usr/local/svn/bin 保存并退出
source /etc/profile
exit
#检查是否安装成功
svnserve --version
#配置Subversion
#------------------------------------------------------------------
#cd /techcenter/sd/repos
#没有则创建 mkdir -p /techcenter/sd/repos/
svnadmin create /techcenter/sd/repos/project1
chown -R apache.apache /techcenter/sd/repos/
vi /techcenter/sd/repos/project1/conf/svnserve.conf
#将以下代码
[sasl]
#注释掉
#在文件最下面增加代码
anon-access = none
auth-access = write
password-db = svn_passwdfile
authz-db = svn_accessfile
realm = project1
#保存并退出
cp passwd svn_passwdfile
cp authz svn_accessfile
vi svn_passwdfile
#删除[users]下面的所有内容
#在[users]下面增加以下代码
admin = admin
#保存并退出
#删除### ('').下面的所有内容
#在### ('').下面增加以下代码
g_mgr = admin
### at
[project1:/]
@g_mgr = rw
* =
### trunk
[project1:/trunk]
@g_mgr = rw
* =
### branches
[project1:/branches]
@g_mgr = rw
* =
#保存并退出
ps -ef | grep svnserve
echo "/usr/local/svn/bin/svnserve -d -r /techcenter/sd/repos/" >> /etc/rc.local
#使用小乌龟工具测试
svn://IP/project1
#添加文件提交
#更新文件提交
#OK~
#整合Svbversion与Apache
#------------------------------------------------------------------
cd /usr/local/apache2/bin/
./htpasswd -mc passwd admin
#输入两次密码
cp passwd /techcenter/sd/conf/
rm -rf passwd
cd /techcenter/sd/conf/
cp /techcenter/sd/repos/project1/conf/svn_passwdfile ./
cp /techcenter/sd/repos/project1/conf/svn_accessfile ./
#拷贝passwd文件内容到svn_passwdfile中
rm -rf passwd
chown -R apache.apache ./svn_passwdfile
chown -R apache.apache ./svn_accessfile
#配置apache配置文件
cd /usr/local/apache2/modules
cp /usr/local/svn/libexec/mod_authz_svn.so ./
cp /usr/local/svn/libexec/mod_dav_svn.so ./
查找以下每行代码,如有注释去掉注释,如不存在代码,则在文件最后面添加,同时核对modules是否存在.so文件
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
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
ServerName www.example.com:80改为
ServerName localhost:80
<Location /svn>
DAV svn
SVNParentPath /techcenter/sd/repos
SVNListParentPath On
AuthType Basic
AuthName "svn repos"
AuthUserFile /techcenter/sd/conf/svn_passwdfile
AuthzSVNAccessFile /techcenter/sd/conf/svn_accessfile
Require valid-user
</Location>
#保存并退出
#安装php
#------------------------------------------------------------------
yum install libxml2-devel libjpeg libjpeg-devel libpng libpng-devel
tar -xvf php-5.5.6.tar.gz
cd php-5.5.6
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/share/doc/libjpeg-turbo-1.2.1 --with-png-dir=/usr/share/doc/libpng-1.2.49 --with-mysql --with-zlib --with-gd --with-pear --with-config-file-path=/etc/
make && make install
cp php.ini-development /etc/php.ini
#确保下面代码,是去掉注释的,没有的补充添加上
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml .php3 .inc
#保存并退出
#配置ssl安全证书
#------------------------------------------------------------------
openssl genrsa 1024 > server.key
openssl req -new -key server.key > server.csr
openssl req -x509 -days 365 -key server.key -in server.csr > server.crt
cd /usr/local/apache2/conf/extra
vi httpd-ssl.conf
#找到SSLCertificateFile SSLCertificateKeyFile
#分别设置为
SSLCertificateFile "/techcenter/sd/conf/server.crt"
SSLCertificateKeyFile "/techcenter/sd/conf/server.key"
vi /usr/local/apache2/conf/httpd.conf
#找到下段代码并,去掉注释
Include conf/extra/httpd-ssl.conf
#同时在httpd.conf 的<Location /svn>配置里,最下面增加
<Location /svn>
...........
Require valid-user
SSLRequireSSL
</Location>
#保存并退出
exit
#重新登录启动apache
#测试,打开浏览器访问地址
https://IP/svn/
#可以看到project1项目,可点击目录,查看目录里的文件
#输入账号密码
#在浏览器上可以看到先关项目文件,即标识成功
#安装if.svnadmin
#------------------------------------------------------------------
cp /home/soft/svnadmin-1.6.2.zip ./
unzip svnadmin-1.6.2.zip
mv iF.SVNAdmin-stable-1.6.2 svnadmin
cd svnadmin/include/
vi config.inc.php
#找到下段代码,在下面添加一段代码
//define("IF_SVNBaseC_ConfigDir", "E:/Development/Test/temp svnadmin/svn-config-dir");
define("IF_SVNBaseC_ConfigDir", "/blubb/edi/blubb");
#保存并退出
cd /techcenter/web/
chown -R apache.apache svnadmin/
vi /usr/local/apache2/conf/httpd.conf
#找到下面代码
<Directory />
AllowOverride none
Require all denied
</Directory>
#修改为
<Directory />
AllowOverride none
Require all granted
</Directory>
#找到Alias添加下面代码
Alias /svnadmin /techcenter/web/svnadmin
#在文件最后面添加下面代码
<Directory "/techcenter/web/svnadmin">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#保存并退出
#重新登录启动apache
/usr/local/apache2/bin/apachectl restart
#测试,打开浏览器访问地址
https://IP/svnadmin/
#成功看到即标识成功安装if.svnadmin
#apache + php + svn + svnadmin安装成功!
安装过程中的异常处理: