Basic knowledge
Construction and use of svn server under linux
Article directory
1. Install svn client
2. Install svn server
3. Create a repository in the svn directory
4. Modify the repository configuration file
4.1 Modify the authz file
4.2 Set password passwd
4.3 Modify the svnserve.conf file (important)
5. Start the svn server
6. Client access to svn server
7. SVN CheckOut
1. Install svn client
If you need to use the svn service, you first need to install the svn client locally.
The svn client download address is: http://tortoisesvn.net/downloads.html
The installation process is skipped here.
2. Install svn server
Install svn server:
yum install subversion
1
View the downloaded information, installation location and details:
rpm -ql subversion
1
3. Create a repository in the svn directory
You can place multiple projects under the repository directory without having to create a repository for each project. Below is my repository:
# Create repository directory
mkdir /home/svn/groupRepos
# create repository
svnadmin /home/svn/groupRepos
1
2
3
4
View and analyze the generated files:
ls /home/svn/groupRepos
1
You can see the following files:
conf directory: the configuration file of the repository, including user access accounts, permissions, etc.
db directory: store data
format file: It is a text file with only one integer in it, indicating the version number of the current file library configuration (you can open it with vi to see)
hooks directory: the directory where hook script files are placed
locks directory: The directory used to place subversion's db lock files and db_logs lock files, used to track clients accessing the file repository
README.txt file: Documentation
Note: There may be a certain delay in generating the file here. If you don't see the file, you can wait for a while and check it again.
4. Modify the repository configuration file
The configuration file of the repository is located in the /home/svn/groupRepos/conf/ path and contains the following files:
authz: Responsible for the management of account permissions, control whether the account has read and write permissions
passwd: responsible for user list management of accounts and passwords
svnserve.conf: svn server configuration file
4.1 Modify the authz file
vim /home/svn/groupRepos/conf/authz
1
The authz file after adding the account and permissions is as follows:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
Jack = rw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
twenty one
twenty two
twenty three
twenty four
25
26
27
28
29
30
31
32
33
34
Just add at the end, no need to modify and add anything in other parts of the file. At the end the content is as follows:
[\]
Then set account = permissions
r: read
w: write
: wq save and exit
1
2
3
4
5
4.2 Set password 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
Jack = 123456
1
2
3
4
5
6
7
8
9
4.3 Modify the svnserve.conf file (important)
vi /home/svn/groupRepos/conf/svnserve.conf
1
The modified file is as follows:
Note:
Most network materials will ask you to uncomment the authz-db = authz line. After my own experience of being scammed many times, after this article is removed, although the svn server can be connected, it will always prompt "authentication failed", comment It's normal to drop it.
Most of the information will let you fill in the server ip at realm = My First Repository. After testing, it is useless after filling in, so you can remove the comment without any modification. The configuration has been completed, and the account information has been Added successfully
[Note]: The svn port needs to be opened when the firewall is turned on: 3690. For adding external ports under Linux, please refer to the blog: Open the external network port in the firewall under Linux
5. Start the svn server
Start the svn server:
svnserve -d -r /home/svn/groupRepos
1
After the startup is successful, you can use ps -aux to check whether the service startup is successful. This is to display all running processes:
ps -ef | grep svn
# xxx 22052 1 0 15:59 ? 00:00:00 svnserve -d -r /home/svn/groupRepos
# xxx 28962 20465 0 16:19 pts/1 00:00:00 grep --color=auto svn
1
2
3
pid=22052 is the process id corresponding to the svn server. To close the process, use the kill -9 pid command.
6. Client access to svn server
On the svn client, enter the address: svn://ip address:3690/groupRepos
(The IP address is your svn server ip, groupRepos is the repository name created above, and 3690 is the default port of svn)
svn://xxx.xxx.xxx.xxx:3690/groupRepos
1
Enter the user name and password in the pop-up, enter it to access.
7. SVN CheckOut
Create a new directory locally, right-click the SVN CheckOut option, enter the user name and password, and you can get the existing resources in the CherkOut repository.
After CherkOut, you can see a new .svn file in the local file.
To upload new files locally, select SVN Commit.
Pull the latest file in the repository and select SVN Update.
[Reference Blog]:
Construction and use of svn server under linux (including diagrams): https://blog.csdn.net/u011280484/article/details/50499534
SVN server construction under Linux: https://blog.csdn.net/qq_35241080/article/details/87875142
———————————————
Copyright statement: This article is an original article by the CSDN blogger "Sake Brewery Xiao Yuanzi~", which follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/u012856866/article/details/122489995