SVN installation and configuration under Linux environment (using Hooks to synchronize development environment and test environment)

Source: Internet
Author: User
Tags svn client svn update

Install with Yum One-click installation:

1. Environment CentOS 6.6

2. Install SVN
Yum-y Install Subversion

3. Configuration

Build the Repository Directory
Mkdir/www/svndata

Svnserve-d-r/www/svndata

4. Build the Repository

Create a new Subversion project
Svnadmin Create/www/svndata/project

5. Repository Configuration

into the corresponding repository, such as NILRXX, there are some automatic files generated. In the Conf directory is the three files we need to configure: Authz passwd svnserve.conf

Now only record I have successfully configured as follows:

5.1: Open the svnserve.conf and open the comment on the following statement.

Password-db = passwd

5.2: Open the passwd file, join a user and make a password

Ruanwenwu = 123456

6. Turn on SVN service

6.1:svnserve-r-t-d/www/svndata

Explanation: The warehouse directory followed by, not the project directory

6.2: Add this command to boot boot:

Vi/etc/rc.local

Add the 6.1 command to the file

7. The project catalog can then be import into our project warehouse.

7.1: Enter our project directory such as:/home/wwwroot/www.doubilaile.com

Cd/home/wwwroot/www.doubilaile.com

7.2:SVN Import./Svn://192.168.1.233/project

Running this command may have an issue with $svneditor environment variables, just run this command: Export Svn_editor=vim

Successful command execution will pop up a log file to write the input situation, write two sentences to save. The project was brought in here.

8. Here you can open the SVN Client Checkout Project for window, the path is Svn://192.168.1.233/project

If you encounter a situation where the target computer is actively rejecting, check to see if Linux has a firewall turned on and shut down if it is turned on.

View firewall Status: Sevice iptables status;

Shut down firewall: service iptables stop;

Permanently closed: Chkconfig iptables off;

We often need to submit the code and test it in a Linux environment at the same time. What do we do? You can use SVN hooks to solve the problem.

An explanation of how to update code synchronously with SVN hooks

First of all to popularize the common sense svn hooks, namely hook (in each repository under the Hooks folder, there are many hooks, my directory is/home/svn/fitness/hooks/).  When subversion performs an operation, the corresponding hook program is called first. We build a test environment when we develop it, and we don't need everyone to update to local re-test.   Based on this feature of SVN, in order to implement a synchronous test server, we only need to let the hook program update the test server's files automatically after the user completes the commit operation. With this idea, we start building post-commit hooks. 1, in the directory of the Web site, use the checkout command to establish a replica #svn co svn_url/var/www/mysite/for example: SVN co svn:// 192.168.1.233/project/var/www/www.doubilaile.com/the meaning of this sentence is to put the code in the warehouse checkout to/var/www/www.doubilaile.com/this directory. 2. Now set the hooks, copy the/hooks/post-commit.temp file in the warehouse project to Post-commit, and modify the file permissions #chmod 755 post-commit 3, edit Post-commit, Write the following code to

#!/bin/sh

Export LANG=ZH_CN. GBK

SVN update--username Ruanwenwu--password 207099/home/www/www.doubilaile.com

The first command is the window local character encoding, the second is the synchronization is done, can be used. About this post-commit file, you can completely use the above statement, regardless of the default. The pro-test can be passed. At this point, a complete SVN synchronization, and synchronization in the test environment, the work is done.

    

SVN installation and configuration under Linux environment (using Hooks to synchronize development environment and test environment)

Related Article

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.