As a new generation of code version management tools, SVN has many advantages, such as convenient management, clear logic, high security, and high code consistency. SVN data storage has two methods: BDB Transaction Security table type) and FSFS, which do not require a database storage system). To avoid locking data when the server connection is interrupted, FSFS is a safer and more popular method. There are two ways to run SVN: one is an independent server, and the other is to use the apache service, each of which has its own advantages and disadvantages. The following describes the respective deployment steps of the two methods.
1. run as an independent server:
① Install svn using the local yum source. yum install svn is included in the operating system image. For detailed steps, see http://ailurus.blog.51cto.com/4814469/1168336;
② Create a version Library:
- Mkdir/svn/project // folder where the version library is created
- Svnadmin create -- fs-type fsfs/svn/project/first
- // Create a version library. If you need to store it in bdb mode, change fsfs to bdb.
③ Initialize the version library, that is, import the file to the version Library:
- Svn import/home/software file: // svn/project/first -- message "initialization version"
- // Import the files in the home folder to the version Library
- Svn list -- verbose file: // svn/project/first // view the imported file
④ Start the svn service. The default port of the svn service is 3690. You can run the "netstat-ntlp" command to check whether the service is successfully started:
- svnserve -d -r /svn/project/first
⑤ Modify the policy control file vi authz. If you want to add a user later, add the user name to the corresponding user group admin or user:
- ### This file is an example authorization file for svnserve.
- ### Its format is identical to that of mod_authz_svn authorization
- ### Files.
- ### As shown below each section defines authorizations for the path and
- ### (Optional) repository specified by the section name.
- ### The authorizations follow. An authorization line can refer:
- ###-A single user,
- ###-A group of users defined in a special [groups] section,
- ###-An alias defined in a special [aliases] section,
- ###-All authenticated users, using the '$ authenticated' token,
- ###-Only anonymous users, using the '$ anonymous' token,
- ###-Anyone, using the '*' wildcard.
- ###
- ### A match can be inverted by prefixing the rule '~ '. Rules can
- ### Grant read ('R') access, read-write ('rw ') access, or no access
- ###('').
-
- [Aliases]
- # Joe =/C = XZ/ST = Dessert/L = Snake City/O = Snake Oil, Ltd./OU = Research Institute/CN = Joe Average
-
- [Groups]
- # Harry_and_sally = harry, sally
- # Harry_sally_and_joe = harry, sally, & joe
- Admin = first, second, third // members of the user group admin
- User = anyone // Member of the user group
-
- # [/Foo/bar]
- # Harry = rw
- # & Joe = r
- # * =
-
- # [Repository:/baz/fuz]
- # @ Harry_and_sally = rw
- # * = R
-
- [/]
- @ Admin = rw // members in the user group admin have read and write permissions
- @ User = r // members in the user group have the read permission
6. Add the svn access user, vi passwd, set the password for the user allocated in authz, the user name on the left of the equal sign, and the password on the right of the equal sign;
- ### This file is an example password file for svnserve.
- ### Its format is similar to that of svnserve.conf. As shown in the
- ### example below it contains one section labelled [users].
- ### The name and password for each user follow, one account per line.
-
- [users]
- # harry = harryssecret
- # sally = sallyssecret
-
- first=first
- second=second
- third=third
- anyone=anyone
7. Modify the Permission Policy file read by svn, vi/svn/project/first/conf/svnserve. conf:
- Anon-access = none // anonymous users are not allowed to read and write
- Auth-access = write
- Password-db = passwd // passwd file read by svn
- Authz-db = authz // permission Control File Read by svn
After installing the svn client, you can use the following url to access the client:
Svn: // ip address/svn/project/first
2. Access svn through the web through the apache server:
① Install two svn plug-ins on the apache server. The two plug-ins can also be installed using yum:
- Yum install mod_dav_svn // enables subversion to communicate with the dav Module
- Yum install mod_authz_svn // implement the permission Control Function
② Run the "httpd-M" command to check whether the two modules are loaded. If the two modules are loaded, the following response is returned:
- Loaded Modules:
- core_module (static)
- mpm_prefork_module (static)
- http_module (static)
- so_module (static)
- auth_basic_module (shared)
- auth_digest_module (shared)
- authn_file_module (shared)
- authn_alias_module (shared)
- authn_anon_module (shared)
- authn_dbm_module (shared)
- authn_default_module (shared)
- authz_host_module (shared)
- authz_user_module (shared)
- authz_owner_module (shared)
- authz_groupfile_module (shared)
- authz_dbm_module (shared)
- authz_default_module (shared)
- ldap_module (shared)
- authnz_ldap_module (shared)
- include_module (shared)
- log_config_module (shared)
- logio_module (shared)
- env_module (shared)
- ext_filter_module (shared)
- mime_magic_module (shared)
- expires_module (shared)
- deflate_module (shared)
- headers_module (shared)
- usertrack_module (shared)
- setenvif_module (shared)
- mime_module (shared)
- dav_module (shared)
- status_module (shared)
- autoindex_module (shared)
- info_module (shared)
- dav_fs_module (shared)
- vhost_alias_module (shared)
- negotiation_module (shared)
- dir_module (shared)
- actions_module (shared)
- speling_module (shared)
- userdir_module (shared)
- alias_module (shared)
- substitute_module (shared)
- rewrite_module (shared)
- proxy_module (shared)
- proxy_balancer_module (shared)
- proxy_ftp_module (shared)
- proxy_http_module (shared)
- proxy_ajp_module (shared)
- proxy_connect_module (shared)
- cache_module (shared)
- suexec_module (shared)
- disk_cache_module (shared)
- cgi_module (shared)
- version_module (shared)
- authz_ldap_module (shared)
- dav_svn_module (shared)
- authz_svn_module (shared)
- Syntax OK
③ Edit the apache service configuration file vi/etc/httpd/conf/httpd. conf and add the following lines:
- <Location/svn>
- DAV svn
- SVNPath/svn/project/first
- AuthzSVNAccessFile/etc/httpd/conf. d/authz
- // Permission policy file read by the apache server
- AuthType Basic
- AuthName "Project"
- AuthUserFile/etc/httpd/conf. d/passwd
- // Password storage file read by the apache server
- Require valid-user
④ Put the edited file authz in the folder/etc/httpd/conf. d, the file format is the same as the authz File above the article, editing the file passwd put in the folder/etc/httpd/conf. d, use the following command to generate the user name and password:
- Htpasswd-c/svn/project/first admin
- // The command is htpasswd,-c is the parameter,/svn/project/first is the accessed version library, and admin is the user name
Then, repeat the password you want to set to automatically store it in the file passwd. The default value is md5.
⑤ Restart the apache service to access the service by using the username and password you just set on the webpage. The URL is http: // ip address: Port/svn.
This article is from the "Rainbow cat walking across the world" blog!