Quickly build SVN servers and use them in Ubuntu 14.04

Source: Internet
Author: User
Tags svn update tortoisesvn

Quickly build SVN servers and use them in Ubuntu 14.04

1. Introduction
Subversion is a free and open-source version control system. This version library is like a common file server. The difference is that it can record every file and directory modification. In this way, you can recover to the previous version and view the data change details. Currently, Subversion has become one of the mainstream open-source version management software, SVN for short.
2. SVN commands
Svn: command line Client
Svnadmin: a tool used to create, adjust, or repair version libraries.
Svnserve: svn Service Program
Svndumpfilter: a tool used to filter data streams dumped by svn database versions
Svnsync: svn Data Synchronization tool for storing the same
Svnlook: Used to view different revisions and transactions in the undergraduate course
3. Two running Modes
3.1 Use svnserve as an independent service and access through svn Protocol

3.2 With the help of the mod_dev_svn module, the apache service runs (Web/DAV) and is accessed through http or https. For details about the running mode, refer:

4. installation and deployment
For Ubuntu, installing SVN is very easy. Ubuntu 14.04 can be directly installed through the apt software package.
4.1 direct Installation
# Sudo apt-get install subversion
4.1 create a version Library
# Sudo mkdir/home/svn
# Sudo svnadmin create/home/svn/repos
4.2 understand the version Library
# Go To The version library to view the generated files
# Cd/home/svn/repos/
# Ls
Conf db format hooks locks README.txt
# We mainly care about the conf and db files. The conf folder stores the master configuration files, users, and permissions. The db folder stores the data after svn dumping.
# Cd conf/
# Ls
Authz passwd svnserve. conf
# The authz file sets user permissions. the passwd file stores the user and password, and the svnserve. conf file is the main configuration file. Configure the master configuration file first.
4.3 configure the version Library
# Sudo vi svnserve. conf # comment out the following parameters
[General]
Anon-access = none # anonymous access permission. The default value is read. none indicates that access is not allowed.
Auth-access = write # authenticate user permissions
Password-db = passwd # file storage for user information, which is under the version Library/conf by default. You can also specify the file location in the absolute path.
Authz-db = authz

# Sudo vi passwd # The format is user name = password, with a plaintext Password
[Users]
Xiaoming = 123
Zhangsan = 1, 123
Lisi = 123

# Sudo vi authz
[Groups] # define group users
Manager = xiaoming
Core_dev = zhangsan, lisi
[Repos:/] # Use the manager group of the repos version library starting from the root directory as the read/write permission
@ Manager = rw
[Repos:/media] # core_dev has read and write permissions on the media directory in the repos version Library
@ Core_dev = rw

4.4 start the svn Service
# Sudo svnserve-d-r/home/svn
# Check whether the instance is successfully started. You can check the listening port 3690.
# Sudo netstat-antp | grep svnserve
Tcp 0 0 0.0.0.0: 3690 0.0.0.0: * LISTEN 28967/svnserve
# If you want to disable the service, you can use pkill svnserve
4.5 access svn
# Access the repos version library address
Svn: // 192.168.1.100/repos
# Access the repos/media Directory address
Svn: // 192.168.1.100/repos/media
# Access the svn server from a client in Windows
Client: http://tortoisesvn.net/downloads.html
Connection Method: after installing the client --> right-click the desktop --> click TortoiseSVN --> select Repo-breowser --> enter the URL (svn: // 192.168.1.100/repos) --> enter the xiaoming user and password of the manager group to log on --> right-click after logon to upload and delete files
 
5. Common svn commands
5.1 obtain the latest version number
Svnlook youngest/home/svn/repos
5.2 synchronize the code directory on the server to the local directory.
Svn checkout svn: // 192.168.1.100/repos/media/svn -- username zhangsan -- password 123
# If you do not specify that the local directory to be synchronized (/svn) is the current directory by default, or you do not need to specify the user name and password, you need to manually enter it. Or use the abbreviation svn co "svn ://...".
5.3 submit the new file to the svn version Library
Procedure:
A) cd/svn # Switch to the local code directory,
B) svn add filename
# Add the file to the svn management. At this time, the file is not submitted. In addition, the file must be in the/svn directory. Otherwise, "svn: '..' is not a working copy" is reported"
C) svn ci filename
# Add comments and submit the file. The file will be opened in the nano editor. Press ctrl + x, Press y, and press enter to complete the submission.
5.4 submit the modified file to svn
Svn commit-m "Description" filename
5.5 update code to the latest version
# Update all files in the Code directory to the latest version.
Svn update
# Restore a file to a specific version
Svn update-r 85 filename #85 is the revision number
5.6 lock/unlock code
# Locking
Svn lock-m "comment" filename
# Unlock
Svn unlock filename
5.7 code update conflict
If an expiration is provided during submission, the Code conflict occurs. svn update filename is required, svn resolved filename is executed, and svn commit-m is submitted.
5.8 view logs
Svn log filename
5.9 View File Information
Svn info filename
Merge version 5.10 Libraries
Merge database 1 into database 2: first run the code checkout of database 2 to the local directory (svn co url2), and then run the migration (svn merge url1) in this directory.
6. Backup Mode
6.1 svnadmin dump is an officially recommended backup method. It is suitable for backup of a small (about GB) version database. It supports Incremental backup and Backup recovery is slow.
6.2 svnadmin hotcopy is a full hot copy tool. Therefore, it occupies a large number of disks and is suitable for backing up a large (over GB) version database. However, it cannot achieve Incremental backup and fast backup recovery.
6.3 svnsync is a real-time backup method that completely copies data to another version database. When this machine fails, it can quickly switch to the backup database.
7. backup and recovery
7.1 svnadmin dump backup
# Full backup
Svnadmin dump/home/svn/repos> YYmmdd_fully_backup.svn
# Full compression backup
Svnadmin dump/home/svn/repos | gzip> YYmmdd_fully_backup.gz
# Backup Recovery
Svnadmin load/home/svn/repos <YYmmdd_fully_backup.svn
Zcat YYmmdd_fully_backup.gz | svnadmin load repos
### Incremental Backup ###
# Complete backup
Svnadmin dump/home/svn/repos-r 0: 100> YYmmdd_incremental_backup.svn
# Incremental Backup
Svnadmin dump/home/svn/repos-r 10:200 -- incremental> YYmmdd_incremental_backup.svn
7.2 svnadmin hotcopy backup

# Backup
Svnadmin hotcopy/home/svn/repos YYmmdd_fully_backup -- clean-logs
# Restoration
Svnadmin hotcopy YYmmdd_fully_backup/home/svn/repos

Set up SVN server svn in Ubuntu 14.04 ://

CentOS 6.2 SVN setup (YUM installation)

Deploy Apache + SVN in CentOS 6.5

Build an SVN server using Apache + SVN

Set up and use the SVN server in Windows + reset the password on the client

Install SVN in Ubuntu Server 12.04 and migrate Virtual SVN data

Build svn service and migration method on Ubuntu Server

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.