1.使用fpm自定义打包apache和subversion的rpm包(可选,如果使用系统默认安装可以省略)

制作apache的rpm包


# mkdir -p ~/tmp/apache/installdir/
# wget http://pkgs.fedoraproject.org/lookaside/pkgs/httpd/httpd-2.2.22.tar.bz2/9fe3093194c8a57f085ff7c3fc43715f/httpd-2.2.22.tar.bz2   -O httpd-2.2.22.tar.bz2
# tar jxvf httpd-2.2.22.tar.bz2
# cd httpd-2.2.22
# ./configure --prefix=/opt/app/svn_base/httpd  --enable-so --enable-dav --enable-dav-fs --enable-maintainer-mode --with-included-apr --enable-rewrite --enable-ssl --enable-proxy --enable-proxy-http
# make
# make install DESTDIR=~/tmp/apache/installdir/

# cd ~/tmp/apache
# cat beforeinstall.sh 
#!/bin/bash
getent group apache >/dev/null || groupadd -g 48 -r apache
getent passwd apache >/dev/null || \
  useradd -r -u 48 -g apache -s /sbin/nologin  -c "Apache" apache
exit 0

# cat afterinstall.sh 
#!/bin/bash
/sbin/chkconfig --add httpd
chown -R apache:apache /opt/data/svn_data/


# fpm -s dir -t rpm -n httpd  --epoch 0 -v 2.2.22   --iteration 0.el6.centos    --force   --category  "System Environment/Daemons"  --license "GPL" --description 'The Apache HTTP Server is a powerfull http server'  --rpm-summary="Apache HTTP Server" -a "x86_64"  --url "http://httpd.apache.org/"    -C ~/tmp/apache/installdir/    --before-install ~/tmp/apache/beforeinstall.sh  --after-install ~/tmp/apache/afterinstall.sh 
Created package {:path=>"httpd-2.2.22-0.el6.centos.x86_64.rpm"}



制作subversion的rpm包

# mkdir -p ~/tmp/svn/installdir
# wget http://subversion.tigris.org/downloads/subversion-1.6.13.tar.bz2  -O subversion-1.6.13.tar.bz2
# wget http://subversion.tigris.org/downloads/subversion-deps-1.6.13.tar.bz2 -O subversion-deps-1.6.13.tar.bz2
# tar jxvf subversion-1.6.13.tar.bz2
# tar jxvf subversion-deps-1.6.13.tar.bz2 
# cd subversion-1.6.13
# ./configure --prefix=/opt/app/svn_base/subversion --with-apxs=/opt/app/svn_ba
se/httpd/bin/apxs  --with-apr=/opt/app/svn_base/httpd/bin/apr-1-config  --with-ap
r-util=/opt/app/svn_base/httpd/bin/apu-1-config 

#  make
#  make install DESTDIR=~/tmp/svn/installdir

#  fpm -s dir -t rpm -n subversion  --epoch 0 -v 1.6.13   --iteration 0.el6.centos    --force   --category  "Development/Tools"  --license "GPL" --description 'A Modern Concurrent Version Control System'  --rpm-summary="Subversion Control System" -a "x86_64"  --url "http://subversion.apache.org/"    -C ~/tmp/svn/installdir/    --before-install ~/tmp/svn/beforeinstall.sh  --after-install ~/tmp/svn/afterinstall.sh 
Created package {:path=>"subversion-1.6.13-0.el6.centos.x86_64.rpm"}





2.安装使用Ansible








参考文档:

https://github.com/geerlingguy/ansible-role-svn

http://john88wang.blog.51cto.com/2165294/1574113