UbuntuServer sets up svn services and migration methods using apache + svn and http access. First confirm the installation of apache, without installation, use the following command: sudoapt-getinstallapache2 and then install subversion and svn-apache Connection Library: sudoapt-getinstallsubversionsudoapt-getinst
Build svn service and migration method on Ubuntu Server
Apache + svn and http access are used.
Make sure that apache is installed. If apache is not installed, run the following command:
-
sudo apt-get install apache2
Then install the subversion and svn-apache Connection Library:
- Sudo apt-get install subversion
- Sudo apt-get install libapache2-svn
Add the svn user group to manage svn and add it to the apache Group of www-data:
- Sudo addgroup subversion
- Sudo usermod-G subversion-a www-data
Then you can create the svn project Repository:
- # Generally, you can create a project repository to the/home/svn directory.
- # Assume that the project name is myproject and an empty directory is created first.
- $ Sudo mkdir/home/svn
- $ Cd/home/svn
- $ Sudo mkdir myproject
- $ Sudo chown-R root: subversion myproject
- # Create an svn project by running the following command:
- $ Sudo svnadmin create/home/svn/myproject
- # Then, the group members are granted the corresponding permissions to all the files added to the file warehouse:
- # If the command order is wrong, an error may be reported. Refer to the official wiki
- $ Sudo chmod-R g + rws myproject
Finally, configure apache and Use http to access the svn service:
- # This file is automatically generated when the libapache2-svn is installed
- $ Sudo vi/etc/apache2/mod-available/dav_svn.conf
Edit the configuration file dav_svn.conf with comments. You can remove the previous # To make the statement take effect. The final content is roughly as follows:
- #/Svn indicates http: // hostname/svn/myproject
- DAV svn
- SVNParentPath/home/svn # configure the repository parent directory
- AuthType Basic
- AuthName "ToFishes Project Svn"
- AuthUserFile/etc/subversion/passwd # svn User File
- AuthzSVNAccessFile/etc/subversion/authz # authorize File Access
- Require valid-user
Svn user files/etc/subversion/passwd and authorized access files/etc/subversion/authz do not exist and need to be created manually.
Svn user files can be created using commands:
- # Add the-c option for the first creation, and add a svn user
- # Executing this command will prompt you to set a password for the new user user_name
- Sudo htpasswd-c/etc/subversion/passwd user_name
- # Remove the-c option when adding new users. Otherwise, the previous users will be destroyed.
- Sudo htpasswd/etc/subversion/passwd new_name
The user can be added, and management authorization is required for multiple svn projects, divided into different user groups:
Use vi/etc/subversion/authz to edit the authorization file. If no file exists, the file is automatically created after being edited and saved. Do not worry.
The authorization file format is as follows:
-
# User group commands
-
[groups]
-
# Format: group name = username 1, username 2
-
group1 = user1, user2
-
group2 = user1, user3
-
#other groups...
-
# Repository name in the format of svn project: corresponding directory
-
[svn_repository_name:/]
-
# Set group permissions, r = read, w = write
-
@group1= rw
-
[svn_repository_name2:/web/css]
-
@group2= rw
Restart apache after modification: sudo/etc/init. d/apache2 restart. This completes all the work.
What is the access address? As long as the current server has been bound to a domain name and the virtual host with this domain name enabled in apache.
For example, if you can access the http://www.linuxidc.com/normally, the svn Project access address is http://www.linuxidc.com/svn/project name.