Use yum in CentOS to install and configure and use svn

Source: Internet
Author: User

Installation instructions

System Environment: CentOS-6.3
Installation Method: yum install (source code installation may cause version compatibility issues)
Install software: the system automatically downloads SVN Software

Check the installed version

# Check whether earlier versions of SVN [root @ zck/] are installed # rpm-qa subversion # uninstall old versions of SVN [root @ zck modules] # yum remove subversion install SVN [root @ zck modules] # yum install httpd-devel subversion mod_dav_svn mod_auth_mysql check that the svn module has been installed [root @ zck/] # cd/etc/httpd/modules [root @ zck modules] # ls | grep svnmod_authz_svn.somod_dav_svn.so


Verify Installation

Check the installed SVN version information.

[Root @ zck modules] # svnserve-version

Svnserve, version 1.6.11 (r934serve)

Compiled on Jun 23,: 44: 03

Copyright (C) 2000-2009 CollabNet.

Subversion is open source software. See
Http://subversion.tigris.org/site.

This product contains (
Http://www.Collab.Net/) developed software.

The backend (FS) module of the library is available in the following versions:

* Fs_base: the module can only operate BDB version libraries.

* Fs_fs: This module works with the text file (FSFS) version library.

Cyrus SASL authentication is available.

Code Library Creation

After installing the SVN software, you need to create a SVN library.

[root@zck modules]# mkdir -p /opt/svn/repositories[root@zck modules]# svnadmin create /opt/svn/repositories

After executing the preceding command, the repositories library is automatically created. Check the/opt/svn/repositories 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.

[Root @ zck modules] # cd/opt/svn/repositories/conf

Passwd Configuration

[root@zck password]# cd /opt/svn/repositories/conf[root@admin conf]# vi + passwd

Modify passwd to the following:

[users]# harry = harryssecret# sally = sallyssecretzhoulf=123456

Permission control authz Configuration

[Root
@ Admin 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

[/]

Zhoulf = rw

Service svnserve. conf configuration

[Root
@ Admin conf] # vi + svnserve. conf

Append the following content:

[General] # anonymous access permission, which can be read, write, none, the default value is readanon-access = none # authorize the authorized user to have the write permission 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 credential cache keyword realm =/opt/svn/repositories

Configure the firewall port

[Root @ zck conf] # Add the following content to vi/etc/sysconfig/iptables: -a input-m state -- state NEW-m tcp-p tcp -- dport 3690-j ACCEPT save and restart firewall [root @ zck conf] # service iptables restart

Start SVN

svnserve -d -r /opt/svn/repositories

View SVN Process

[root@zck conf]# ps -ef|grep svn|grep -v greproot 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /opt/svn/repositories

Check SVN Port

[root@zck conf]# netstat -ln |grep 3690tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN

Stop restarting SVN

[Root @ zck password] # killall svnserve // stop [root @ zck password] # svnserve-d-r/opt/svn/repositories // start

Test

The SVN service has been started. Use the client to test the connection.

Client Connection address: svn: // 192.168.15.231

Username/password: zhoulf/123456

Test the operations such as creating folders.

Appendix:

Install, configure, and use svn in CentOS

1. install required software packages

$ Yum install subversion

$ Yum install mod_dav_svn

Ii. Basic SVN Server Configuration

1. Create a directory to store all SVN files.

# Mkdir/home/svn

2. Create a version Repository

# Svnadmin create/home/svn/test

3. initialize the directory in the version repository and import the original code.

If the original code already has svn-related files, switch to the original code directory and delete these svn-related files and folders first. Assume that/home/user/code/src stores the source code

# Cd/home/user/code/src

# Find./-name "*. svn" | xargs rm-rf

# Svn import/home/user/code/src file: // home/svn/test/-m "init test code"

4. Add a user

Add an entry in the format of "username = password" to the/home/svn/test/conf/passwd file.

[Users]

Admin = adminpass

User1 = 123456

5. Modify the User Access Policy

/Home/svn/test/conf/authz record the user's access policy:

[Groups]

[Test:/]

Admin = rw

User1 = r

* =

[Test:/modue]

Admin = rw

User1 = rw

* =

The above indicates that admin has all the read and write permissions. user1 can be read and written in the modue folder and read-only in the root directory. You can also configure group permissions.

6. Modify the/home/svn/test/conf/svnserve. conf file to make the user and policy configuration take effect.

The content of svnserve. conf is as follows:

[General]

Anon-access = none

Auth-access = write

Password-db = passwd

Authz-db = authz

7. Start the server

# Svnserve-d-r/home/svn

8. Test Server

# Svn co svn: // 192.168.1.5/test

Enter the user password as prompted, and then the svn user name and password.

# Cd test

# Vim main. c

# Svn add main. c

# Svn commit main. c-m "comment"

Adding main. c

Transmitting file data.

Committed revision 2. (The test is submitted successfully)

3. Configure http support for the svn server (you can view the code in a browser)

1. Modify httpd. conf and add content about the SVN server.

Modify/etc/httpd/conf/httpd. conf.

2. Restart the HTTPD server.

# Service httpd restart

3. Use a browser to access http: // 192.168.1.5/test


4. Possible Problems

1. If the Internet cannot be accessed normally, port ing may also be required to open port 3690 to the Internet.

Run the telnet xxx. xxx 3690 command to check whether the port is enabled.

2. If the following error occurs during checkout in windows:

The reason is that there are files with the same name but different cases in linux. One solution is to avoid this situation and change it to a different name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.