您的位置:首页 > 其它

华为云搭建SVN服务器

2017-03-24 14:17 183 查看
最近买了华为云服务器(ubuntu server 14.04),准备玩玩云,本文就是记录一下如何在华为云上搭建SVN服务器,跟阿里云上搭建SVN服务器还是有点区别的。

第一次登录或第一次用SSH远程登录,需要跟客服要文档。华为云的安全策略,第一次使用apache2服务,需要看如何修改安全策略,增加80端口的公网访问,80端口是Apache2服务的默认端口。修改安全策略帮助帮助

(1)安装软件

sudo apt-get install subversion apache2 libapache2-svn


(2)SVN服务器配置

sudo addgroup subversion
sudo usermod -G subversion -a www-data
其中以上2条命令不能更改。查看用户组 cat /etc/group|grep subversion
创建项目目录    sudo mkdir /home/svn
配置dav_svn.conf文件 vim /etc/apache2/mods-available/dav_svn.conf


# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.

# <Location URL> ... </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/ # Note, a literal /svn should NOT exist in your document root.
<Location /svn>
#enable the repository
DAV svn

# Set this to the path to your repository
#SVNPath /home/svn/vod
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
#用这个,以便放多个repository
SVNParentPath /home/svn

# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
#指定基本用户验证的密码文件存放位置
AuthUserFile /etc/subversion/dav_svn.passwd

# To enable authorization via mod_authz_svn
#mod_authz_svn配置文件的位置, 有

<IfModule mod_authz_svn.c>

AuthzSVNAccessFile /etc/subversion/dav_svn.authz

</IfModule>

# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>

</Location>


其中/etc/subversion/dav_svn.passwd是SVN的用户名和密码设置,指定用户验证密码文件存放位置

/etc/subversion/dav_svn.authz是访问权限配置

重启Apache2服务: sudo /etc/init.d/apache2 restart

(3)创建SVN仓库文件

创建项目存放路径
cd /home/svn


mkdir project1


更改版本库所示用户、组

sudo chown -R root:subversion project1


创建SVN仓库

sudo svnadmin create /home/svn/project1


更改权限

sudo chmod -R g+rws project1


(4)用户权限配置

创创建用户hadesjaky和密码,执行命令后输入密码

sudo htpasswd -c etc/subversion/dav_svn.passwd hadesjaky


继续添加新用户,去掉-c,否则会覆盖之前设定的用户名和密码

创建授权文件

vi htpasswd /etc/subversion/dav_svn.authz


里面输入

[groups]

administrator=hadesjaky

[project1:/]

@administrator=rw


重启SVN服务器

killall svnserve

svnserve -d -r /home/svn/


检测

svn checkout http://地址/svn/project1 project1 --username 用户名 --password 密码


相关问题

AH00558错误解决:在 sudo vi /etc/apache2/conf-enabled/httpd.conf 增加如下内容

ServerName 127.0.0.1:80


修改/etc/hosts 文件,修改127.0.0.1 localhost 修改为127.0.0.1 主机名

查看端口命令:
sudo netstat -aunpt| grep LISTEN


查看SVN服务进程:
sudo ps aux | grep svn


参考资料

win远程连接Linux主机

阿里云创建SVN服务器

阿里云搭建SVN服务器
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  华为云 svn 云服务器