Home > OS >  Centos builds the SVN server
Centos builds the SVN server

Time:10-12

# # # installation environment and create a SVN repository

# # # # to install

Install Subversion:

` ` ` shell
Yum install - y subversion
` ` `

Check if the installation was successful:

` ` ` shell
Svnserve - version
` ` `

According to the following information: svnserve, version 1.7.14 (r1542130)... .

# # # #
create repository

create repository below
- build directory: ` mkdir/cloudlink/webapp ` `
- ` ` svnadmin create/cloudlink/webapp/project `

Can be seen in the generation of the project is as follows: version file:

` ` `
The conf db format hooks the locks the README. TXT
` ` `

Enter the conf directory can be seen:

- authz: access configuration file
- passwd: the user name password configuration file
- svnserve. Conf: service configuration file



# # # configuration user and group

# # # # configuration authz

` ` `
(aliases)
# Joe==Dessert/L/C=XZ/ST=Snake City/O=Snake Oil, ltd./OU=Research Institute/CN=Joe business

[groups]
# harry_and_sally=harry and Sally
# harry_sally_and_joe=harry and Sally, & amp; Joe
Cloudlink=xiefayang # # # to add users to user groups

#/foo/bar
# harry=rw
# & amp; Joe=r
# *=

# # # user group cloudlink project to the repository has read and write permissions
# repository:/baz/fuz
# @ harry_and_sally=rw
# *=r
[project/] :
@ cloudlink=rw
` ` `

# # # # configuration passwd

` ` `
[users]
# harry=harryssecret
# Sally=sallyssecret
Xiefayang=xiefayang
` ` `



# # # # configuration ` svnserve. Conf `

Find the following configuration items, remove the "#", make a corresponding configuration

` ` `
# anonymous user access: no
Anon - access=none

# ordinary user access: read, write
Auth - access=write

# password file
Password - db=passwd

# access configuration file
Authz - db=authz

# repository location
Realm=/cloudlink/webapp/project
` ` `



# # # test

Start the SVN service

` ` ` shell
SVN - d - r/cloudlink/webapp
` ` `

If you can't start successfully kill restart again

` ` ` shell
Ps aux | grep SVN
` ` `

Test checkout, switch to the `/home/WWW ` directory

` ` ` shell
SVN co SVN://localhost/project
` ` `

See if checkout success

Test the commit

` ` ` shell
Vi test. Py
SVN add test. Py
SVN commit test. P y -m "test commit the file"
` ` `

If according to submit successful, the server set up successfully.

Other test * * * *
On another machine (Windows) to install SVN, I installed the TortoiseSVN

Click the SVN Checkout: fill in the corresponding warehouse address, user name and password, click OK to go check out

! [svn_checkout] (https://blog-md-pic-1259135436.cos.ap-chengdu.myqcloud.com/%E5%85%B6%E5%AE%83/svn_checkout.png)

Note: if you check out the failed, you need to check the `/etc/sysconfig ` next iptables. Add:

` ` ` shell
-a INPUT -p TCP -m state - the state NEW -m TCP -- dport 3690 - j ACCEPT
` ` `



# # # hook to achieve automatic updates and synchronization

This step is mainly implemented when after change the code to submit to SVN server, WEB directory of synchro warehouse.

Don't need to manually update the

In the repository directory under the project of new ` post - commit ` file
(post - call after commit mean to submit this file to update, post - commit. TMPL is just a template, need not tube)

- ` vi post - commit `

` ` ` shell
#!/bin/sh
Export LANG=en_US. Utf8
SVN_PATH=/usr/bin/SVN
WEB_PATH=#/home/WWW web directory
$SVN_PATH update $WEB_PATH - username 'xiefayang - password' 111111 '- no - auth - cache
` ` `

? Look at/home/WWW user groups and the owner (if is: 'thank)

- change the post - commit users for the WWW directory: ` chown 'thank:' thank the post - commit `
-- to execute permissions: ` chmod 755 post - commit `

At this point, we must distinguish between [SVN server] and [WEB directory] these two address

If the SVN server and a WEB directory is on the same machine.

Then modify the code presented in other locations, WEB directory will automatically update synchronization.

  • Related