Configure the SVN server on the 64-bit CentOS6.3 host and set to allow only HTTPS connections. Multiple repos sources can be configured. Each source has its own group and members for permission control.
Install related software
Install Apache
Yum install httpd-devel
Yum install mod_dav_svn subversion
Yum install mod_ssl openssl
Create a version Library
# Mkdir/var/svn
# Cd/var/svn
# Svnadmin create myapp
# Chown-R apache. apache myapp
# Chcon-R-t httpd_sys_content_t myapp // selinux related
Similarly, I added another version library myapp2.
Modify the configuration file/etc/httpd/conf. d/subversion. conf and add the following content:
<Location/repos>
DAV svn
SVNParentPath/var/svn
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile/var/svn/passwd // User File
AuthzSVNAccessFile/var/svn/authz // user permission Control File
Require valid-user
</Location>
Note the related permissions for adding the/var/svn/passwd file. Otherwise, an error may occur. If the log file is/var/log/httpd/error_log, check the error log.
The passwd content of the user file can only be added using the htpasswd command
For example, add a user leon
# Htpasswd-c/var/svn/passwd leon //-c indicates that a new file is created and does not need to be added later.
Similarly, I added other users hailong, gao, and wang.
User permission control file authz
[Groups]
Myapp = leon, hailong // The myapp project has two members: leon and hailong
Myapp2 = wang, gao
[Myapp:/]
@ Myapp = rw // The myapp group has the read and write permissions of the myapp project. Others do not have the permission.
[Myapp2:/]
@ Myapp2 = rw
In this way, permission control is implemented.
Possible problems
1. Permission issues
View error logs and add related permissions. Pay attention to SeLinux caused by permission issues, you can temporarily disable SeLinux, method: setenforce 0, SeLinux management methods refer to CSDN website http://blog.csdn.net/haiong0707/article/details/8137633
2. Firewall Problems
Disable firewall or open related ports
Through the above configuration, SVN server access through HTTP is basically no problem, and then configure HTTPS access
# Cd/etc/pki/tls/private
# Open SSL genrsa-out my. key 1024
# Openssl req-new-key my. key-out my. csr
# Cd/etc/pki/tls/certs
# Openssl x509-req-days 365-in/etc/pki/tls/private/my. csr-signkey/etc/pki/tls/private/my. key-out my. crt
The above steps must generate the required files in the relevant folder, ensure that the input command is correct, and ensure that the folder where the generated files are located is correct; otherwise, an error may occur later.
Modify the/etc/httpd/conf. d/ssl. conf file
SSLCertificateFile/etc/pki/tls/certs/my. crt
SSLCertificateKeyFile/etc/pki/tls/private/my. key
Modify the/etc/httpd/conf/httpd. conf file
<Directory/>
Options FollowSymLinks
AllowOverride None
SSLRequireSSL // Add this row
</Directory>
Restart httpd
# Service httpd restart
In this way, SVN can only be accessed through HTTPS, and multiple projects can be assigned personnel and permissions.
Possible problems
1. after HTTPS encryption is enabled for SVN, all WEB access is changed to HTTPS. For example, localhost cannot be accessed and you need to access https: // localhost. the configuration in the conf file is differentiated and will not be processed for the time being. Therefore, we recommend that this server be no longer used as a WEB server.
Bytes ----------------------------------------------------------------------------------------------------------------
Solution for localhost requiring https
Do not add SSLRequireSSL to httpd. conf and add it to subversion. conf.
<Location/repos>
DAV svn
SVNParentPath/var/svn
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile/var/svn/passwd // User File
AuthzSVNAccessFile/var/svn/authz // user permission Control File
Require valid-user
SSLRequireSSL // requires https encrypted access
</Location>
In this way, only the/repos directory requires https encrypted access without affecting httpd as a web server.
Reprinted from: http://blog.csdn.net/haiong0707/article/details/8259235
In Linux, svn is often restored to a certain version due to the need of the pitfalls, the function should be switched back to a previous version. There are two ways to achieve this: Method 1: Use svn merge1) First svn up to ensure that the latest version is updated, such as 20; 2) then use svn log to view historical changes, find the version to be restored, such as 10. For more details, use svndiff-r [file or directory]; 3) Roll Back to version 10: svnmerge-r [file or directory]. note the order between version numbers. This is called reverse merge. 4) view the files in the current working version, such as test. differences Between Files in cpp and version 10: svn diff-r 10 test. cpp. If there is a difference, manually change it. 5) if there is no difference, submit: svn ci-m "back to r 10, xxxxx" [file or directory]. A new version is generated in the svn library, for example, 21. Method 2: Use svn up the first two steps, such as method 1, and then directly svn up-r 10. The current working version is version 10. However, note that a new version will not be generated in the svn repository. After the local svn is up, the new version will be returned.