Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Tutorial on installation and use of SVN Server on CentOS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "installation and use of SVN server on CentOS". In daily operation, I believe many people have doubts about the installation and use of SVN server on CentOS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "installation and use of SVN server on CentOS". Next, please follow the editor to study!

1. Environment

Centos6.4

two。 Install svn

The code is as follows:

Yum-y install subversion

3. Configuration

Create a version library directory

The code is as follows:

Mkdir / www/svndata

Svnserve-d-r / www/svndata

4. Set up a version library

Create a new Subversion project

The code is as follows:

Svnadmin create / var/www/svndata/njlrxx

Configure to allow user jiqing access

The code is as follows:

Cd / var/www/svndata/njlrxx/conf

Vi svnserve.conf

Anon-access=none

Auth-access=write

Password-db=passwd

Note: the modified file cannot be preceded by a space, otherwise there will be an error in starting svn server.

The code is as follows:

Vi passwd

[users]

# =

# =

Jiqing=123456

5. Client connection

The code is as follows:

Svn co svn://ip/njlrxx

User name: jiqing

Password: 123456

6. Synchronize SVN with WEB, either by CO or directly in the warehouse

(1) set the WEB server root directory to / var/www/webroot

(2) one SVN for checkout

The code is as follows:

Svn co svn://localhost/njlrxx / var/www/webroot/njlrxx

Change the permission to WEB user

The code is as follows:

Chown-R apache:apache / var/www/webroot/njlrxx

(3) create a synchronization script

The code is as follows:

Cd / var/www/svndata/njlrxx/hooks/

Cp post-commit.tmpl post-commit

Edit the post-commit and add the following at the end of the file

The code is as follows:

REPOS= "$1"

REV= "$2"

BASEPATH=/var/www/webroot/njlrxx

WEBPATH= "$BASEPATH/"

Export LANG=zh_CN.UTF-8

Svn update $WEBPATH-username jiqing-password 123456-no-auth-cache

Increase script execution permissions

The code is as follows:

Chmod + x post-commit

The final action is to turn off the service and then turn it on:

Shutdown of the svn service:

The code is as follows:

Killall svnserve

Svn is enabled:

The code is as follows:

Svnserve-d-r / var/www/svndata

7. How to support anonymous user access

Method 1:

Find the conf/httpd.conf file in the svn installation directory, or the apache configuration file if you manually integrated apache.

Find the one in

The code is as follows:

Require valid-user

Change to

The code is as follows:

Require valid-user

Restart the service so that all the content under the svn no longer needs to be authenticated by the user and can be accessed directly.

Cons: svn's own access settings are invalid. More often, we want users to try to access it anonymously first, and if not, enter a user name and password to verify the access.

Method 2:

Add to the configuration file

The code is as follows:

Satisfy Any

The setting of Satisfy Any is added, which means that if both Allow (allowed) and Require are enabled, there are two optional values for specifying the relevant policy. All means that the user must meet the conditions of both Allow and Require, and Any is one of them.

Satisfy Any means that access is allowed to be attempted anonymously first, and access is granted according to svnauthz's control over anonymous users.

PS:SVN automatic synchronization program execution process:

1. The user submits the file to the SVN server, and triggers the post-commit script when the submission operation is successful

2. Use php_script.php to execute the PHP script in the post-commit version file

3. Update the working copy of the version library on the server through exec system call in the PHP script

4. According to the update operation result log, another SVN version library is processed accordingly.

At this point, the study on "installation and use of SVN server on CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report