Ubuntu Create SVN server and set up submit and update to website

Source: Internet
Author: User
Tags svn client svn update

Create an SVN server

1, first install SVN this software

Apt-get Install Subversion

2. Create a folder named SVN in the home directory (the name of the folder is random)

Mkdir/home/svn

3. Create a Data warehouse (you can create as many as you want)

Svnadmin Create/home/svn/test

4. Start SVN Network Service

Svnserve-d-R/HOME/SVN
Where the-D parameter lets Svnserve run in the background, the-R parameter limits the data warehouse to the address that can be accessed on the network. /HOME/SVN Specify the location of the directory where the SVN data warehouse resides
5. Set SVN: Access permissions for the way
In each data Warehouse directory there are a bunch of directories, enter CONF and open svnserve.conf This file, find the following lines,
and remove the previous note symbol ' # ', and be careful not to leave any spaces in front of each line.

Anon-access = Read
auth-access = Write
Password-db = passwd

Where anon-access and auth-access are anonymous and privileged users, the default is to read-only permissions for anonymous users.

But if you want to deny access to anonymous users, simply change the anon-access read to none to achieve the goal.
The passwd after password-db is the file path that defines the user name and password. This file defaults to snvserve.conf
The same directory, see below How to configure the contents of the passwd file.

[User]
# Harry = Harryssecret
# sally = Sallyssecret

Harry and Sally each define the user name and password of the user who can write to repo. We can add the following
Your user name and password, such as

TESTSVN = Tester

This gives the user TESTSVN permission to write to repo. After saving, the SVN server can be run even if it is official!

Put all the projects that need to be managed in the/HOME/SVN directory and build the Data Warehouse with the Svnadmin create command as normal .

This allows the SVN client to pull the data warehouse on the server to local using the SVN Co SVN://IP address/Data Warehouse directory.

recently upgraded the next Linode, found that SVN can not be submitted and updated, reported svn:E000061:Unable to connect to a repository at URL such errors, later looked up some information, it is SVN port is not open, SVN default port is 3690, in Ubuntu View port open situation, command is NETSTAT-ANP, the SVN service is restarted under it, command for svnserve-d-r/home/svn

Setting up an Update synchronization web site

SVN sync repository with Site Directory

Defined:

SVN repository =/home/svn/repos

Site Directory =/var/www/web

Www.2cto.com

1. Check out a project to the site Directory

#svn Checkout File:///home/svn/repos/var/www/web

At this point, the site directory has become a working copy of SVN, and all we have to do is let the working copy be updated automatically.

3. Add hooks (Hook) file

# Vim/home/svn/repos/hooks/post-commit

#!/bin/sh

Export lang= "ZH_CN. UTF-8 "#防止乱码

SVN update/var/www/web--username user1--password password1--no-auth-cache

Modify the file permission after saving to 755, otherwise SVN cannot invoke execution

#chmod 755/home/svn/repos/hooks/post-commit

Hooks (Hook) file Description:

# Start-commit triggers a transaction before committing

# Pre-commit triggers transaction before commit completes

# Post-commit triggers transaction when commit is complete

# Pre-revprop-change triggers a transaction before the Version property is modified

# Post-revprop-change triggers a transaction after the version property has been modified

Ubuntu Create SVN server and set up submit and update to website

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.