Article Title: SVN installation configuration record in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. Use the source file for compilation and installation. There are two source files:
Subversion-1.6.1.tar.gz (subversion source file)
Subversion-deps-1.6.1.tar.gz (subversion dependency files)
Note that the file versions must be consistent; otherwise, various strange problems may occur.
2. Upload the above two files to the server and decompress them. Decompress the command:
Tar xfvz subversion-1.6.1.tar.gz
Tar xfvz subversion-deps-1.6.1.tar.gz
Command Introduction: tar is the extract command, and xfvzis the marker of the tar command, used to extract files compressed in the tar.gz format.
3. decompress the package and generate the subversion-1.6.1 subdirectory. After the two packages are decompressed, they will be automatically placed in this directory without manual modification.
4. Go to the unzip subdirectory:
Cd subversion-1.6.1
5. run. /configure -- prefix =/opt/subversion to configure and specify the installation directory. note that there are two minus signs before the prefix. the BDB package is not included by default, so the FSFS mode is used by default. to use the BDB mode, download the BDB package. we recommend that you use the FSFS mode. for more information about the two modes, see the following link:
Http://doc.iusesvn.com/show-21-1.html
Command Description: The configure command is used to check the Installation Platform and target features. The prefix is used to specify the path.
6. Execute make compilation.
7. Execute make install to install.
8. Add environment variables:
Vi/etc/profile
Add at the end of the file:
SVNPATH = $ PATH:/opt/subversion/bin
Export SVNPATH
9. Test whether SVN is successfully installed. Run the following command:
Svnserve -- version
If the version information is displayed, the installation is successful.
Chapter 2 Configuration
The system uses the policy of creating a version library for each project. Configuration files, password files, and access control files are all stored in the conf directory of the version library. Therefore, each time you start a new project, you must create a new version library and reconfigure the configuration files. It is also important to ask the team members to reconfigure the client, including the server version library path, local path, and other information.
1. Create a version library directory (multiple versions can be created. You must reconfigure the following items after creating the library. Note the differences between the installation directory and the version library directory. The following describes the version library directory)
Mkdir? P/opt/svndata/repos
2. Create the svn version Library (corresponding to the above directory)
Svnadmin create/opt/svndata/repos
After executing this command, svn automatically adds the required configuration file under the repos directory.
Note: unlike normal folders, creating a file directly on the operating system cannot be recognized by SVN. You must use commands such as import to import the file to the version library.
This is an internal svn command. create is used to create a version library. Use svn help to view detailed instructions.
3. Modify the version library configuration file
Vi/opt/svndata/repos/conf/svnserve. conf
The parameter functions are described in the remarks in the configuration file. The configuration is as follows:
[General]
Anon-access = none # Make unauthorized users inaccessible
Auth-access = write # grant the authorized user the write permission
Password-db =/opt/svndata/repos/conf/pwd. conf # specify the password file path
Authz-db =/opt/svndata/repos/conf/authz. conf # access control file
Realm =/opt/svndata/repos # to authenticate the namespace. The subversion is displayed in the authentication prompt and serves as the key word cached by the credential.
Other default configurations are used. Each statement must be written in the top level, and no space is left. Otherwise, an error occurs.
Pwd. conf and authz. conf are not automatically created when you create a version library. You must create them by yourself.
Command Description: This is the format of the svn configuration file. Please follow the above format.
4. Configure the user
Vi/opt/svndata/repos/conf/pwd. conf
Enter the following content:
[Users]
Username1 = password1
Username2 = password2
You can add multiple user name and password pairs.
5. Configure permissions
Vi/opt/svndata/repos/conf/authz. conf
Command Introduction: This configuration file adopts the "Path-based authorization" policy, which specifies the path in brackets. The following lists the permissions for each user. Including read-only r and read/write rw. Users not listed are not allowed to access. You can also group users. For details, refer to the svn Manual. The following is a simple example:
[/Opt/svndata/repos]
User1 = rw
User2 = r
6. import files using import
The new version library is empty and you need to import the working directory.
$ Svnadmin create/usr/local/svn/newrepos
$ Svnimport mytree file: // usr/local/svn/newrepos/some/project
However, after the import, the directory tree used is not converted to a working copy. To get started, run svn checkout to export a working copy. After the import, files are stored in the db folder in a special form in the version library and cannot be viewed in plaintext. You must use svn checkout to export a working copy to view it normally.
7. Start the service
Run svnserve? D? R/opt/svndata/repos/start the service and run it in deamon mode.
The system adopts the svnserve method, which is recommended for small team projects. This method has the least maintenance and the simplest configuration.
Command Description: This command is used to start the svn service.-d indicates that the command runs in daemon mode and svn automatically listens on port 3690. 3690 is the default port. You can use "-- listen-port =" or "-- listen-host =" to specify other ports. The-r option is used to specify the root directory of the svn service, so that you can use the relative path for access without providing the complete path.
Run the following command to check out: (svnserver Mode)
Svn checkout svn: // 127.0.0.1/dir
The above is an example. The IP address needs to be adjusted according to the actual situation. dir is the version library path. If it is specified at startup, it can be omitted.
The version library information is in the version library folder. to delete a version library, you only need to delete the folder where the version library is located.
In addition, work copies are only self-maintained folders, which can be deleted directly in Windows without affecting others. Do not use the DELETE command of the version library. Otherwise, the content in the version library will be deleted.
8. Automatic Service Startup Script
01 # file name svnserve, saved to/etc/init. d, root permission 700
02 #! /Bin/sh
03 # description: Svnserve auto start-stop script.
04 # chkconfig:-20 80
05 #
06./etc/init. d/functions
07
08 SVN_HOME =/usr/local/subversion/bin
09 SVN_OWNER = svn
10 if [! -F "$ SVN_HOME/svnserve"]
11 then
12 echo "svnserver startup: cannot start"
13 exit
14 fi
15
16 start (){
17 $ SVN_HOME/svnserve-d-r/root/svndata/dzpai
18 echo "svnserve is runing ..."
19}
20
21 stop (){
22 killproc svnserve
23 echo "svnserve is stoped"
24}
25
26 restart (){
27 killproc svnserve
28 echo "svnserve is stoped"
29 $ SVN_HOME/svnserve-d-r/root/svndata/dzpai
30 echo "svnserve is runing ..."
31}
32
33
34 # See how we were called.
35 case "$1" in
36 start)
37 start
38 ;;
39 stop)
40 stop
41 ;;
42 restart)
43 restart
44 ;;
45 esac
This script works properly.
Chkconfig -- add svnserve
You can set ntsysv in the startup Item.