卸载原有的svn
[[email protected] ~]# yum remove svn -y
安装apr
[[email protected] src]# tar xf apr-1.4.8.tar.bz
[[email protected] src]# tar xf apr-1.4.8.tar.bz2
[[email protected] src]# cd apr-1.4.8
[[email protected] apr-1.4.8]# ./configure --prefix=/usr/local/apr && make -j 2 && make install
安装apr-util
[[email protected] src]# tar xf apr-util-1.5.1.tar.bz2
[[email protected] src]# cd apr-util-1.5.1
[[email protected] apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make -j 2 && make install
安装sqlite
[[email protected] src]# tar xf sqlite-autoconf-3080200.tar.gz
[[email protected] src]# cd sqlite-autoconf-3080200
[[email protected] sqlite-autoconf-3080200]# ./configure --prefix=/usr/local/sqlite && make -j 2 && make install
安装apache
[[email protected] src]# tar xf httpd-2.2.25.tar.gz
[[email protected] src]# cd httpd-2.2.25
[[email protected] 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
[[email protected] httpd-2.2.25]# make -j 2 && make install
配置apache启动脚本
[[email protected] src]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
[[email protected] src]# chmod +x /etc/init.d/httpd
增加启动级别
[[email protected] src]# vim /etc/init.d/httpd
# chkconfig: 2345 64 36
# description: Activates/Deactivates all network interfaces configured to
[[email protected] src]# chkconfig --add httpd
创建启动用户并修改配置文件中的监听域名
[[email protected] src]# useradd -s /sbin/nologin www
[[email protected] src]# chown www:www /usr/local/apache/ -R
测试
[[email protected] src]# /etc/init.d/httpd start
源码编译mysql
[[email protected] src]# useradd -s /sbin/nologin mysql
[[email protected] src]# tar xf mysql-5.6.19.tar.gz
[[email protected] src]# cd mysql-5.6.19
[[email protected] 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
安装
[[email protected] mysql-5.6.19]# make -j 2
[[email protected] mysql-5.6.19]# make install
配置运行环境
[[email protected] mysql-5.6.19]#chown mysql:mysql -R /usr/local/mysql/
[[email protected] mysql-5.6.19]#cp support-files/my-large.cnf /etc/my.cnf
[[email protected] mysql-5.6.19]#cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql-5.6.19]#chmod +x /etc/init.d/mysqld
修改启动脚本参数
[[email protected] ]#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
[[email protected] src]# tar xf php-5.4.14.tar.bz2
[[email protected] src]# cd php-5.4.14
[[email protected] 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
[[email protected] php-5.4.14]# make -j 2
[[email protected] php-5.4.14]# make install
[[email protected] php-5.4.14]# cp /usr/local/src/php-5.4.14/php.ini-production /usr/local/php/etc/php.ini
[[email protected] php-5.4.14]# ls /usr/local/apache/modules/
httpd.exp libphp5.so
[[email protected] php-5.4.14]# vin /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
让apache可以识别php文件
测试lamp环境
[[email protected] ~]# cat /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
[[email protected] ~]# vim /usr/local/apache/conf/httpd.conf
安装 subversion
[[email protected] src]# tar xf subversion-1.8.5.tar.bz2
[[email protected] src]# cd subversion-1.8.5
[[email protected] 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
[[email protected] subversion-1.8.5]# make -j 2
[[email protected] subversion-1.8.5]# make install
[[email protected] subversion-1.8.5]# cp /usr/local/svn/libexec/mod_* /usr/local/apache/modules/
[[email protected] subversion-1.8.5]# echo "PATH=$PATH:/usr/local/svn/bin/" >>/etc/profile && source /etc/profile
创建svn源目录和备份目录
[[email protected] ~]# mkdir -p /data/svn
[[email protected] ~]# mkdir -p /data/web
[[email protected] ~]# svnadmin create /data/svn/cce.com
[[email protected] ~]# 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
[[email protected] ~]# chmod +x /data/svn/cce.com/hooks/post-commit
安装apache结合mysql认证的模块
[[email protected] src]# tar xf mod_auth_mysql-3.0.0.tar.gz
[[email protected] src]# mv apache22.diff mod_auth_mysql-3.0.0
[[email protected] mod_auth_mysql-3.0.0]# cd mod_auth_mysql-3.0.0
[[email protected] mod_auth_mysql-3.0.0]# patch -p0 < apache22.diff
[[email protected] 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
[[email protected] mod_auth_mysql-3.0.0]# /usr/local/apache/bin/apxs -i mod_auth_mysql.la
[[email protected] mod_auth_mysql-3.0.0]# echo /usr/local/mysql/lib >>/etc/ld.so.conf && ldconfig
[[email protected] 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
[[email protected] ~]# 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>
[[email protected] ~]# vim /data/svn/auth
[groups]
admin = cce,sbh #添加SVN用户名
[cce.com:/] #对test版本库进行权限设置
@admin = rw #允许admin这个组的成员对这个版本库有读写的权限
[[email protected] ~]#mysql
mysql> create database svn_auth;
mysql> grant all privileges on svn_auth.* to [email protected]‘%‘identified by ‘caichangen‘;
mysql> grant all privileges on svn_auth.* to [email protected]‘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‘));
[[email protected] ~]# /etc/init.d/httpd restart
[[email protected] web]# pwd
/data/web
[[email protected] web]# svn checkout file:///data/svn/cce.com/
[[email protected] ~]# chown www:www /data/ -R
[[email protected] ~]# /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
测试