Linux Svn automatic update

Linux Svn automatic update

1. Installation

yum install subersion

2. Configuration

2.1 create warehouse

We can store all the warehouses in / www/server/svn/tests. Later, we can put all the warehouses in / www/server/svn

[root ~]# cd /www/server/svn
[root svn]# svnadmin create /www/server/svn/tests
[root svn]# ls
chats  tests
[root svn]# cd tests/
[root tests]# ls
conf  db  format  hooks  locks  README.txt
catalogueexplain
confConfiguration file of SVN version (access account and permission of version Library)
hooksPlace hook script
locksThe client used to track access to the file library
formatA text file that contains only an integer, indicating the version number of the current file library configuration
dbStore all version control data files
[root tests]# ls
conf  db  format  hooks  locks  README.txt
[root tests]# cd conf/
[root conf]# ls
authz  hooks-env.tmpl  passwd  svnserve.conf
catalogueexplain
authzPermission control file
passwdAccount password file
svnserve.confSVN service profile

2.2 set SVN account password

[root conf]# vi passwd

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-cib1ypu8-16375391178) (C: \ users \ Chenchen \ appdata \ roaming \ typora \ user images \ image-20211122165124121. PNG)]

The above columns are the users who create a user with a password of 123456

2.3 set the read-write permission of the account

[root conf]# vi authz

Add the following code at the bottom of the file, where user is the account added before, r is the read permission, and w is the write permission

[/]
user=rw

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (IMG kaobbcpq-16375391179) (C: \ users \ Chenchen \ appdata \ roaming \ typora user images \ image-20211120171223661. PNG)]

2.4 modify SVN service configuration

[root conf]# vi svnserve.conf
Modify the data
anon-access = read #Anonymous users are readable. You can also set anon access = none to disallow anonymous users from accessing. If it is set to none, the log date can be displayed normally
auth-access = write #Authorized user writable
password-db = passwd #Which file is used as the account file
authz-db = authz #Which file is used as the permission file
realm = /www/server/svn/tests #Authentication space name, directory of version Library

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-o81egab5-16375391180) (C: \ users \ Chenchen \ appdata \ roaming \ typora \ typera user images \ image-20211120171906170. PNG)]

3. Start and stop

Start

[root conf]# svnserve -d -r /www/server/svn/

Stop all svn processes

[root conf]# killall svnserve

In the following commands, - d is the daemon and - r is executed in the background. 795917 and 796023 are the process numbers

[root conf]# ps -ef | grep svnserve
root      795917       1  0 17:37 ?        00:00:00 svnserve -d -r /www/server/svn/
root      796023  762074  0 17:37 pts/0    00:00:00 grep --color=auto svnserve

You can also stop the svn process as follows

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-wuzcef6c-163757539181) (C: \ users \ Chenchen \ appdata \ roaming \ typora \ user images \ image-2021112216230575. PNG)]

4. Release port and client connection

4.1 port release (Port 3690)

Check that the port is not released in the following command

[root conf]# firewall-cmd --query-port=3690/tcp
no

Release 3690 port

[root conf]# firewall-cmd --zone=public --add-port=3690/tcp --permanent
success

Restart port

[root conf]# systemctl restart firewalld.service

4.2 client connection

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-UmK3XfuE-1637575391182)(C:\Users \ Chenchen \ appdata \ roaming \ typora \ user images \ image-20211122151235124. PNG)]

After confirmation, you can enter the account password you set before

5. Synchronize svn updates to the server

5.1 import svn version Library in the server

[root conf]# svn co svn://localhost/tests /www/wwwroot/tests --username admin --password admin

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-e2m5df0-16375391183) (C: \ users \ Chenchen \ appdata \ roaming \ typora user images \ image-20211122172604011. PNG)]

In this way, the SVN version library is imported to the server (Note: if it is the first import, you need to enter yes)

5.2 create hook script in the server

Enter the hooks directory to create a post commit

[root tests]# cd hooks/
[root hooks]# pwd
/www/server/svn/tests/hooks
[root hooks]# vi post-commit

Enter the data

#!/bin/sh
export LANG=en_US.UTF-8
WEB=/www/wwwroot/tests         #Directory to update
update $WEB --username admin --password admin

Next, give the post commit file permission

[root hooks]# chmod 775 post-commit

Restart svn again

[root hooks]# ps -ef |grep svn
root     1506709       1  0 17:01 ?        00:00:00 svnserve -d -r /www/server/svn/
root     1512024 1489101  0 17:22 pts/1    00:00:00 grep --color=auto svn
[root hooks]# kill -9 1506709
[root hooks]# svnserve -d -r /www/server/svn/

5.3 automatic test update

Enter the file address of the version library just imported, and view the file of the next version library

[root hooks]# cd /www/wwwroot/tests
[root tests]# ls
index.php

We try to upload files on the client

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-rjfvxira-16375391184) (C: \ users \ Chenchen \ appdata \ roaming \ typora \ typora user images \ image-20211122180238867. PNG)]

After submitting, check the files of the version library. After checking, it is found that they are automatically added

Enter the file address of the version library just imported, and view the file of the next version library

[root hooks]# cd /www/wwwroot/tests
[root tests]# ls
index.php

We try to upload files on the client

After submitting, check the files of the version library. After checking, it is found that they are automatically added

Keywords: Linux svn server

Added by kb0000 on Mon, 22 Nov 2021 14:33:36 +0200