Transferred from: http://www.linuxidc.com/Linux/2013-05/84693.htm
Ubuntu Server build SVN service and Migration method
Use apache+svn,http access mode.
Make sure that Apache is installed and not installed with the following command:
sudo apt-get install apache2
Then install subversion and Svn-apache connection libraries:
- sudo apt-get Install subversion
- sudo apt-get install libapache2-svn
Add SVN user groups to manage SVN and add to Www-data's Apache group:
- sudo addgroup subversion
- sudo usermod -G Subversion -a www-data
You can then create the SVN project repository:
- # project warehouses can typically be built into the/HOME/SVN directory
- # If the project name is MyProject, create an empty directory first
- $ sudo mkdir /home/svn
- $ cd /home/svn
- $ sudo mkdir myproject
- $ sudo chown -R root:subversion myproject
- #创建为svn项目, use the following command
- $ sudo svnadmin create /home/svn/myproject
- # then give the group members the appropriate permissions for all newly added files to the file repository:
- # If the order is wrong, you may get an error, please refer to the official Wiki
- $ sudo chmod -R g+RWS myproject
Finally, configure Apache to access the SVN service with the HTTP protocol:
- # This file is automatically generated when LIBAPACHE2-SVN is installed
- $ sudo vi /etc/apache2/Mods-available/dav_svn. conf
Edit the dav_svn.conf configuration file, there are comments, you can remove the previous # to make the statement effective, the final content is probably as follows:
- <location/svn> #/svn represents http://hostname/svn/myproject
- DAV SVN
- SVNPARENTPATH/HOME/SVN #配置仓库父目录
- AuthType Basic
- AuthName "Tofishes Project Svn"
- AUTHUSERFILE/ETC/SUBVERSION/PASSWD #svn用户文件
- Authzsvnaccessfile/etc/subversion/authz #授权访问文件
- Require Valid-user
- </Location>
The SVN user file/etc/subversion/passwd and the authorized Access file/etc/subversion/authz are not present and need to be created manually.
SVN user files can be created by command:
- #首次创建需要加-C option to add an SVN user
- #执行该命令会提示为新用户user_name设置密码
- sudo htpasswd -c /etc/subversion/passwd user_name
- #以后添加新用户, you need to remove the-c option, or the previous user is destroyed
- sudo htpasswd /etc/subversion/passwd new_name
Users can add, and require administrative authorization, for multiple SVN projects to divide different groups of users:
Edit the authorization file with Vi/etc/subversion/authz, no files are edited and saved automatically, do not worry.
The authorization file content format is as follows:
#用户组指令
[groups]
#格式为 Group name = user Name 1, user Name 2
= User1, user2
= User1, user3
#other groups ...
repository name for #格式为 SVN project: corresponding directory
[svn_repository_name:/]
#设置组的权限, R=read, W=write
@group1= rw
[svn_repository_name2:/web/css]
@group2= rw
After the last restart Apache:sudo/etc/init.d/apache2 restart. So the work is all done.
What is the access address, as long as the current server is already bound to a domain name, and the virtual host of this domain name is enabled in Apache.
For example, to access http://www.linuxidc.com/normally, the access address of the SVN project is the http://www.linuxidc.com/svn/project name.
Ubuntu Server build SVN Service and migration method "Go"