- tar xvf httpd-2.2.22.tar.bz2
- cd httpd-2.2.22
- ./configure --prefix=/opt/apache \
- --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
- useradd -r apache
- sed -i 's@User daemon@User apache@g' /opt/apache2/conf/httpd.conf
- sed -i 's@Group daemon@Group apache@g' /opt/apache2/conf/httpd.conf
- echo 'export PATH=$PATH:/opt/apache2/bin' > /etc/profile.d/httpd.sh
- . /etc/profile.d/httpd.sh
- echo '/opt/apache2/lib' > /etc/ld.so.conf.d/apache.conf
- ldconfig
- rm -rf httpd-2.2.22
- tar xvf cmake-2.8.4.tar.gz
- cd cmake-2.8.4
- ./configure
- make && make install
- cd ..
- rm -rf cmake-2.8.4
- tar xf mysql-5.5.28.tar.gz
- cd mysql-5.5.28
- cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
- -DSYSCONFDIR=/opt/mysql/etc \
- -DMYSQL_DATADIR=/opt/mysql/data \
- -DMYSQL_TCP_PORT=3306 \
- -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
- -DMYSQL_USER=mysql \
- -DEXTRA_CHARSETS=all \
- -DWITH_READLINE=1 \
- -DWITH_SSL=system \
- -DWITH_EMBEDDED_SERVER=1 \
- -DENABLED_LOCAL_INFILE=1 \
- -DWITH_INNOBASE_STORAGE_ENGINE=1
- make && make install
- cd ..
- rm -Rf mysql-5.5.28
- cd /opt/mysql
- cp support-files/my-huge.cnf /etc/my.cnf
- cp support-files/mysql.server /etc/init.d/mysqld
- useradd -r mysql
- chown -R mysql:root .
- ./scripts/mysql_install_db --user=mysql --datadir=data/
- echo 'export PATH=$PATH:/opt/mysql/bin' > /etc/profile.d/mysql.sh
- . /etc/profile.d/mysql.sh
- echo '/opt/mysql/lib' > /etc/ld.so.conf.d/mysql.conf
- ldconfig
- service mysqld start
- cd /root/svn
- tar xvf php-5.3.18.tar.gz
- cd php-5.3.18
- ./configure --prefix=/opt/php \
- --with-apxs2=/opt/apache2/bin/apxs \
- --with-mysql=/opt/mysql \
- --enable-mbstring
- make && make install
- cp php.ini-production /etc/php.ini
- cd ..
- rm -Rf php-5.3.18
- sed -i '/AddType application\/x-gzip .gz .tgz/a\
- AddType application/x-httpd-php .php' /opt/apache2/conf/httpd.conf
- sed -i 's@DirectoryIndex index.html@DirectoryIndex index.php index.html@g' /opt/apache2/conf/httpd.conf
- rm -f /opt/apache2/htdocs/index.html
- echo '<?php
- phpinfo()
- ?>' > /opt/apache2/htdocs/index.php
- apachectl start
- tar xf subversion-1.6.13.tar.bz2
- tar xf subversion-deps-1.6.13.tar.bz2
- cd subversion-1.6.13
- ./configure --prefix=/opt/subversion \
- --with-apxs=/opt/apache2/bin/apxs \
- --with-apr=/opt/apache2/bin/apr-1-config \
- --with-apr-util=/opt/apache2/bin/apu-1-config
- make && make install
- echo 'export PATH=$PATH:/opt/subversion/bin' > /etc/profile.d/svn.sh
- . /etc/profile.d/svn.sh
- cd ..
- rm -rf subversion-1.6.13
- sed -i '/httpd-default.conf/a\
- Include conf/extra/httpd-svn.conf' /opt/apache2/conf/httpd.conf
- echo '
- <Location /svn>
- DAV svn
- SVNListParentPath On
- SVNParentPath /opt/svn_repos
- AuthType Basic
- AuthName "Subversion Repository"
- AuthUserFile /opt/subversion/conf/passwdfile
- AuthzSVNAccessFile /opt/subversion/conf/accessfile
- Require valid-user
- </Location> ' > /opt/apache2/conf/extra/httpd-svn.conf
- mkdir /opt/subversion/conf
- touch /opt/subversion/conf/passwdfile
- touch /opt/subversion/conf/accessfile
- mkdir /opt/svn_repos
- svnadmin create /opt/svn_repos/test/ ##创建一个repo
- chown -R apache:apache /opt/subversion/ ##我们通过apache来管理svn的
- chown -R apache:apache /opt/svn_repos/
- htpasswd -bm /opt/subversion/conf/passwdfile test "admin"
- echo '
- [test:/]
- * = r
- test = rw ' > /opt/subversion/conf/accessfile ##access文件是权限控制文件
- apachectl restart
- /opt/php/bin/pear install VersionControl_SVN-0.3.4
- tar xf svnmanager-1.08.tar.gz
- mv svnmanager-1.08 /opt/apache2/htdocs/svnman
- cp /opt/apache2/htdocs/svnman/config.php.linux /opt/apache2/htdocs/svnman/config.php
- vim /opt/apache2/htdocs/svnman/config.php
- $htpassword_cmd = "/opt/apache2/bin/htpasswd"; ##意思很明显
- $svn_cmd = "/opt/subversion/bin/svn";
- $svnadmin_cmd = "/opt/subversion/bin/svnadmin";
- //Subversion locations
- $svn_config_dir = "/opt/subversion/conf";
- $svn_repos_loc = "/opt/svn_repos";
- $svn_passwd_file = "/opt/subversion/conf/passwdfile";
- $svn_access_file = "/opt/subversion/conf/accessfile";
- $dsn = "mysql://svnmanager:admin@localhost/svnmanager"; ##mysql,去掉i
- $admin_name = "admin"; ##初始的账号密码
- $admin_temp_password = "admin";
- mysql
- mysql> create database svnmanager;
- mysql> grant all on svnmanager.* to 'svnmanager'@'localhost' identified by 'admin';
- mysql> flush privileges;
- tar xvf VersionControl_SVN-0.3.4.tgz
- mv VersionControl_SVN-0.3.4 /opt/apache2/htdocs/svnman/VersionControl
- chown -R apache:apache /opt/apache2
- cp /opt/svn_repos/crm/hooks/pre-revprop-change.tmpl /opt/svn_repos/crm/hooks/pre-revprop-change
- vim /opt/svn_repos/crm/hooks/pre-revprop-change
- 把最后的exit 1改为exit 0 即可
- svnsync init file:///opt/svn_repos/crm/ http://192.168.17.140/svn/crm/
- svnsync sync file:///opt/svn_repos/crm/
- ---------------------------
- Store password unencrypted (yes/no)? yes
- Transmitting file data ..............................
- Committed revision 1.
- Copied properties for revision 1.
- Transmitting file data .
- Committed revision 2.
- Copied properties for revision 2.
- Transmitting file data .
- Committed revision 3.
- Copied properties for revision 3.
- -----------------------------
- 代表同步成功
- cp /opt/svn_repos/crm/hooks/post-commit.tmpl /opt/svn_repos/crm/hooks/post-commit
- chmod 755 /opt/svn_repos/crm/hooks/post-commit
- /opt/subversion/bin/svnsync sync --non-interactive http://192.168.17.139/svn/crm/ --username laoguang --password admin
- cp /opt/svn_repos/crm/hooks/pre-commit.tmpl /opt/svn_repos/crm/hooks/pre-commit
- chmod +x /opt/svn_repos/crm/hooks/pre-commit
- vim /opt/svn_repos/crm/hooks/pre-commit
- REPOS="$1" ##库位置
- TXN="$2" ##版本
- SVNLOOK=/opt/subversion/bin/svnlook ##svnlook的位置
- SCMLIST="admin" ##允许删除的用记
- C_USER=`$SVNLOOK info -t $TXN $REPOS | sed -n "1p"` ##执行commit的用户
- if [ -z `echo $SCMLIST | grep $C_USER` ];then ## 如果commit的用户没在允许的里面
- echo `$SVNLOOK changed -t $TXN $REPOS` > /opt/svn_repos/qingdao/commit_log ##将操作写入日志
- if cat /opt/svn_repos/crm/commit_log|cut -d" " -f1|uniq -u|grep "^D";then ##如果日志开头包含D(D代表删除)
- echo "You do not have permisson to delete a file" > /dev/stderr ##提示错误
- rm -rf /opt/svn_repos/crm/commit_log ##删除文件
- exit 1 ##错误退出
- fi
- fi
- exit 0
到此本文完毕,构建svn主要参考
http://300second.blog.51cto.com/7582/1065758,感谢300second