After installing the svn server, this article is not integrated with Apache. The process is as follows:
Check the installed version # Check whether earlier versions of SVN are installed [[Email protected]/] # rpm-Qa Subversion |
# If the old version is stored, uninstall the old version SVN [[Email protected] modules] # Yum remove Subversion |
Install SVN [[Email protected] modules] # Yum install Subversion |
Verify Installation Check the installed SVN version information. [[Email protected] modules] # svnserve -- version Svnserve, version 1.6.11 (r934serve) Compiled on Jun 23,: 44: 03 Copyright (c) 2000-2009 collabnet. |
Code Library Creation
After installing the svn software, you need to create a SVN library.
[[Email protected] modules] # mkdir-P/opt/SVN/Repo [[Email protected] modules] # svnadmin create/opt/SVN/Repo |
After executing the preceding command, the repo Test Library is automatically created. Check the/opt/SVN/repo folder and find files including Conf, DB, format, hooks, locks, readme.txt, etc, it indicates that a SVN library has been created.
Configure the code library
Go to the conf folder generated above and configure it. [[Email protected] modules] # cd/opt/SVN/repo/Conf Passwd Configuration [[Email protected] Password] # cd/opt/SVN/repos/Conf |
[[Email protected] conf] # Vim passwd Modify passwd to the following: [Users] # Harry = harryssecret # Sally = sallyssecret Hello = 123 Username = Password |
In this way, the hello user and 123 password are created.
All the preceding statements must be written in the top-level format, and spaces cannot be left on the left side. Otherwise, an error occurs.
Permission control authz Configuration
[[Email protected] conf] # vi + authz
The purpose is to set which directories can be accessed by users and append the following content to the authz file:
# Set [/] to indicate all resources under the root directory
[/] Or [repl:/] Hello = RW |
This means that the hello user has read and write permissions on all directories in the repo test database. Of course, it can also be limited.
If you use it on your own, read and write it directly.
All the preceding statements must be written in the top-level format, and spaces cannot be left on the left side. Otherwise, an error occurs.
Service svnserve. conf configuration
[[Email protected] conf] # Vim svnserve. conf
Append the following content: [General] # Anonymous access permission, which can be read, write, or none. The default value is read. Anon-access = none # Grant write permission to authorized users Auth-access = write # Password Database path Password-DB = passwd # Access control file Authz-DB = authz # Authentication namespace. The Subversion is displayed in the authentication prompt and serves as the key word cached by the credential Realm =/opt/SVN/Repositories |
All the preceding statements must be written in the top-level format, and spaces cannot be left on the left side. Otherwise, an error occurs. Configure the firewall port [[Email protected] conf] # vi/etc/sysconfig/iptables |
Add the following content: -A input-M state -- state new-m tcp-p tcp -- dport 3690-J accept Save and restart the Firewall [[Email protected] conf] # service iptables restart |
Start SVN Svnserve-d-r/opt/SVN/Repo |
View SVN Process [[Email protected] conf] # ps-Ef | grep SVN | grep-V grep Root 12538 1 0? 00:00:00 svnserve-d-r/opt/SVN/Repo Check SVN Port [[Email protected] conf] # netstat-ln | grep 3690 TCP 0 0 0.0.0.0: 3690 0.0.0.0: * listen Stop restarting SVN [[Email protected] Password] # killall svnserve // stop [[Email protected] Password] # svnserve-d-r/opt/SVN/repo // start If SVN is already running, you can run it on another port. Svnserve-d-r/opt/SVN/-- listen-port 3391 |
Test
The SVN service has been started. Use the client to test the connection.
Client Connection address: SVN: // 192.168.15.231
Username/password: Hello/123
Test the operations such as creating folders.
Create a version Library:
Terminal input: svnadmin create [path]
This path can be a relative path. For example, enter svnadmin create myproject in the home/user/SVN/directory, the version library will be created in the home/user/SVN/directory, and a new folder named myproject will be created, which is the version library file.
Import files to the version Library:
Terminal input: SVN import [Source Path] [target version library path]-M [log information]
The source path can be a relative path. During the import, all files and folders under the source path will be recursively imported. The path of the target version library must be an absolute directory (I tried it anyway ), for example, the version library directory is home/user/SVN/myproject /. Write File: // home/user/SVN/myproject/
For example, import the current directory to the version library myproject:
SVN import. File: // home/user/SVN/myproject-M "Import file"