Set up SVN server in Ubuntu and create SVN + SSH client in Windows

Source: Internet
Author: User
Tags addgroup svn client svn update tortoisesvn

1. Install SSH sudo apt-Get Install SSH

2. Install subversion sudo apt-Get install Subversion

3. Create a user account sudo adduser Xiao for the Members involved in project development

4. Create a user group named SVN
Sudo addgroup SVN
Sudo addgroup Xiao SVN/* Add Xiao to the svn Group */Note: multiple user groups can be created based on different permissions, and users with corresponding permissions can be put into the corresponding group.

5. Create a project file storage directory
Sudo mkdir/usr/local/SVN
Sudo mkdir/usr/local/SVN/trunk

6. Create a SVN File Repository
Sudo svnadmin create/usr/local/SVN/trunk

7. grant corresponding permissions to members of the group
Sudo chown-r root: SVN/usr/local/SVN/trunk
Sudo chmod-r g + RWS/usr/local/SVN/trunk/* grant the read and write permissions to the svn group. You can change the corresponding permissions as needed */
Sudo chmod-R o-rwx/usr/local/SVN/trunk/* Delete read, write, and execute permissions of other irrelevant persons. By default, other persons may have read permissions */
Note: You can view related Linux commands for permission modification issues.

5. access permission settings
Modify svnserve. conf and passwd files in the/home/xiaozhe/SVN/mypro/conf directory. spaces are not allowed at the front end of the line.

Edit the svnserve. conf file, uncomment the following line, and use the top level.

Anon-access = read

Auth-access = write

Password-DB = passwd

Edit passwd as follows: [users] Andy = Andy

6. Enable svnserve and enable it in the svn root directory:
Svnserve-d-r/home/xiaozhe/SVN

 

7. Check whether startup is normal

$ Netstat-ntlp

We can see that there is an address with port 3690, indicating that the startup is successful.

8. Generate a key pair for each member (take xiao as an example)
Switch to Xiao User Logon: su Xiao (prompt to enter the Xiao password)
Input: Cd ~ /Enter whoami. If logon is successful, Xiao is displayed.
Run: SSH-keygen-B 1024-T DSA-N passphrase-F xiaokey
Note: passphrase is the key keyword, which can be modified as needed. xiaokey is the file name;
Here we use DSA encryption. You can use RSA encryption to change "DSA" to "RSA.

At this time, two files are generated: xiaokey and xiaokey. Pub. The first one is the secret key and the other one is the public key.
Then, create a directory
Mkdir/home/Xiao/. Ssh,
Copy the public key to the/home/Xiao/. Ssh directory:
CP xiaokey. pub/home/Xiao/. Ssh/authorized_keys
Note: The file name must be authorized_keys. Exit: exit.

9. To install the svn client in windows, install "tortoisesvn", "puttygen", and "Pageant"
9.1, download: http://sourceforge.net/projects/tortoisesvn http://www.chiark.greenend.org.uk /~ Sgtatham/Putty/
9.2 installation: omitted
9.3 convert Private Key format:
9.3.1 copy the xiaokey to Windows and run puttygen;
9.3.2. Choose conversions> Import key,
9.3.3 select the xiaokey file, and the prompt "Enter passphrase for key" is displayed. Enter the passphrase keyword used to create a public/private key pair,
9.3.4, then select parameters as SSH-2 DSA (if the public key is generated using RSA, select SSH-2 RSA "),
9.3.5. Click Save private key,
9.3.6. Save the file name as xiaokey. PPK.
9.4 establish the association between tortoisesvn and pageant, and add the private key to pageant:
9.4.1 right-click tortoisesvn and choose Settings> network> SSH client,
Input: C: \ Program Files \ tortoisesvn \ bin \ tortoiseplink.exe;
9.4.2 right-click tortoisesvn-> repobrowser and enter the URL:
SVN + SSH: // Xiao @ svnserviceip/usr/local/SVN/trunk;
9.4.3 run pageant, right-click the icon in the lower-right corner of the screen-> Add key, and add the private key file xiaokey. PPK.

Note: If you do not want to cache the SSH password, you do not need to save steps 8th and 9. You only need to keep the password 9.4.2, but you need to enter the password twice each time you go to the check out and check in folders, annoying you :)

// Todo: security of the Client Server

Operate Svn in Ubuntu: Learn @ vmubuntu1204 :~ $ Mkdir sourcecode
Learn @ vmubuntu1204 :~ $ CD sourcecode/
Learn @ vmubuntu1204 :~ /Sourcecode $ ls
Learn @ vmubuntu1204 :~ /Sourcecode $ mkdir svntrunk
Learn @ vmubuntu1204 :~ /Sourcecode $ CD svntrunk/
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk $ SVN Co SVN: // 192.168.1.88/trunk a trunk/test.txt get version 1. Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk $ ls trunk
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk $ CD trunk
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $ ls test.txt
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $ sudo gedit test.txt
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $ SVN commit-m' modified from Ubuntu 'test.txt
Certification field: <SVN: // 192.168.1.88: 3690> f216c773-9e20-4958-9739-440cf67467b4 "Learn" Password: is sending test.txt transfer file data. The submitted version is 2.
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $ SVN update u
Test.txt is updated to version 3. Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $ cat test.txt
Create from win first

Modified from Ubuntu first

Got modify
Learn @ vmubuntu1204 :~ /Sourcecode/svntrunk/trunk $

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.