系统安装按照1# CentOS 6.7 x64 最小化安装
Apache/PHP/MariaDB环境按照2# CentOS 6.7 x64 Apache/PHP/Mariadb环境搭建
更新Python
# CentOS 6.7 x64 默认使用Python2.6, 我把它更新成了2.7 [[email protected] src]# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 [[email protected] src]# tar -jxvf Python-2.7.3.tar.bz2 [[email protected] src]# cd Python-2.7.3 [[email protected] Python-2.7.3]# ./configure --prefix=/usr/local/python2.7 [[email protected] Python-2.7.3]# make && make install [[email protected] Python-2.7.3]# mv /usr/bin/python /usr/bin/python2.6.6 [[email protected] Python-2.7.3]# ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python [[email protected] Python-2.7.3]# python -V
下载、安装Subversion
相关软件在junlins_lnamp里面的src/subversion文件夹里含有,也可以单独下载
[[email protected] subversion]# wget https://mirrors.junlins.site/subversion/expat-2.1.0.tar.gz [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/scons-2.4.1.tar.gz [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/serf-1.3.8.tar.bz2 [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/sqlite-amalgamation-3071501.zip [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/sqlite-autoconf-3080500.tar.gz [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/subversion-1.9.3.tar.gz # 解压软件包 [[email protected] subversion]# tar zxf expat-2.1.0.tar.gz [[email protected] subversion]# tar zxf scons-2.4.1.tar.gz [[email protected] subversion]# tar xf serf-1.3.8.tar.bz2 [[email protected] subversion]# unzip sqlite-amalgamation-3071501.zip [[email protected] subversion]# tar zxf sqlite-autoconf-3080500.tar.gz [[email protected] subversion]# tar zxf subversion-1.9.3.tar.gz # 安装软件包 [[email protected] subversion]# cd expat-2.1.0 [[email protected] expat-2.1.0]# ./configure --prefix=/usr/local/expat && make && make install [[email protected] expat-2.1.0]# cd ../scons-2.4.1 [[email protected] scons-2.4.1]# python setup.py install [[email protected] scons-2.4.1]# cd ../serf-1.3.8 [[email protected] serf-1.3.8]# scons PREFIX=/usr/local/serf APR=/usr/local/apache/bin/apr-1-config APU=/usr/local/apache/bin/apu-1-config install [[email protected] serf-1.3.8]# cd ../sqlite-autoconf-3080500 [[email protected] sqlite-autoconf-3080500]# ./configure --prefix=/usr/local/sqlite && make && make install [[email protected] sqlite-autoconf-3080500]# cd ../sqlite-amalgamation-3071501 [[email protected] sqlite-amalgamation-3071501]# mkdir -p ../subversion-1.9.3/sqlite-amalgamation [[email protected] sqlite-amalgamation-3071501]# \cp -a ./ sqlite3.c ../subversion-1.9.3/sqlite-amalgamation/ [[email protected] sqlite-amalgamation-3071501]# cd ../subversion-1.9.3 [[email protected] subversion-1.9.3]# ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/usr/local/apache/bin/apu-1-config --with-sqlite=/usr/local/sqlite --with-zlib --enable-maintainer-mode --with-serf=/usr/local/serf [[email protected] subversion-1.9.3]# make && make install [[email protected] subversion-1.9.3]# echo "/usr/local/serf/lib" >> /etc/ld.so.conf && echo "/usr/local/subversion/lib" >> /etc/ld.so.conf && ldconfig [[email protected] subversion-1.9.3]# echo "export PATH=/usr/local/subversion/bin:$PATH" > /etc/profile.d/subversion.sh [[email protected] subversion-1.9.3]# source /etc/profile.d/subversion.sh # 配置Subversion # 创建subversion版本库目录 [[email protected] subversion]# mkdir /data/subversion # 配置Subversion启动脚本 [[email protected] subversion]# wget https://mirrors.junlins.site/subversion/Subversion-init [[email protected] subversion]# cp Subversion-init /etc/init.d/subversion [[email protected] subversion]# chmod +x /etc/init.d/subversion [[email protected] subversion]# chkconfig --add subversion [[email protected] subversion]# chkconfig --level 235 subversion on
创建版本库(svn协议)
# 版本库创建 [[email protected] ~]# svnadmin create /data/subversion/svn [[email protected] ~]# mkdir -p /data/subversion/svn-folder /data/subversion/svn-folder/trunk /data/subversion/svn-folder/branches /data/subversion/svn-folder/tags [[email protected] ~]# svn import /data/subversion/svn-folder file:///data/subversion/svn -m "Creating basic directory structure" # 用户权限管理 [[email protected] ~]# sed -i ‘s/# anon-access = read/anon-access = read/‘ /data/subversion/svn/conf/svnserve.conf [[email protected] ~]# sed -i ‘s/# auth-access = write/auth-access = write/‘ /data/subversion/svn/conf/svnserve.conf [[email protected] ~]# sed -i ‘s/# password-db = passwd/password-db = passwd/‘ /data/subversion/svn/conf/svnserve.conf [[email protected] ~]# sed -i ‘s/# authz-db = authz/authz-db = authz/‘ /data/subversion/svn/conf/svnserve.conf [[email protected] ~]# sed -i ‘s/# realm = My First Repository/realm = SVN Repository/‘ /data/subversion/svn/conf/svnserve.conf [[email protected] ~]# echo "svn = 12345" >> /data/subversion/svn/conf/passwd [[email protected] ~]# echo "[repo:/]" >> /data/subversion/svn/conf/authz [[email protected] ~]# echo "svn = rw" >> /data/subversion/svn/conf/authz
重启Subverison
[[email protected] ~]# service subversion restart
使用svn协议访问Subversion
地址:svn://172.21.35.102/svn
用户名:svn
密码:12345
创建版本库(http协议)
# 版本库创建 [[email protected] ~]# svnadmin create /data/subversion/http [[email protected] ~]# mkdir -p /data/subversion/http-folder /data/subversion/http-folder/trunk /data/subversion/http-folder/branches /data/subversion/http-folder/tags [[email protected] ~]# svn import /data/subversion/http-folder file:///data/subversion/http -m "Creating basic directory structure" # 用户权限管理 [[email protected] ~]# htpasswd -c /data/svnwebpasswd http # 输入http库http用户的密码,这里使用12345 [[email protected] ~]# cat > /data/svnwebaccess << EOF [groups] [http:/] http=rw EOF # Apache配置 # 日志管理 [[email protected] ~]# mkdir /data/wwwlogs/subversion [[email protected] ~]# chown -R www:www /data/wwwlogs/subversion # 为apache添加mod_dav_svn和mod_authz_svn模块 [[email protected] ~]# cp -r /usr/local/subversion/libexec/* /usr/local/apache/modules/ [[email protected] ~]# echo "LoadModule dav_svn_module modules/mod_dav_svn.so" >> /usr/local/apache/conf/httpd.conf [[email protected] ~]# echo "LoadModule authz_svn_module modules/mod_authz_svn.so" >> /usr/local/apache/conf/httpd.conf [[email protected] ~]# chown -R www:www /data/subversion/http [[email protected] ~]# chown -R www:www /data/subversion/http-folder [[email protected] ~]# cat > /usr/local/apache/conf/vhost/subversion.conf << EOF <VirtualHost *:8080> ServerAdmin [email protected] ServerName subversion.test.com ErrorLog "/data/wwwlogs/subversion/error_subversiong_test_com_apache.log" CustomLog "/data/wwwlogs/subversion/access_subversion_test_com_apache.log" common <Location /> DAV svn SVNParentPath /data/subversion AuthType Basic AuthName "HTTP Subversion" AuthUserFile /data/svnwebpasswd AuthzSVNAccessFile /data/svnwebaccess Require valid-user </Location> </VirtualHost> EOF [[email protected] ~]# echo "Listen 8080" >> /usr/local/apache/conf/httpd.conf
关闭防火墙、重启Apache
[[email protected] ~]# service iptables stop [[email protected] ~]# service httpd restart
使用http协议访问Subversion
地址:http://172.21.35.102:8080/http
用户名:http
密码:12345
时间: 2024-11-03 22:13:41