I want to build the SVN service on Ubuntu. after some exploration, I finally completed the minimal SVN service installation method. for details, refer to Ubuntu.
If you want to build the SVN service on Ubuntu, you need to install Apache for all the tutorials on the Internet, but I have already installed Nginx and don't want to install another Apache just for SVN. After some exploration, we finally achieved the minimal SVN service, and no additional software needs to be installed.
The detailed process is as follows:
1. use apt-get to install subversion
Copy codeThe code is as follows:
Apt-get install subversion
I used to go astray and thought there would be a package such as subversion-server, which could not be found. later I realized that this subversion included both the server and client.
2. find a directory as the SVN root directory.
I chose/data/svn. the following commands also follow this directory. please modify them according to your choice.
3. create a database
My name is akcms. after the execution, a bunch of items are automatically generated in the/data/svn/akcms/directory, with a folder named conf
Copy codeThe code is as follows:
Svnadmin create/data/svn/akcms
4. Next, modify the three files under/data/svn/akcms/conf/, which are svnserve. conf, passwd, and authz in sequence. The three roles are: Master configuration file, password configuration file, and permission configuration file.
5. edit the vi/data/svn/akcms/conf/svnserve. conf file.
Find the following items and modify them according to the following settings. remove the preceding comments. each line cannot start with a space.
Copy codeThe code is as follows:
Anon-access = none
Auth-access = write
Password-db = passwd
Authz-db = authz
6. edit the vi/data/svn/akcms/conf/passwd file.
Copy codeThe code is as follows:
[Users]
Mantous = 123456
The format is simple. the user name and password are saved in plaintext by default.
7. edit the vi/data/svn/akcms/conf/authz file.
Copy codeThe code is as follows:
[Groups]
Develop = mantou
[/]
@ Develop = rw
This configuration is a little complicated: the [groups] group sets user groups. for example, the developer group I set can be understood as the developer group, and the equal sign is followed by the group members, each member is separated by a comma. Next, [/] sets permissions for a specific address. @ develop indicates setting permissions for the develop group, and rw indicates reading and writing. There are other complex usages, but I only know the simplest and most commonly used ones, so all others are skipped.
8. start the service
Copy codeThe code is as follows:
Svnserve-d-r/data/svn
The-d parameter indicates that the process is started in daemon mode, and the-r parameter indicates the root directory of the code repository. if the startup succeeds, you can view the process through ps aux | grep svnserve, so far, a simple SVN service has been set up.
Then, place the command in rc. local so that the SVN service is started every time the system is started.
9. Next, test and verify. find a directory on the client and execute the following command:
Copy codeThe code is as follows:
Svn co svn: // 192.168.0.111/akcms -- username = mantou -- force
Svn: // 192.168.0.111/akcms is the address of the newly created code repository. assume that the service was created on 192.168.0.111. Parameter -- username indicates the user name. If this parameter is not specified, the user will log on as the current system user. The system user and SVN user are irrelevant. Therefore, it is better to manually specify the username. -- The force parameter is optional. if you perform tests on the same address repeatedly and delete the created and created parameters, the SVN client caches the UUID of the last successful checkout, if the UUID is deleted and then created, the client will prompt "Repository UUID 'XXX' doesn' t match expected UUID 'XXX'" if the verification is inconsistent '", when the -- force parameter is added, the verification is ignored and the checkout is forcibly executed.
If it succeeds, the system will prompt "Checked out revision 0.", and then generate an akcms directory under the current directory, which contains the code of the code repository.