Configure SVN and http access in Ubuntu
Assume that the apache server has been installed and started on port 80. All operations are performed under the root user. The created warehouse folder and the repository created on the svn server are all performed under the root user permission, which will prevent permission issues during the last client operation, you can create a dedicated svn user and grant the read and write permissions to manage the user.
Install SVN
apt-get install subversion
Create svn Repository
1). Create svn Directory: (use hidden directory)
mkdir /home/.svncd /home/.svn
2). Create a repository test1:
mkdir test1svnadmin create /home/.svn/test1
After execution, the test1 directory contains the directories and files created by svnadmin.
3) create a repository test2:
mkdir test2svnadmin create /home/.svn/test2
After execution, the test2 directory contains the directories and files created by svnadmin.
Configure and manage svn
1). Configure svnserve. conf
The configuration file for each repository is under $ repos/conf/, and vim svnserve. conf. The configuration item is under [general:
Anon-access: anonymous user permissions, including read, write, and none. The default value is read. Anonymous user access not allowed: anon-access = none
Auth-access: Authenticate the user's permissions, which can be read, write, or none. The default value is write.
Password-db: the path of the password database. Remove the path from the front #
Authz-db: Path of the authentication rule repository. Remove the # from the front #.
Note: The rows of these configuration items must be the top level; otherwise, an error is reported. After you modify the configuration, You need to restart svn to make it take effect.
2) configure the passwd file
This is the password file for each user. It is relatively simple, that is, "user name = password", using a clear code. For example
adminuser = passwordxxxuser1 = 111111user2 = 222222
3) configure the authz File
[Groups]: to facilitate management, you can put some users in a group, for example:
[groups]admin = adminuserdevelop = user1,uesr2
The sections under the groups table indicate the authentication rules for a directory. For example, the section of the authentication rules for the root directory is [/]. When setting a single-user authentication rule, a single user line is required. If you use a group, add @ in front of the group name @
[/] @ Admin = rw # the admin user group has the permission to the root directory rw.
If the file is started from/home/. svn/test1 at startup,/is the test1 directory. Use the above method to set permissions for the root directory test1.
If it is started from/home/. svn/, the root of each warehouse is its own starting directory. You can set the permissions of test1 in the preceding way, or in the following way:
[test1:/]@admin=rw[test1:/trunk/test1]@develop=rw
The root directory (/) of each warehouse is its own starting directory. [repos:/] This method is only applicable to multiple warehouses. [/] It is applicable to single warehouse and single warehouse.
Start and Stop svn
1). Start:
Start from the test1 directory (a project warehouse directory)
svnserve -d -r /home/.svn/test1
The root directory (/) is test1. Use section [/] For rule configuration in authz. Access Method: svn: // 192.168.0.87/
Start from the. svn directory
svnserve -d -r /home/.svn
The root directory (/) is. svn. Use section [test1:/] for the configuration of test1 in authz. The access method is as follows:
Svn: // 192.18.0.87/test1
Svn: // 192.18.0.87/test2
Add the command to/etc/rc. local
2). Check whether the svn server has been started (svn uses port 3690 by default ):
netstat -tnl | grep 3690
3). Stop:
killall svnserve
Configure http access
Configure svn to apache and access the/etc/apache2/apache. conf file through http web. Then add the following content to the end of apache. conf.
<Location /test1> DAV svn SVNPath /home/.svn/test1 AuthzSVNAccessFile /home/.svn/test1/conf/authz AuthType Basic AuthName "Subversion Repository" AuthUserFile /home/.svn/test1/conf/passwd Require valid-user</Location>
When there are multiple projects, you need to add multiple of the above configuration items.
To enable apache to identify svn permission configuration items, load the following modules to ensure apache is loaded:
LoadModule dav_module modules/mod_dav.soLoadModule dav_fs_module modules/mod_dav_fs.soLoadModule dav_svn_module modules/mod_dav_svn.soLoadModule authz_svn_module modules/mod_authz_svn.so
After completing the preceding configuration, you can use http: // 192.18.0.87/test1.
Set up SVN server svn in Ubuntu 14.04 ://
CentOS 6.2 SVN setup (YUM installation)
Deploy Apache + SVN in CentOS 6.5
Build an SVN server using Apache + SVN
Set up and use the SVN server in Windows + reset the password on the client
Install SVN in Ubuntu Server 12.04 and migrate Virtual SVN data
Build svn service and migration method on Ubuntu Server