Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build svn server with linux

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces linux how to build a svn server, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

One: install svn

Yum install-y subversion

Second: create a warehouse

1: create a warehouse directory

Mkdir-p / var/project/test

2: create a warehouse

Svnadmin create / var/project/test

After the creation is successful, go to the following directory under the / var/project/test directory:

Drwxr-xr-x. 2 root root 51 January 30 13:26 confdrwxr-sr-x. 6 root root 4096 January 30 13:26 db-r--r--r--. 1 root root January 30 13:26 formatdrwxr-xr-x. 2 root root 4096 January 30 13:26 hooksdrwxr-xr-x. 2 root root 39 January 30 13:26 locks-rw-r--r--. 1 root root 229 January 30 13:26 README.txt

Under the conf directory is the configuration directory for svn, which includes:

-rw-r--r--. 1 root root 1080 January 30 13:26 authz # access Control-rw-r--r--. 1 root root 309 January 30 13:26 passwd # password Management-rw-r--r--. 1 root root 3090 January 30 13:26 svnserve.conf # SVN service process configuration

Three: svn configuration

1: permission configuration (/ var/project/test/conf/authz)

# user grouping (admin- > administrator, development-> development other- > others) [groups] admin = test1 # administrator user test1development = test2,test3 # development user test2,test3other = test4,test5,test6 # other user test4,test5,test6# permission configuration [/] @ admin = rw # administrator read and write permission @ development = rw # development read and write permission @ other = r # other read permission test7 = rw # test7 user read and write permission

2: password configuration (/ var/project/test/conf/passwd)

# password configuration. The format is username = password, and the password is plaintext [users] test1 = test1test2 = test2test3 = test3test4 = test4test5 = test5test6 = test6test7 = test7

3:SVN service process configuration (/ var/project/test/conf/svnserve.conf)

[general] anon-access = none # Anonymous user does not have access to auth-access = write # authenticated user read / write password-db = passwd # specify user authentication password file authz-db = authz # specify permission profile

Four: start the svn service (default port number 3690)

The copy code is as follows:

Svnserve-d-r / var/project #-d service backend runs-r specifies the working directory, / var/project indicates the specified working directory, note that the warehouse name and address (/ var/project/test) cannot be specified

Designated port to start svn

Svnserve-d-r / var/project-- listen-port 3691

Five: turn off the firewall or open the specified port number

1: turn off the firewall

Systemctl stop firewalld

2: turn on the specified firewall

# Open port 3690 firewall-cmd-- zone=public-- add-port=3690/tcp-- permanent# refresh configuration firewall-cmd-- reload

Six: the client connects and uploads the file

Connect svn to windows

1: create a new directory and right-click to select svn check out

2: enter the svn address of linux and the name of svn://ip:3690/ repository in the version repository (the warehouse name here is not / var/project/test but / test)

2: fill in the username and password

At this point, we can see that a .svn file has been generated in this directory, indicating that we have connected to the svn server on linux.

3: upload files

Now let's create a new test.txt file and fill in some information at random

(1) right-click to select add

Then select the test.txt file, click OK, and we will see that there will be a plus sign on the test.txt file.

(2): upload

Right-click to select submit

Fill in the comments and select the file to upload and click OK.

At this point, we can see that the plus sign on the test.txt file will turn into a green check sign, indicating that the upload is successful.

But at this point we found that we didn't find the file we uploaded in the / var/project/test directory at all. Why? Didn't we upload it successfully?

This is because after uploading the file to the SVN version library, the uploaded file is no longer stored in its original format, but is compressed into version library data by svn in its custom format and stored in the version library. The svn server version library has two formats, one is FSFS and the other is BDB.

At this point, we need to check out in linux.

4: check out

Svn checkout svn://192.168.11.201/test / data/test # svn://192.168.11.201/test indicates the address of the warehouse to be checked out / data/test indicates the directory to which you need to check out

This is the file we uploaded on the client in the / data/test directory, but now the problem is again. After uploading the file on the client, it is impossible for us to check out on the server every time, so how to check out automatically?

5: automatically check out configuration

Create a new post-commit file under the / var/project/test/hooks directory, and the post-commit file is added as follows:

#! / bin/shREPOS= "$1" # Warehouse REV= "$2" # version number export.UTF-8 # Encoding SVN=/usr/bin/svn # svn address WEB=/data/test # Project directory $SVN update $WEB to be updated-- username test1-- password test1 #-- username test1 indicates setting user name-- password test1 indicates setting password

Set post-commit to executable

Chmod + x / var/project/test/hooks/post-commit Thank you for reading this article carefully. I hope the article "how to build a svn Server with linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report