Install and configure Apache-based SVN server in CentOS
Install and configure the Apache-based SVN server on the Linux Server:
1. Install the service
2. Create an svn version Library
3. Create svn users
4. Configure svn Permissions
5. Configure http access
#
#1. Install the following package to install the service:
#subversion
#httpd
#mod_dav_svn
#
[root@svn-server~]
#yuminstallsubversionhttpdmod_dav_svn-y
#
#2. Create an svn Repository
#
# Create a directory for storing the svn version Library/svn
#
[root@svn-server~]
#mkdir/svn
#
# Use the svnadmin command in the/svn directory to create the svn repository repot, and view the created svn repository.
#
[root@svn-server~]
#svnadmincreate/svn/repot
[root@svn-server~]
#ll/svn/repot
total24
drwxr-xr-x.2rootroot4096Dec1322:52conf
drwxr-sr-x.6rootroot4096Dec1322:52db
-r--r--r--.1rootroot2Dec1322:52
format
drwxr-xr-x.2rootroot4096Dec1322:52hooks
drwxr-xr-x.2rootroot4096Dec1322:52locks
-rw-r--r--.1rootroot229Dec1322:52README.txt
#
#3. Create svn users
#
# Use the htpasswd command to create a user configuration file
#-C when creating a user for the first time, create a user configuration file synchronously (only for the first time)
#-B configure the password explicitly in the htpasswd command
#-M use MD5 to encrypt the password
#/Svn/repot/conf/passwd user configuration file location, file name and storage directory are not required
# Admin user name
# 123456admin password. Because the-B option is used before, you must add the password to the end.
#
[root@svn-server~]
#htpasswd-c-b-m/svn/repot/conf/passwdadmin123456
Addingpassword
for
useradmin
#
# You do not need the-c option when creating the second user.
# If the encryption option is not specified, the-d option is used by default in Linux, and crypt Encryption
# If you do not use the-B option, you will be prompted to enter a password that is not displayed twice. The two passwords must be consistent.
#
[root@svn-server~]
#htpasswd/svn/repot/conf/passwdrouser
Newpassword:
Re-
type
newpassword:
Addingpassword
for
userrouser
#
# View the user configuration file: the admin password uses MD5 encryption, and the rouser password uses crypt Encryption
#
[root@svn-server~]
#cat/svn/repot/conf/passwd
admin:$apr1$R6KbqLSX$UwXTcVK6iCRfxlfyIbO4z/
rouser:UBx6tRs3XYOwI
#
#4. Configure svn Permissions
#
# We use the default svn permission configuration file for configuration. The file name and storage directory are not required.
#
[root@svn-server~]
#cat/svn/repot/conf/authz
[
groups
]
# Define user groups to facilitate unified management
all=admin,rouser
# Define a group called "all", including "admin" and "rouser"
[/]
# Define the root directory permission of the svn version Library (subdirectory inherits the root directory permission)
*=r
# All users have read permission
@all=r
# All users in the user group "all" have read permission
admin=rw
# Admin users have read and write permissions
rouser=r
# Rouser has read permission
#
#5. Configure http access
#
# Edit the Apache configuration file/etc/httpd/conf. d/subversion. conf
#
[root@svn-server~]
#cat/etc/httpd/conf.d/subversion.conf
LoadModuledav_svn_modulemodules
/mod_dav_svn
.so
# Load the dav_svn Module
LoadModuleauthz_svn_modulemodules
/mod_authz_svn
.so
# Load the authz_svn Module
<Location
/repot
>
# Configure access for the repot version Library
DAVsvn
#
SVNPath
/svn/repot
# Repot version LIBRARY PATH
AuthzSVNAccessFile
/svn/repot/conf/authz
# Access permission configuration file
AuthTypeBasic
# Http verification method: Basic
AuthName
"AuthorizationrepotSVN"
# Verification prompt
AuthUserFile
/svn/repot/conf/passwd
# User configuration file
Requirevalid-user
# Restrict users to access only the correct user name and password
SatisfyAny
# Access is allowed if the ip address is not disabled or the account password verification is completed
<
/Location
>
#
# Set the Directory and file owner and group in the svn version library to apache. users who can access the repository through http can read and write files in the svn version library.
#
[root@svn-server~]
#chown-Rapache.apache/svn/
[root@svn-server~]
#ll/svn/
total4
drwxr-xr-x.6apacheapache4096Dec1322:52repot
#
# Restart the http service
#
[root@svn-server~]
#/etc/init.d/httpdrestart
Stoppinghttpd:[OK]
Startinghttpd:[OK]
#
# Set svn Service Startup
#
[root@svn-server~]
#chkconfighttpdon
[root@svn-server~]
#chkconfig--list|grephttpd
httpd0:off1:off2:on3:on4:on5:on6:off
#
# Pay Attention to configuring the firewall and SELinux. For convenience of verification, You can temporarily disable the firewall and SELinux
#
# Access http: // svn-server_ip/repot in a browser or svn client to verify svn is accessible
#
# Admin users have read and write permissions. rouser has only read permissions.
#
#########################################################################################################
#
# Modify the user configuration file and svn permissions to take effect immediately without restarting the service
#
# Deleting a user
#
[root@svn-server~]
#htpasswd-D/svn/repot/conf/passwdrouser
Deletingpassword
for
userrouser
[root@svn-server~]
#cat/svn/repot/conf/passwd
admin:$apr1$R6KbqLSX$UwXTcVK6iCRfxlfyIbO4z/
#
# Reset the password. First Use crypt encryption, and then use MD5 encryption.
#
[root@svn-server~]
#htpasswd-b/svn/repot/conf/passwdadmin654321
Updatingpassword
for
useradmin
[root@svn-server~]
#cat/svn/repot/conf/passwd
admin:dnCSoZ6Ja0drU
[root@svn-server~]
#htpasswd-b-m/svn/repot/conf/passwdadmin111111
Updatingpassword
for
useradmin
[root@svn-server~]
#cat/svn/repot/conf/passwd
admin:$apr1$xGna7avC$F6Tkpd8iHs2ESCsu2Psl0.