卸载原有的svn
[root@cce66 ~]# yum remove svn -y
安装apr
[root@cce62 src]# tar xf apr-1.4.8.tar.bz
[root@cce62 src]# tar xf apr-1.4.8.tar.bz2
[root@cce62 src]# cd apr-1.4.8
[root@cce62 apr-1.4.8]# ./configure --prefix=/usr/local/apr && make -j 2 && make install
安装apr-util
[root@cce62 src]# tar xf apr-util-1.5.1.tar.bz2
[root@cce62 src]# cd apr-util-1.5.1
[root@cce62 apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make -j 2 && make install
安装sqlite
[root@cce62 src]# tar xf sqlite-autoconf-3080200.tar.gz
[root@cce62 src]# cd sqlite-autoconf-3080200
[root@cce62 sqlite-autoconf-3080200]# ./configure --prefix=/usr/local/sqlite && make -j 2 && make install
安装apache
[root@cce62 src]# tar xf httpd-2.2.25.tar.gz
[root@cce62 src]# cd httpd-2.2.25
[root@cce62 httpd-2.2.25]#./configure --prefix=/usr/local/apache --enable-so --enable-dav --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-sqlite=/usr/local/sqlite --enable-maintainer-mode --enable-ssl --enable-cgi --enable-rewrite --with-zlib --enable-cgi
[root@cce62 httpd-2.2.25]# make -j 2 && make install
配置apache启动脚本
[root@cce62 src]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
[root@cce62 src]# chmod +x /etc/init.d/httpd
增加启动级别
[root@cce62 src]# vim /etc/init.d/httpd
# chkconfig: 2345 64 36
# description: Activates/Deactivates all network interfaces configured to
[root@cce62 src]# chkconfig --add httpd
创建启动用户并修改配置文件中的监听域名
[root@cce62 src]# useradd -s /sbin/nologin www
[root@cce62 src]# chown www:www /usr/local/apache/ -R
测试
[root@cce62 src]# /etc/init.d/httpd start
源码编译mysql
[root@cce62 src]# useradd -s /sbin/nologin mysql
[root@cce62 src]# tar xf mysql-5.6.19.tar.gz
[root@cce62 src]# cd mysql-5.6.19
[root@cce62 mysql-5.6.19]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql
安装
[root@cce62 mysql-5.6.19]# make -j 2
[root@cce62 mysql-5.6.19]# make install
配置运行环境
[root@cce62 mysql-5.6.19]#chown mysql:mysql -R /usr/local/mysql/
[root@cce62 mysql-5.6.19]#cp support-files/my-large.cnf /etc/my.cnf
[root@cce62 mysql-5.6.19]#cp support-files/mysql.server /etc/init.d/mysqld
[root@cce62 mysql-5.6.19]#chmod +x /etc/init.d/mysqld
修改启动脚本参数
[root@cce62 ]#vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
初始化数据库
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql 开机启动
chkconfig --add mysqld
添加客户端命令
echo "PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile && source /etc/profile && source /etc/profile
安装PHP
[root@cce62 src]# tar xf php-5.4.14.tar.bz2
[root@cce62 src]# cd php-5.4.14
[root@cce62 php-5.4.14]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php
[root@cce62 php-5.4.14]# make -j 2
[root@cce62 php-5.4.14]# make install
[root@cce62 php-5.4.14]# cp /usr/local/src/php-5.4.14/php.ini-production /usr/local/php/etc/php.ini
[root@cce62 php-5.4.14]# ls /usr/local/apache/modules/
httpd.exp libphp5.so
[root@cce62 php-5.4.14]# vin /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
让apache可以识别php文件
测试lamp环境
[root@cce62 ~]# cat /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
[root@cce62 ~]# vim /usr/local/apache/conf/httpd.conf
安装 subversion
[root@cce62 src]# tar xf subversion-1.8.5.tar.bz2
[root@cce62 src]# cd subversion-1.8.5
[root@cce62 subversion-1.8.5]# ./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-sqlite=/usr/local/sqlite
[root@cce62 subversion-1.8.5]# make -j 2
[root@cce62 subversion-1.8.5]# make install
[root@cce62 subversion-1.8.5]# cp /usr/local/svn/libexec/mod_* /usr/local/apache/modules/
[root@cce62 subversion-1.8.5]# echo "PATH=$PATH:/usr/local/svn/bin/" >>/etc/profile && source /etc/profile
创建svn源目录和备份目录
[root@cce62 ~]# mkdir -p /data/svn
[root@cce62 ~]# mkdir -p /data/web
[root@cce62 ~]# svnadmin create /data/svn/cce.com
[root@cce62 ~]# cat /data/svn/cce.com/hooks/post-commit
#!/bin/sh
export LANG=en_US.UTF-8
SVN=/usr/local/svn/bin/svn
WEB=/data/web/cce.com
cd $WEB && $SVN update
#cd $WEB && $SVN update --set-depth=files main.php
chown -R www:www $WEB
[root@cce62 ~]# chmod +x /data/svn/cce.com/hooks/post-commit
安装apache结合mysql认证的模块
[root@cce62 src]# tar xf mod_auth_mysql-3.0.0.tar.gz
[root@cce62 src]# mv apache22.diff mod_auth_mysql-3.0.0
[root@cce62 mod_auth_mysql-3.0.0]# cd mod_auth_mysql-3.0.0
[root@cce62 mod_auth_mysql-3.0.0]# patch -p0 < apache22.diff
[root@cce62 mod_auth_mysql-3.0.0]# /usr/local/apache/bin/apxs -c -L /usr/local/mysql/lib/ -I /usr/local/mysql/include/ -lmysqlclient -lm -lz mod_auth_mysql.c
[root@cce62 mod_auth_mysql-3.0.0]# /usr/local/apache/bin/apxs -i mod_auth_mysql.la
[root@cce62 mod_auth_mysql-3.0.0]# echo /usr/local/mysql/lib >>/etc/ld.so.conf && ldconfig
[root@cce62 mod_auth_mysql-3.0.0]# ls /usr/local/apache/modules/
httpd.exp libphp5.so mod_auth_mysql.so mod_authz_svn.so mod_dav_svn.so
[root@cce62 ~]# vim /usr/local/apache/conf/httpd.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule mysql_auth_module modules/mod_auth_mysql.so
<Location />
DAV svn
SVNParentPath /data/svn
AuthzSVNAccessFile /data/svn/auth
AuthName "EELLY SUBVERSION"
AuthUserFile /dev/null
AuthType Basic
AuthMYSQLEnable on
AuthMYSQLUser svn
AuthMySQLPassword caichangen
AuthMYSQLDB svn_auth
AuthMYSQLUserTable users
AuthMYSQLNameField user_name
AuthMYSQLPasswordField user_passwd
Require valid-user
AuthBasicAuthoritative off
AuthMySQLEnable On
# AuthMySQLPwEncryption md5
SetOutputFilter DEFLATE
</Location>
[root@cce62 ~]# vim /data/svn/auth
[groups]
admin = cce,sbh #添加SVN用户名
[cce.com:/] #对test版本库进行权限设置
@admin = rw #允许admin这个组的成员对这个版本库有读写的权限
[root@cce62 ~]#mysql
mysql> create database svn_auth;
mysql> grant all privileges on svn_auth.* to svn@'%'identified by 'caichangen';
mysql> grant all privileges on svn_auth.* to svn@'localhost'identified by 'caichangen';
mysql> flush privileges;
mysql> use svn_auth;
mysql> CREATE TABLE users ( user_name CHAR(30) NOT NULL,user_passwd CHAR(20) NOT NULL,PRIMARY KEY (user_name));
mysql> insert into svn_auth.users values('cce',encrypt('caichangen'));
mysql> insert into svn_auth.users values('sbh',encrypt('caichangen'));
[root@cce62 ~]# /etc/init.d/httpd restart
[root@cce62 web]# pwd
/data/web
[root@cce62 web]# svn checkout file:///data/svn/cce.com/
[root@cce62 ~]# chown www:www /data/ -R
[root@cce62 ~]# /etc/init.d/httpd restart
测试
测试自动同步
查看web下面的cce.com是否存在index.html
附:
如用md5方式加密密码,用以下方式
mysql> CREATE TABLE users ( user_name CHAR(30) NOT NULL,user_passwd CHAR(40) NOT NULL,PRIMARY KEY (user_name));
mysql> insert into users values('cce',md5('caichangen'));
Query OK, 1 row affected (0.02 sec)
mysql> insert into users values('sbh',md5('caichangen'));
Query OK, 1 row affected (0.00 sec)
在httpd的svn字段添加
AuthMySQLPwEncryption md5测试
本文出自 “攻城狮” 博客,谢绝转载!