I. For details about installing and configuring SVN, refer to idea.
I. SVN installation and configuration
See http://www.linuxidc.com/Linux/2011-11/47128.htm for details
1. Install SVN, including using apache2 to browse SVN plug-ins
- $ Sudo apt-GetInstall subversion
- $ Sudo apt-GetInstall libapache2-svn// This is the apache installation part. You do not need to install this part if you do not use the http protocol.
2. Configure the svn Server
First, create a subversion user group, add both www-data and yourself to the group, and create a code repository.
- $ Sudo addgroup subversion
- $ Sudo usermod-G subversion-a www-data
- $ Sudo mkdir/opt/svn// Create the SVN root location
- $ Cd/opt/svn// Enter the SVN root location
- $ Sudo mkdir nginx// Create a project code library
- $ Sudo svnadmin create/home/svn/npmonitor// Create a new code library
- // If the access is unavailable, perform the following authorization statements:
- $ Sudo chown-R root: subversion nginx// Here you need to add permissions to www-data, because apache is used later.
- $ Sudo chmod-R g + rws nginx// This is to grant the group members the corresponding permissions on all files added to the file warehouse.
3. Configure SVN access methods
The Subversion File Repository can be accessed (checked Out and checked Out) in many different ways-either through a local hard disk or through various network protocols.
To access the SVN File Repository through the WebDAV protocol, you must configure your Apache 2 Web server. You must add the following code snippet to your/etc/apache2/mod-available/dav_svn.conf file:
-
- DAV svn
- SVNPath/opt/svn/webbase
- AuthType Basic
- AuthName"Subversion Repository"
- AuthUserFile/etc/apache2/dav_svn.passwd
- # To enable authorization via mod_authz_svn
- AuthzSVNAccessFile/etc/apache2/dav_svn.authz
- Require valid-use
Next, you need to create the/etc/apache2/dav_svn.passwd file. This file contains detailed information about user authorization. To add a user, run the following command:
$sudo htpasswd -c /etc/apache2/dav_svn.passwd user_name
It will prompt you to enter the password. When you enter the password, the user will be created. Next, you need to create the/etc/apache2/dav_svn.authz file. This file is used to configure its access control. For example, create the dav_svn.authz file and enter User_name = rw This allows user_name to access the read and write permissions of files in webbase. For detailed configuration, see the authz file under/opt/svn/webbase/conf. When you add the preceding content, you must restart the Apache 2 Web server. Enter the following command: $ Sudo/etc/init. d/apache2 restart |
After webadmin is added, the following prompt is displayed. You can add the version library "webbase" as needed. Now you should run trac-admin $ ENV repository resync "webbase" to synchronize the Trac and version libraries. You should also set a post-commit hook on the version library to call trac-admin $ ENV changeset added "webbase" $ REV for each submitted Change set. Example: $ sudo trac-admin/path/to/env changeset added "$1" "$2"