<!-- google_ad_section_start -->
All the required packages are available in the Ubuntu repositories.
Installing Subversion
Use apt-get:
sudo apt-get update
sudo apt-get install subversion
Creating a Repository
Let's say you want your repository to be in /var/svn/repos, type in these commands:
cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/repos
In order to control who has access to the repository we will now add a user who will own the repository files. Adding a user also adds a group with the same name.
sudo adduser svn
Now make it impossible for anyone to log in as this user by editing /etc/passwd to set the svn user shell to /bin/false. Do this using the vipw command. Find the line which starts svn (it should be the last line in the file) and change /bin/bash to /bin/false.
Now change the ownership of the repository files.
sudo chown -R svn.svn svn
In order for someone to be permitted to use the repository they must be added to the svn group. My user name is martin so I am going to add myself to the svn group.
sudo vigr
Go to the end of the file and add your user name to the end of the line which starts svn. The end of the file should look similar to this:
admin:x:110:martin
svn:x:1001:martin
Now set up an ssh server, clients will connect to this machine using ssh:
sudo apt-get install openssh-server
The repository can now be accessed using the svn+ssh protocol. Test this as follows:
svn co svn+ssh://username@machinename/var/svn/repos
You will be prompted about the RSA fingerprint of the server and asked for your password. You should end up with a directory called repos which is a working copy of your new repository.
As things stand you will be asked for your password every time you connect to the machine which is rather tedious. You can also authenticate with ssh by using a public/private key pair. If you are using a Windows client then install PuTTY and use PuTTYgen to create a key. Don't forget to save the public and private key files. There is a text box at the top of the PuTTYgen window labeled "Public key for pasting into OpenSSH authorized_keys file", you need to put the line of text in that box into a file called .ssh/authorized_keys2 in your home directory on the server. Set the permissions on the files like this:
chmod 0700 .ssh
chmod 0600 .ssh/authorized_keys2
On the Windows machine fire up pageant (another program which comes with PuTTY) and load your private key. You should now be able to connect to the server without being asked for a password. I prefer to disable password based access to the server by editing /etc/ssh/sshd_config and adding the line PasswordAuthentication no.
On a Linux client use ssh-keygen to create the key pair.
Apache
Subversion also supports the WebDAV protocol, to set this up Apache is needed. I am assuming that you installed Ubuntu as a LAMP server.
sudo apt-get install libapache2-svn
The following isn't recommended for a real implementation as we are going to add to the default web files. It would be far better to create a new virtual host, but that is a subject itself.
Ubuntu has a file for each active virtual host in /etc/apache2/sites-enabled, after installing Ubuntu server there will be a file called 000-default in the sites-enabled directory and this is the file we are going to edit.
cd /etc/apache2/sites-enabled
sudo vi 000-default
In the directive add:
<Location /svn/repos>
DAV svn
SVNPath /var/svn/repos
</Location>
Then execute this command:
sudo /etc/init.d/apache2 force-reload
You should now be able to see the repository at the URL http://machinename/svn/repos.
Securing Web Access
Add this to the location directive:
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/passwords
Require valid-user
Now add a user name and password to the Apache password file:
sudo htpasswd -cb /etc/apache2/passwords martin dgjan08
And another forced reload:
sudo /etc/init.d/apache2 force-reload
Now if you visit the repository URL you will have to enter a valid user name and password.
Trac
Trac is a ticketing system and Wiki which integrates very well with Subversion. Start by installing Trac:
sudo apt-get install trac python-setuptools libapache2-mod-python enscript
Now create a Trac database:
sudo mkdir /var/www/trac
sudo trac-admin /var/www/trac/repos initenv
Then answer its questions, take the defaults, our Subversion repository is in /var/svn/repos.
Now to get Apache to run Trac.
cd /var/www
sudo chown -R www-data.svn trac
Head back to /etc/apache2/sites-enabled and edit 000-default again, adding this:
<Location /trac/[[:alnum]]+/login">
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/passwords
Require valid-user
</Location>
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/www/trac
PythonOption TracUriRoot /trac
</Location>
And then run this again:
sudo /etc/init.d/apache2 force-reload
Building Trac from source
If you want the most recent version of Trac (0.10.4) then you will have to build and install it. Do the following:
sudo apt-get remove trac
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
tar zxf trac-0.10.4.tar.gz
cd trac-0.10.4/
sudo mkdir /usr/local/trac
sudo python setup.py install --prefix=/usr
The rest of the instructions are the same.
<!-- google_ad_section_end -->
相关推荐
ubuntu12.04 svn 服务器配置,希望可以帮助到你
Ubuntu上搭建SVN服务器详细步骤。 目 录 1 概述 1 2 安装Ubuntu 9.10服务器 1 3 安装Apache服务器 1 4 创建SVN服务器 1 4.1 安装SVN 1 4.2 增加组 2 4.3 创建SVN仓库 2 4.4 配置Apache服务器 2 5 配置SSL 3 6 远程...
ubuntu下SVN服务器安装配置 标签: ubuntu svn it 分类: sys-linux/windows 一、SVN安装 1.安装包 $ sudo apt-get install subversion 2.添加svn管理用户及subversion组 $ sudo adduser svnuser $ sudo addgroup...
Ubuntu下配置svn服务器,配置手册,很详细的
ubuntu 9.04下svn服务器配置,包括三种不同访问方式以及访问权限设置
ubuntu安装svn步骤及所需文件
在Ubuntu 18 LTS环境中,搭建一个简单apache2+subversion的版本控制。
ubuntu16 下搭建svn服务器的搭建详细步骤,发现网上很多教程不够详细,或者是简单粘贴,文档内容绝对亲测,放心使用
ubuntu下简单安装svn 服务器--简介: svn是目前使用比较多的版本控制软件,目前在linux下,svn服务器一般有两个选择:svnserve和apache,下文就主要介绍怎么在ubuntu9.10里安装和使用svn服务器。
需要注意的是如果该文件是在windows下创建的,在拷贝到Ubuntu或Linux环境下需要转换格式,可使用dos2unix进行转换。 2.安装Authen::SASL模块 因为Perl通过SMTP发送邮件,其中SMTP验证的时候需要Authen::SASL模块。 ...
NULL 博文链接:https://shoukii0721.iteye.com/blog/1634012
SVN服务器使用说明-Ubuntu版本 公司最近要用SVN,整理好得文档
操作SVN界面习惯了,到了linux下懒得再用命令行了; 按照网上的步骤操作,遇到了各种问题,又对各个问题作了整理和说明 包含了客户端和服务器端需要做的修改 希望能给大家帮助 如果有问题,也请联系我,很高兴和大家...
ubuntu上建立svn服务器[收集].pdf
linux系统下svn服务器操作命令, 初学者ubuntu系统下可以使用,希望对大家有帮助
svn jsvnadmin 搭建 svn服务器
dedian环境下subversion的安装以及配置,ubuntu下的也差不多,可以参考使用
ubunut下使用终端提交到svn服务器上时的命令说明。
。。。