Instructions for installing and deploying SVN in Centos and Related Problems
Installing SVN in Centos is simple, and yum can be used quickly.
yum install mod_dav_svn subversion
The following describes how to configure svn. 1. Create the SVN root directory:
[root@vm-moodle ~]# mkdir -p /opt/svn/
2. Create a data warehouse:
[root@vm-moodle ~]# mkdir -p /opt/svn/edu/ [root@vm-moodle ~]# svnadmin create opt/svn/edu/
3. modify the configuration file:
[Root @ vm-moodle ~] # Cd/opt/svn/edu/conf/[root @ vm-moodle conf] # ll total 24-rw-r -- 1 root 710 10-25 authz- rw-r -- 1 root 325 10-25 passwd-rw-r -- 1 root 1449 10-25 svnserve. conf ##************************************* * ************************** # Note, do not leave spaces before the parameters in the following configuration file. Otherwise, the consequences will be borne by you! ##************************************** * *********************** [Root @ vm-moodle conf] # vi svnserve. conf [general] anon-access = none # Do not allow anonymous access auth-access = write # authenticated users can write password-db = passwd # password File authz-db = authz # user authentication File [root @ vm-moodle conf] # vi authz [edu: /] hansy = rw # Add a user named in the edu repository with the write permission. [Root @ vm-moodle conf] # vi passwd hansy = 87827192 # The password can be an encrypted password or plaintext, which is determined based on the previous configuration.
4. Start the service:
# Start the SVN service and specify the SVN root directory: [root @ vm-moodle ~] # Svnserve-d-r/opt/svn/# Check whether the service is normal: [root @ vm-moodle ~] # Netstat-tunlp | grep svn tcp 0 0 0.0.0.0: 3690 0.0.0.0: * EN 3970/svnserve # LISTEN listening port 3690
5. Install TortoiseSVN on Win to download the required Tortoise version. Because the installation is not connected to WEB services such as Apache, the SVN protocol is used during client access. For example, svn: // 192.168.1.10/edu can be accessed normally by entering the user name and password.
Q: after installing the svn service, I cannot connect to the svn server using the svn client in windows? A: Generally, port 3690 of SVN in centos is not enabled. Use the following method:
[Root @ vm-moodle ~] # Iptables-I INPUT-p tcp -- dport 3690-j ACCEPT # Open Port 3690 [root @ vm-moodle ~] #/Etc/rc. d/init. d/iptables save # It is very important to save the configuration. [root @ vm-moodle ~] #/Etc/init. d/iptables status # Check whether the operation is successful:
Q: After the svnserve-based subversion server is configured, this error occurs when the client accesses the subversion Database: svnserve. conf: 12: Option expected. Why is this error? A: When the subversion reads the configuration file svnserve. conf, it cannot identify the configuration file with leading spaces. See the following configuration file.
[general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. anon-access = read auth-access = write
In the preceding configuration file, anon-access is the top line. No problem is found, and auth-access has leading spaces, which may cause this error. To avoid this error, we should also remove the leading space when removing the # Before these rows.
Q: How do I enter the TortoiseSVN user name and password? A: in many cases, when using Tortoise for convenience, we check the password input box to save the verification information. However, when we want to log on with another user, we may find that we do not know how to log on with another user. The authentication information such as Tortoise's username and password is cached in the directory of the Client File System: C:/Documents ents and Settings/Administrator/Application Data/Subversion/auth to delete all the folders under auth, reconnect to the remote server for check-out. The dialog box is displayed!
Q: svn: Can't convert string from 'utf-8' to native encoding solution
The solution is simple, set the locale: export LC_CTYPE = zh_CN.UTF-8 or export LC_CTYPE = en_US.UTF-8 (I set the en_US.UTF-8) of the current system correctly and then re-checkout. If the export LC_CTYPE = zh_CN.UTF-8 prompts warning:> localelocale: Cannot set LC_CTYPE to default locale: No such file ordirectorylocale: Cannot set LC_MESSAGES to default locale: No such file ordirectorylocale: cannot set LC_ALL to default locale: No such file ordirectory and other information can try locale-gen en_US.UTF-8
Q: SVN: show log with no date solution. You want to open your code library to everyone, so you have opened the anonymous access permission in svnserve. add a line to the conf file:anon-access=read
. However, for some directories, you do not want others to see them, so for those special directories, you configure in authz. conf, add authorized access persons, and add* =
Mark. You think everything is okay, but if you do not find it, the special directory cannot be accessed and always promptsNot authorized to open root of edit operation
OrUnauthorized root access for editing
. You repeatedly check the user name and password you configured to confirm that everything is correct and the problem persists.
It turns out that Subversion has a small bug. When ''anon-access = read'' and a directory is marked with ''' * = '', the above problem occurs. This bug still exists in the latest version (v1.4). It may be corrected in the next version.
Solution: In svnserve. conf, set anon-access to none.
Solution 2
Q: deploying web version synchronization with svn
#! /Bin/sh # Be sure to be in the first line. Otherwise, the exit 255 error will occur !!!! Export LANG = zh_CN.UTF-8 SVN =/usr/local/svn/bin/svn WEB =/usr/local/apache2/htdocs/# No need to enter the account PASSWORD by default # USERNAME = user01 # PASSWORD = 123456 # SVN update $ WEB -- username $ USERNAME -- password $ PASSWORD -- no-auth-cache $ SVN update $ WEB
--------
Note: This script will be triggered when svn commit is executed on the client, so that the data of the version library can be synchronized to the apache virtual directory.
Set script executable permissions
# chmod a+x post-commit