/******start*********/
Step 1: Install svnserve through the yum command, the command is as follows:
>yum -y install subversion
This command will automatically install svn server-related services and dependencies, and the command will automatically stop when the installation is complete
To view the svn installation location, you can use the following command:
>rpm -ql subversion
Step 2: Create a repository directory (this is only a directory, providing a storage location for creating a repository later)
Choose to create a version library under the var path, currently in the root directory, and create it at one time as follows:
>mkdir /var/svn/svnrepos
Step 3: Create the svn repository
Based on the path established in the second step, create a version library, the command is as follows:
>svnadmin create /var/svn/svnrepos/xxxx (xxxx is your expected repository name, which can be customized)
After the creation is successful, enter the xxx directory
>cd /var/svn/svnrepos/xxxx
Enter the directory, you can see the following file information:
Step 4: Configuration modification
Enter the directory of the version library that has been created, that is, the xxxx created above
enter conf
>cd /var/svn/svnrepos/xxxx/conf
There are three important configuration files stored in the conf directory, as follows:
authz: Responsible for the management of account permissions, controlling whether the account has read and write permissions
passwd: User list management responsible for accounts and passwords
svnserve.conf: svn server configuration file
The details are modified as follows: (I hope everyone will strictly follow the information below, without referring to other information on the Internet)
Modify the authz file information as follows:
>vi authz
At the end of the file content, add the following:
Just add at the end, no need to modify or add anything in other parts of the file (please ignore the place where the groups are mosaiced by me, it is actually a useless record, I forgot to delete it), the content at the end is as follows:
[\]
Account 1 = rw
Account 2 = rw
。。。。。
rw means to give this account read and write permissions. Please note that the slash in [] must be a backslash. Some tutorials say that you need to add the version library name in brackets. I directly recommend writing it like this, which allows access Greater authority, to avoid some mistakes
Modify passwd file information
>we passwd
The account password file does not need to be modified, and the account and password information can be directly appended to the file. Note that the format is:
account = password
For example: admin = 123456
Modify svnserve.conf (important)
vi svnserve.conf
The content of the original file has been commented out. We only need to remove the 4 comments before the specified content, as follows:
Most of the network information will ask everyone to remove the comment of authz-db = authz. After I have been cheated many times, after removing this item, although the svn server can be connected, it will always prompt "authentication failed", comment normal
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 comments without any modification
At this point, the configuration has been completed, and the account information has been added successfully.
Step 5: Open the firewall
In most cases, the server installation is completed, and after the configuration is completed, the svn server cannot be connected, which is a firewall problem.
>firewall-cmd --zone=public --add-port=3690/tcp --permanent T
>firewall-cmd --reload
Six: Start the svn server
In the root directory, execute the following command:
>svnserve -d -r /var/svn/svnrepos
After the startup is successful, use ps -aux to check whether the service startup is successful
Seven: The client accesses the svn server
==================================================================
Linux server side setting svn boot
(1) Create a script file in the Linux server directory ((/root path))
# touch svn.sh
(2) Enter the script file
# vim svn.sh
(3) Add some content
#!/bin/bash
/usr/bin/svnserve -d -r /var/svn/svnrepos
explain:
For the sake of safety in the svnserve path here, it is best to write an absolute path, because the environment variable may not be loaded during startup.
How to check the absolute path?
# which svnserve
(4) Change the execution permission of the script
# chmod 777 svn.sh
(5) Add automatic operation
# vi /etc/rc.d/rc.local
Add the path of the script at the end:
/root/svn.sh
(6) Restart the Linux server, and check whether the svn server is enabled after restarting
# ps -ef|grep svnserve
If the following information is displayed, it means that svn has been opened:
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN