前提安装:GCC G++
yum install gcc
yum install g++
一、准备安装文件
subversion-1.8.17.tar.gz
http://subversion.apache.org/download/
wget http://archive.apache.org/dist/subversion/subversion-1.8.17.tar.gz
apr支持包
http://apr.apache.org/download.cgi
apr-1.5.2.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.g
httpd-2.2.32.tar.gz
http://httpd.apache.org/download.cgi
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.32.tar.gz
sqlite-amalgamation
http://www.sqlite.org/download.html
wget http://www.sqlite.org/2017/sqlite-amalgamation-3190300.zip
二、编译安装--依次执行命令如下:
tar -xvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure
make
make install
cd ..
tar -xvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install
cd ..
tar -xvf httpd-2.2.32.tar.gz
cd httpd-2.2.32
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --enable-modules=so --enable-dav --enable-maintainer-mode --enable-rewrite
[注意:这里请务必加上参数--enable-modules=so --enable-dav]
ln -s /lib64/libexpat.so.1 /usr/lib64/libexpat.so.0
ln -s /lib64/libexpat.so.1 /usr/lib/libexpat.so
[注意:这里请务必加上符号链接]
make
make install
修改apache端口:
vi /usr/local/apache/conf/httpd.conf
将 Listen 80 那一行的80端口改为65080,80端口给nginx使用
启动apache:
/usr/local/apache/bin/apachectl start
检测apache:
curl http://localhost:65080
<html><body><h1>It works!</h1></body></html>
启动成功!
三、安装SVN Server
cd ..
unzip sqlite-amalgamation-3190300.zip
tar -zxf subversion-1.8.17.tar.gz
mv sqlite-amalgamation-3190300 subversion-1.8.17/sqlite-amalgamation
cd subversion-1.8.17
./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr/
--with-apr-util=/usr/local/apr-util/ --with-sqlite=/usr/local/sqlite/ --with-apxs=/usr/local/apache/bin/apxs --with-apache-libexecdir --with-openssl --enable-maintainer-mode
make && make install
# 编译完成后添加环境变量:
vim /etc/profile.d/svn.sh
export PATH=/usr/local/svn/bin/:$PATH
. /etc/profile.d/svn.sh #生效
查看是否安装成功:
/usr/local/svn/bin/svnserve --version
![](https://img-blog.csdn.net/20170616134847834?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2NyZW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
建立版本库:
/usr/local/svn/bin/svnadmin create /usr/local/svn/projecttest
四、Apache支持SVN的配置:
vi /usr/local/apache/conf/httpd.conf
在末尾先引入两个动态库文件:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
加入Location:
<Location /svn>
DAV svn
SVNParentPath /usr/local/svn
AuthType Basic
AuthName "Hello welcome to here"
AuthUserFile /usr/local/svn/passwd
AuthzSVNAccessFile /usr/local/svn/auth.conf
Require valid-user
</Location>
复制svn中的mod_dav_svn.so和mod_authz_svn.so文件到apche的modules目录下
cp /usr/local/svn/libexec/mod_dav_svn.so /usr/local/apache/modules/
cp /usr/local/svn/libexec/mod_authz_svn.so /usr/local/apache/modules/
重启Apache
apahce启动命令:
推荐/usr/local/apache/bin/apachectl start apaceh启动
apache停止命令
/usr/local/apache/bin/apachectl stop 停止
apache重新启动命令:
/usr/local/apache/bin/apachectl restart 重启
要在重启 Apache 服务器时不中断当前的连接,则应运行:
/usr/local/sbin/apachectl graceful
如果apache安装成为linux的服务的话,可以用以下命令操作:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
五、创建svn用户
/usr/local/apache/bin/htpasswd -c /usr/local/svn/passwd admin
[注意:第一次需要输入参数-c,第二次就不需要了,如果继续通过-c参数命令创建,则会覆盖passwd文件内容。]
第二次或以后输入命令
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user1
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user2
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user3
如果修改则可通过-m参数进行修改
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user1
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user2
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user3
创建权限文件
vi /usr/local/svn/auth.conf
r为读,w为写
启动SVN:
/usr/local/svn/bin/svnserve -d -r /usr/local/svn/
六、配置SVN支持外网访问:
安装简单,请问度娘
server {
listen 80;
server_name testsvn.baidu.com;
error_page 403 404 /40x.html;
location = /40x.html {
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#charset koi8-r;
charset UTF-8;
location /svn/projecttest {
proxy_pass http://127.0.0.1:65080/svn/projecttest;
}
location / {
return 404;
}
}
yum install gcc
yum install g++
一、准备安装文件
http://subversion.apache.org/download/
wget http://archive.apache.org/dist/subversion/subversion-1.8.17.tar.gz
apr支持包
http://apr.apache.org/download.cgi
apr-1.5.2.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.g
httpd-2.2.32.tar.gz
http://httpd.apache.org/download.cgi
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.32.tar.gz
sqlite-amalgamation
http://www.sqlite.org/download.html
wget http://www.sqlite.org/2017/sqlite-amalgamation-3190300.zip
二、编译安装--依次执行命令如下:
tar -xvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure
make
make install
cd ..
tar -xvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install
cd ..
tar -xvf httpd-2.2.32.tar.gz
cd httpd-2.2.32
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --enable-modules=so --enable-dav --enable-maintainer-mode --enable-rewrite
[注意:这里请务必加上参数--enable-modules=so --enable-dav]
ln -s /lib64/libexpat.so.1 /usr/lib64/libexpat.so.0ln -s /lib64/libexpat.so.1 /usr/lib/libexpat.so
[注意:这里请务必加上符号链接]
makemake install
修改apache端口:
vi /usr/local/apache/conf/httpd.conf
将 Listen 80 那一行的80端口改为65080,80端口给nginx使用
启动apache:
/usr/local/apache/bin/apachectl start
检测apache:
curl http://localhost:65080
<html><body><h1>It works!</h1></body></html>
启动成功!
三、安装SVN Server
cd ..
unzip sqlite-amalgamation-3190300.zip
tar -zxf subversion-1.8.17.tar.gz
mv sqlite-amalgamation-3190300 subversion-1.8.17/sqlite-amalgamation
cd subversion-1.8.17
--with-apr-util=/usr/local/apr-util/ --with-sqlite=/usr/local/sqlite/ --with-apxs=/usr/local/apache/bin/apxs --with-apache-libexecdir --with-openssl --enable-maintainer-mode
make && make install
# 编译完成后添加环境变量:
vim /etc/profile.d/svn.sh
export PATH=/usr/local/svn/bin/:$PATH
. /etc/profile.d/svn.sh #生效
/usr/local/svn/bin/svnserve --version
建立版本库:
/usr/local/svn/bin/svnadmin create /usr/local/svn/projecttest
四、Apache支持SVN的配置:
vi /usr/local/apache/conf/httpd.conf
在末尾先引入两个动态库文件:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
加入Location:
<Location /svn>
DAV svn
SVNParentPath /usr/local/svn
AuthType Basic
AuthName "Hello welcome to here"
AuthUserFile /usr/local/svn/passwd
AuthzSVNAccessFile /usr/local/svn/auth.conf
Require valid-user
</Location>
复制svn中的mod_dav_svn.so和mod_authz_svn.so文件到apche的modules目录下cp /usr/local/svn/libexec/mod_dav_svn.so /usr/local/apache/modules/
cp /usr/local/svn/libexec/mod_authz_svn.so /usr/local/apache/modules/
重启Apache
apahce启动命令:
推荐/usr/local/apache/bin/apachectl start apaceh启动
apache停止命令
/usr/local/apache/bin/apachectl stop
apache重新启动命令:
/usr/local/apache/bin/apachectl restart 重启
要在重启 Apache 服务器时不中断当前的连接,则应运行:
/usr/local/sbin/apachectl graceful
如果apache安装成为linux的服务的话,可以用以下命令操作:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
五、创建svn用户/usr/local/apache/bin/htpasswd -c /usr/local/svn/passwd admin
[注意:第一次需要输入参数-c,第二次就不需要了,如果继续通过-c参数命令创建,则会覆盖passwd文件内容。]
第二次或以后输入命令
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user1
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user2
/usr/local/apache/bin/htpasswd /usr/local/svn/passwd user3
如果修改则可通过-m参数进行修改
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user1
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user2
/usr/local/apache/bin/htpasswd -m /usr/local/svn/passwd user3
创建权限文件
vi /usr/local/svn/auth.conf
r为读,w为写
启动SVN:
/usr/local/svn/bin/svnserve -d -r /usr/local/svn/
六、配置SVN支持外网访问:
安装简单,请问度娘
server {
listen 80;
server_name testsvn.baidu.com;
error_page 403 404 /40x.html;
location = /40x.html {
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#charset koi8-r;
charset UTF-8;
location /svn/projecttest {
proxy_pass http://127.0.0.1:65080/svn/projecttest;
}
location / {
return 404;
}
}