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

Installation and configuration of SVN under Linux

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "the installation and configuration of SVN under Linux". In the daily operation, I believe that many people have doubts about the installation and configuration of SVN under Linux. The editor 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 configuration of SVN under Linux". Next, please follow the editor to study!

SVN is a free and open source version management system that manages files, directories, and changes to them in chronological order. Today, it is widely used in project version management of Internet companies.

working principle

How it works is shown in the figure below.

It consists of a SVN server and many SVN clients

Data is stored uniformly on the SVN server

The client checks out (checkout) the version file on the specified path from the server to the local, and then commit it to the server. When other clients check out or update again, they can get the changes submitted by the client before.

In this way, multiple clients can work without interfering with each other and realize the cooperation of multiple people.

SVN is already a very mature tool that can quickly implement project version management, which is used by many small and medium-sized teams. Here is the installation and configuration of SVN server.

Installation

Yum install-y subversion

After the installation is complete, execute svn-- version to check whether the installation is successful. If there is output similar to the following, the installation is successful.

[root@cghost21] # svn-- version svn, version 1.7.14 (r1542130) compiled Sep 30 2020, 17:44:04 Copyright (C) 2013 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_neon: Module for accessing a repository via WebDAV protocol using Neon. -handles' http' scheme-handles' https' scheme * ra_svn: Module for accessing a repository using the svn network protocol. -with Cyrus SASL authentication-handles' svn' scheme * ra_local: Module for accessing a repository on local disk. -handles' file' scheme [root@cghost21 ~] #

Default directory

Svnserve installation directory

Svnserve is installed in the / usr/bin directory by default, which can be viewed through the which svnserve command

[root@ecs-centos-7 ~] # which svnserve / usr/bin/svnserve

Warehouse address

The default warehouse address of svnserve is / var/svn, which can be modified through / etc/sysconfig/svnserve configuration file.

[root@ecs-centos-7 ~] # cat / etc/sysconfig/svnserve # OPTIONS is used to pass command-line arguments to svnserve. # # Specify the repository location in-r parameter: OPTIONS= "- r / var/svn"

Svnserve port

After svnserve starts, port 3690 is used by default.

[root@ecs-centos-7 test_a] # netstat-anpt | grep svnserve tcp 0 0 0.0.0.0 anpt 3690 0.0.0.0 LISTEN 28347/svnserve

Configuration

Create a warehouse

After the installation is complete, use the svnadmin create warehouse directory to create a new warehouse

We set up a warehouse called svn in the / home/tt directory, where all the project files are placed. After the creation, we added several subdirectories in the svn directory.

[root@ecs-centos-7 tt] # svnadmin create / home/tt/svn [root@ecs-centos-7 tt] # ls svn/ conf db format hooks locks README.txt

The conf directory holds configuration files

[root@ecs-centos-7 tt] # svnadmin create / home/tt/svn [root@ecs-centos-7 tt] # ls svn/ conf db format hooks locks README.txt

Authz is a user rights control file

Passwd is the account password configuration file

Svnserve.conf is the svnserve service profile

Configure username and password

Edit the passwd configuration file to add the ta username and 123456 password, tb username and 12345 password, and tc username and password

[root@ecs-centos-7 conf] # vim passwd # This file is an example password file for svnserve. # Its format is similar to that of svnserve.conf. As shown in the # example below it contains one section labelled [users]. # The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret ta = 123456 tb = 12345 tc = 123

Configure user permissions

Configure read-write permissions for SVN user ta, read-only permissions for SVN user tb, and read-only permissions for SVN user tc

In the figure above, the root directory access permission of the configuration warehouse is configured. If you want to configure the access permission of the specified directory in the warehouse, you can add a warehouse directory at the end, and then configure the user access right under the directory.

For example, if there is a myproject directory under the root directory of the warehouse, user ta has read and write permissions, user tb does not have access rights, and user tc has read-only permissions, then the permissions of the myproject directory are configured as follows

[/ myproject] ta=rw tc=r * =

Configure the svnserve service

As shown in the image above, open the comments before the options in the red box, and note that there can be no spaces before each option.

Anon-access = none # anonymous users cannot access auth-access = write # authorized user writable password-db = passwd # user password authentication file authz-db = authz # user rights authentication file realm = / home/tt/svn # svn version library directory

Start, stop, restart

Modify the value of OPTIONS in / etc/sysconfig/svnserve to our newly created warehouse address

[root@ecs-centos-7 ~] # vim / etc/sysconfig/svnserve # OPTIONS is used to pass command-line arguments to svnserve. # # Specify the repository location in-r parameter: OPTIONS= "- r / home/tt/svn"

After svn is installed, it has been added to systemctl by default. Start, stop and restart using the following command

[root@ecs-centos-7 ~] # systemctl start svnserve [root@ecs-centos-7 ~] # systemctl stop svnserve [root@ecs-centos-7 ~] # systemctl restart svnserve

In the actual deployment, in order to restart the machine without affecting the use of the client, svnserve is usually set to boot.

[root@ecs-centos-7] # systemctl enable svnserve Created symlink from / etc/systemd/system/multi-user.target.wants/svnserve.service to / usr/lib/systemd/system/svnserve.service.

Client check out

After configuring the user password and access rights, restart svnserve

Create a new test_a directory, enter it, and execute the command svn co svn://192.168.0.9-- username ta-- password 123456 to check out the files and directories in the svn repository.

[root@ecs-centos-7 tt] # mkdir test_a [root@ecs-centos-7 tt] # cd test_a/ [root@ecs-centos-7 test_a] # svn co svn://192.168.0.9-username ta-password 123456 [root@ecs-centos-7 test_a] # svn info path:. Working copy Root: / home/tt/test_a URL: svn://192.168.0.9 version Library: svn://192.168.0.9 version Library UUID: c9730d20-968c-41c0-a224-4c6a967f8330 version: 1 Node Category: directory scheduling: normal Last modified author: ta Last modified version: 1 Last modified time: 2020-12-04 23:48:11 + 0800 (V, 202-12-04)

Applicable scenario

Every tool has its own scenarios, and SVN is no exception.

When you need to record the time of each modification of the file, view the log that changes over time, retrace and rewind to any point in time when the version, multiple people work together to develop and track who made the changes, then it is very suitable to use SVN.

For some large files or files that will not be modified later, and regard SVN as a transfer station for file transfer, these are not suitable to use SVN, for example: upload a movie from a SVN client to the SVN server, and then update the movie file in another SVN client, this is a misuse of SVN this tool, the synchronization of the above files has a special tool (rsync) to deal with.

Summary

This chapter introduces the working principle, installation, configuration and usage scenarios of the SVN server. For more information about SVN, please refer to the official documentation.

For small and medium-sized entrepreneurial teams, SVN, which is easy to install, easy to use and easy to use (especially for non-technical personnel, can be used with a little explanation), is a very good choice in the case of many things, few personnel and tight time.

At this point, the study of "how to install and configure SVN under Linux" 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