How to build svn server in linux

How to build svn server in linux

1: Install SVN

yum install -y subversion

2. Create a warehouse

1: Create a warehouse directory

mkdir -p /var/project/test

2: Create a warehouse

svnadmin create /var/project/test

After successful creation, the following directories are created under the /var/project/test directory:

drwxr-xr-x. 2 root root 51 January 30 13:26 conf
drwxr-sr-x. 6 root root 4096 January 30 13:26 db
-r--r--r--. 1 root root 2 January 30 13:26 format
drwxr-xr-x. 2 root root 4096 January 30 13:26 hooks
drwxr-xr-x. 2 root root 39 January 30 13:26 locks
-rw-r--r--. 1 root root 229 January 30 13:26 README.txt

The conf directory is the svn configuration directory, which includes:

-rw-r--r--. 1 root root 1080 January 30 13:26 authz #Permission control -rw-r--r--. 1 root root 309 January 30 13:26 passwd #Password management -rw-r--r--. 1 root root 3090 January 30 13:26 svnserve.conf #SVN service process configuration

Three: SVN configuration

1: Permission configuration (/var/project/test/conf/authz)

#User grouping (admin->administrator, development->developerother->other)
[groups]
admin = test1 #Administrator user test1
development = test2,test3 #Development users test2, test3
other = test4,test5,test6 #other users test4,,test5,test6
#Permission configuration[/]
@admin = rw #Administrator read and write permissions @development = rw #Development read and write permissions @other = r #Other read permissions test7 = rw #test7 user read and write permissions

2: Password configuration (/var/project/test/conf/passwd)

#Password configuration, the format is username=password, the password is plain text [users]
test1 = test1
test2 = test2
test3 = test3
test4 = test4
test5 = test5
test6 = test6
test7 = test7

3: SVN service process configuration (/var/project/test/conf/svnserve.conf)

[general]
anon-access = none #Anonymous users have no access auth-access = write #Authenticated users can read and write password-db = passwd #Specify user authentication password file authz-db = authz #Specify permission configuration file

4: Start the SVN service (default port number 3690)

Copy the code as follows:
svnserve -d -r /var/project #-d service background running -r specifies the working directory, /var/project indicates the specified working directory, note that the warehouse name address (/var/project/test) cannot be specified

Start SVN by specifying the port

svnserve -d -r /var/project --listen-port 3691

5. Close the firewall or open the specified port number

1: Turn off the firewall

systemctl stop firewalld

2: Open the specified firewall

#Open port 3690 firewall-cmd --zone=public --add-port=3690/tcp --permanent
#Refresh configuration firewall-cmd --reload

6: Client connects and uploads files

Connecting SVN on Windows

1: Create a new directory, right-click and select svn checkout


2: Fill in the Linux SVN address svn://ip:3690/warehouse name on the version library (the warehouse name here is not /var/project/test but /test)


2: Fill in the username and password


At this time, we can see that a .svn file is generated in this directory, indicating that we have connected to the svn server on Linux.

3: Upload files

Now let's create a new test.txt file and fill in some information

(1) Right-click and select add


Then select the test.txt file and click OK. At this time, we will see a plus sign on the test.txt file.


(2): Upload

Right click and select Submit


Fill in the remarks, select the file to upload and click OK


At this time, we can see that the plus sign on the test.txt file will turn into a green check mark, indicating that the upload is successful.


But at this time we found that we did not find the files we uploaded in the /var/project/test directory. Why is this? Didn't we upload successfully?
This is because after uploading the file to the SVN repository, the uploaded file is no longer stored in the original format of the file, but is compressed into repository data in a custom format by SVN and stored in the repository. The SVN server repository has two formats, one is FSFS and the other is BDB.
At this time we need to implement the checkout in Linux

4: Check out

svn checkout svn://192.168.11.201/test /data/test #svn://192.168.11.201/test indicates the warehouse address to be checked out /data/test indicates the directory to which the data needs to be checked out


This is because we can see the files we uploaded on the client before in the /data/test directory, but now the problem comes again. After we upload the files on the client, it is impossible to check them out on the server every time, so how can we check them out automatically?

5: Automatically check out configuration

Create a post-commit file in the /var/project/test/hooks directory and add the following content to the post-commit file:

#!/bin/sh
REPOS="$1" #Warehouse REV="$2" #Version number export.UTF-8 #Encoding SVN=/usr/bin/svn #svn address WEB=/data/test #Project directory to be updated $SVN update $WEB --username test1 --password test1 #--username test1 means setting the username --password test1 means setting the password

Set post-commit to be executable

chmod +x /var/project/test/hooks/post-commit

The automatic checkout configuration is now complete, but please note that you need to manually check out the first time, and you don't need to do it later. This completes the svn server setup on Linux

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • A complete list of common commands for SVN version control under Linux
  • Detailed explanation of SVN command line batch operations on Linux
  • Linux SVN server setup, client operation, backup and recovery
  • How to build and use Linux svn (with pictures and text)
  • How to build SVN server under Linux (centos)
  • How to automatically update files to the Web directory from the SVN server under Linux
  • The Linux SVN server supports both Apache http and svnserve standalone server modes and uses the same access permission account
  • Detailed explanation of the process of configuring multiple SVN repositories on Linux servers

<<:  Reasons and solutions for multiple executions of the watch method when Vue monitors route changes

>>:  How to install multiple mysql5.7.19 (tar.gz) files under Linux

Recommend

Facebook's nearly perfect redesign of all Internet services

<br />Original source: http://www.a-xuan.cn/...

Various correct postures for using environment variables in Webpack

Table of contents Write in front Business code us...

Detailed explanation of the simple use of MySQL query cache

Table of contents 1. Implementation process of qu...

How to display web pages properly in various resolutions and browsers

The key codes are as follows: Copy code The code i...

Detailed explanation of mkdir command in Linux learning

Table of contents Preface 1. Basic knowledge of f...

Detailed explanation of JavaScript object conversion to primitive value

Table of contents Object.prototype.valueOf() Obje...

js to realize the mouse following game

This article shares the specific code of js to im...

Multiple ways to insert SVG into HTML pages

SVG (Scalable Vector Graphics) is an image format...

Vue custom encapsulated button component

The custom encapsulation code of the vue button c...

Implementation of MySQL scheduled backup script under Windows

On a Windows server, if you want to back up datab...

Detailed installation and configuration tutorial of mysql5.7 on CentOS

Install Make sure your user has permission to ins...

Example of using nested html pages (frameset usage)

Copy code The code is as follows: <!DOCTYPE ht...

CSS3 mouse hover transition zoom effect

The following is a picture mouse hover zoom effec...

Summary of common MySQL commands

Set change mysqlroot password Enter the MySQL dat...