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.txtcatalogueexplainconfConfiguration file of SVN version (access account and permission of version Library)hooksPlace hook scriptlocksThe client used to track access to the file libraryformatA text file that contains only an integer, indicating the version number of the current file library configurationdbStore 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.confcatalogueexplainauthzPermission control filepasswdAccount password filesvnserve.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-Q5Mnj7Oo-1637574887466)(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-XFFiN3RS-1637574887467)(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-UAeJWXxj-1637574887468)(C:\Users \ Chenchen \ appdata \ roaming \ typora 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 dnmquqni-1637574887469) (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-65vBRnVb-1637574887470)(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-1hYd06ow-1637574887472)(C:\Users \ Chenchen \ appdata \ roaming \ typora \ typera 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-QQHoNw1a-1637574887472)(C:\Users \ Chenchen \ appdata \ roaming \ typora \ user images \ image-20211122173226529. 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
[external chain picture transferring... (img-QQHoNw1a-1637574887472)]
After submitting, check the files of the version library. After checking, it is found that they are automatically added
[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-78bXRlKT-1637574887473)(C:\Users \ Chenchen \ appdata \ roaming \ typora user images \ image-20211122174601145. PNG)]