Apache+Subversion+TortoiseSVN
发布日期:2021-09-08 15:09:16
浏览次数:6
分类:技术文章
本文共 2711 字,大约阅读时间需要 9 分钟。
Key words: dav_svn, apache, subversion, tortoisesvn
# install apache2
sudo apt-get install libapache2-svn apache2
# install subversion
sudo apt-get install subversion
# enable the module mod_dav_svn
sudo a2enmod ssl
sudo a2enmod dav_svn
# create the directory for svn
mkdir -p /var/svn
# create the SVN repository
sudo svnadmin create /var/svn/repoOne
(then grant the necessary for the account apache will be running under. say we will run under the default account of ubuntu, then make ubuntu the owner of the repository)
sudo chown -R ubuntu repoOne
(Need to make sure the apache account has sufficient permission to this folder.)
# edit the envars
vi /etc/apache2/envars, change as below:
export APACHE_RUN_USER=ubuntu
export APACHE_RUN_GROUP=ubuntu
# create svn authentication file under /etc/apache2/svn-auth-file
##first user for userOne(need "-c" argument as to create a new auth file)
sudo htpasswd -cm /etc/apache2/svn-auth-file userOne [PWD]
##second user for userTwo
sudo htpasswd -m /etc/apache2/svn-auth-file userTwo [PWD]
# edit dav_svn.conf
vi /etc/apache2/mods-enabled/dav_svn.conf, so apache knows all accesses to the resource under the directory need to be handled by the module of mod_dav_svn.
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/svn-auth-file
Require valid-user
SSLRequireSSL
</Location>
## For AuthType, there can be two options:
Basic: this will leverage the ssl over http communication
DSA: not recommended
## For SVNParentPath, easy for new repository creation, otherwise use SVNPath instead for single repository
# create self assigned cert
sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
# new virtual host for svn
create a new virtual server called "svnserver" under /etc/apache2/sites-enabled, contents as below:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName serverName
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
DocumentRoot /var/svn
ErrorLog ${APACHE_LOG_DIR}/error_svn.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
</VirtualHost>
# restart apache
sudo service apache2 restart
# check svn setup
put the link either in browser or TortoiseSVN
# install apache2
sudo apt-get install libapache2-svn apache2
# install subversion
sudo apt-get install subversion
# enable the module mod_dav_svn
sudo a2enmod ssl
sudo a2enmod dav_svn
# create the directory for svn
mkdir -p /var/svn
# create the SVN repository
sudo svnadmin create /var/svn/repoOne
(then grant the necessary for the account apache will be running under. say we will run under the default account of ubuntu, then make ubuntu the owner of the repository)
sudo chown -R ubuntu repoOne
(Need to make sure the apache account has sufficient permission to this folder.)
# edit the envars
vi /etc/apache2/envars, change as below:
export APACHE_RUN_USER=ubuntu
export APACHE_RUN_GROUP=ubuntu
# create svn authentication file under /etc/apache2/svn-auth-file
##first user for userOne(need "-c" argument as to create a new auth file)
sudo htpasswd -cm /etc/apache2/svn-auth-file userOne [PWD]
##second user for userTwo
sudo htpasswd -m /etc/apache2/svn-auth-file userTwo [PWD]
# edit dav_svn.conf
vi /etc/apache2/mods-enabled/dav_svn.conf, so apache knows all accesses to the resource under the directory need to be handled by the module of mod_dav_svn.
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/svn-auth-file
Require valid-user
SSLRequireSSL
</Location>
## For AuthType, there can be two options:
Basic: this will leverage the ssl over http communication
DSA: not recommended
## For SVNParentPath, easy for new repository creation, otherwise use SVNPath instead for single repository
# create self assigned cert
sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
# new virtual host for svn
create a new virtual server called "svnserver" under /etc/apache2/sites-enabled, contents as below:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName serverName
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
DocumentRoot /var/svn
ErrorLog ${APACHE_LOG_DIR}/error_svn.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
</VirtualHost>
# restart apache
sudo service apache2 restart
# check svn setup
put the link either in browser or TortoiseSVN
https://serverName/svn/repoOne/
Reference:
http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.serverconfig.choosing.apache
http://stackoverflow.com/questions/60736/how-to-setup-a-subversion-svn-server-on-gnu-linux-ubuntu
本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5266397.html,如需转载请自行联系原作者
转载地址:https://blog.csdn.net/weixin_34326429/article/details/90163511 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2024年04月01日 23时36分22秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
TightVNC二次开发(2) Windows下使用VS2012编译服务器端和客户端
2019-04-25
小波C++库
2019-04-25
减佣还是返佣,外卖“佣金争议”背后的经济学
2019-04-25
解构荣耀销量奇迹背后的化学反应:技术+品质+产品力
2019-04-25
泰禾集团联席总裁葛勇:战“疫”于未然,文化筑居中国
2019-04-25
联想10年: 沽空不断,市值徘徊,10亿股先生为何叫不醒?
2019-04-25
年报发布后股价三连涨,神州租车何以成为 “方舱号”?
2019-04-25
CobaltStrike 部署
2019-04-25
Linux 安装 JAVA
2019-04-25
160.相交链表
2019-04-26
树莓派(Raspberry Pi)——利用原装摄像头实现简单圆形检测
2019-04-26
挑战程序设计竞赛(第2版)
2019-04-26
RabbitMQ集群及镜像配置部署详解
2019-04-26
常用的JVM参数详解
2019-04-26
Ansible自动化运维实战部署1
2019-04-26
HTML基础知识与简介
2019-04-26
表格标签介绍
2019-04-26
CSS基础知识
2019-04-26
JavaScript 操作 HTML DOM
2019-04-26