📜 ⬆️ ⬇️

Install and configure SVN (server + client)

At the request of the workers, as well as considering that there is an article on installing SVN (true + Trac) under Linux, I decided to write a brief description of installing and configuring SVN for Windows.
Nothing new for people who know and work well with SVN will not be here. The purpose of the article is to help a certain percentage of newbies staying on Habré, yet master the study of this version control system.

From the very beginning I inform you that there is a detailed guide for SVN. It is called svn-book and is available on the site and goes along with the CollabNet Subversion-server. Also, about installing and configuring svnserv with Apache there is a description in the TortioseSVN tutorial (pretty good detailed help in Russian).

In fact, the SVN client can work fine without a server. The repository (code storage) can be created in any directory on your own HDD, or in a network directory. The server is required only for remote access to the repository, no more. The local repository is suitable if the project is run by one person and he just needs a system to control the versions of his application and backups.

If you are working in a team or you need remote access to the repository (via the Internet, for example), you need to install an SVN server. It can work independently or via the Apache web server. In the first case, access to the repositories will be using the svn: // protocol, in the second - http (s): //. Access via a web server is needed when there are problems with a firewall, when it only allows HTTP traffic, as well as for running some utility tools to the SVN server.
')
Server installation

The latest version of the svn-server can always be found on the site subversion.tigris.org . A pure svn-server without Apache in the bundle, and without visual lotions is available only for version 1.4.6, while the current version is 1.5.0. For version 1.5.0, there is a choice between CollabNet Subversion-server-1.5.0 (~ 11 MB) and VisualSVN Server (~ 5 MB). The first comes bundled with Apache, the second comes with Apache and a plug-in for the Windows Management Console. Also for VisualSVN there is a paid ability to integrate with Visual Studio.

A. Installing and configuring the VisualSVN server (svn-server + Apache + management console) is the easiest. This version cannot be installed without Apache.

1) Download the file VisualSVN-Server-1.5.1.msi or newer. Run the installation.
2) In the installation wizard we specify whether to use HTTP S for access, or just HTTP. Specify the port to listen on the selected protocol and authentication method. We also specify the directory in which the repositories will be stored.
3) After installation, open the Management Console (via Start, for example) and create users and repositories.

Now your repositories are accessible via the selected protocol (HTTP or HTTPS) at the specified host port (for example, localhost : 8443 / svn /). They can be viewed both from the browser (via xsl) and from the SVN client.

Working with the VisualSVN server is by far the easiest.

B. Installing CollabNet Subversion Server (svn-server + Apache optional).

1) Download the file CollabNetSubversion-server-1.5.0-23.win32.exe or a newer version. Run it on the installation.
2) Choose Components step. Set the SVNSERVE flag anyway. If you want to install Apache for SVN, check the box in front of it.
3) In the sunserve Configuration step, we install the port for sunserve (by default, 3690, there is no sense to change it if it is not busy) and the path to the repositories (the directory where you will create separate repositories in the form of subdirectories).
4) Then Apache is configured: host / port, path to repositories (the same as for svnserve) and prefix for URL (http: // host: port / prefix). The prefix is ​​needed in case Apache will be used not only for servicing SVN.

After installation, two new Windows services will appear: Subversion Server (our svnserv.exe) and Apache2.2 (if it was enabled during installation). To make it all they need to run.

C. Installing svnserve 1.4.6 (pure svn-server) .

1) Download the file svn-1.4.6-setup.exe . Run it on the installation. When installing anything except the target directory is not required. After installation, this directory must be added to the PATH environment variable (I don’t remember, maybe this is done automatically).
2) Create repositories with the command: svnadmin create c: \ repositories \ example-repository
3) Create a service. Command in the console: sc create svn_svr binpath = "c: \ Program Files \ Subversion \ bin \ svnserve.exe --service -r C: \ repositories \" displayname = "Subversion Svr"
Here -r C: \ repositories is the address of the directory with repositories, i.e. from it the paths will be calculated later. For example, if there are 2 repositories: C: \ repositories \ proj1 and C: \ repositories \ proj2, then specifying the -r C: \ repositories option and then the paths to the repositories will be: svn: // localhost: 3690 / proj1 and svn: // localhost: 3690 / proj2 respectively. Port 3690 is set by default, but you can change it (details in svn book) .4) The service starts automatically when Windows starts or from the list of services.

It is this job (except for the Apache installation) that the CollabNet Subversion Server installer did for you. In case of installing svnserve 1.4.6, access to the repository will be only via the svn: // protocol.

D. Creating a repository. I select this item in a separate section. If a repository is created in VisualSVN by a mouse click, then for svnserve (including the version from CollabNet) the repository is created from the console. There is a snv-install-folder \ bin \ svnadmin.exe file in the snv server distribution. If the path to snv-install-folder \ bin is not yet registered in the PATH, do it.

To create a repository, open a console (cmd) and go to the directory for storing the repositories that you specified during installation (CollabNet) or creating a service (svnserve 1.4.6). Create a new empty subdirectory (for example, example-repository ). In the console, run the command: svnadmin create example-repository . The svn file structure will appear in the directory you just created. They have a lot of useful "pieces", which can be read in the svn-book and tutorial.

In the conf subdirectory you can configure the main parameters of the repository. First of all, you need to close access to the repository to anyone. In the svnserve.conf file uncomment the lines
# anon-access = read
# auth-access = write
Do not forget to remove the space after the # as well. otherwise there will be an error reading the config. anon-access defines access for anonymous users, auth-access for registered users. They can take the values ​​“write”, “read” and “none”. Usually anon-access = none and auth-access = write.

Next, uncomment # password-db = passwd, and add the line user = password to the passwd file in the same directory.

For a start, this definition of access is good, but later, of course, passwords must be encrypted (read svn-book).

This completes the server installation and can install the client.

Client installation.

Some professionals prefer to work with the console. Perhaps this is not the most convenient way, especially for beginners, so we will not consider it. Others work with SVN via plugins to their IDE. This is the best way, but since there are many different IDEs and plug-ins for them too, we don’t describe how to work with them in this article.

The most popular and recognized SVN client for Windows is TortoiseSVN . After its installation, you will not receive a separate program that can be “classically launched”, the client is built into Windows Explorer, and commands for it are available from the context menu of the file (including in Total Commander).

Describing the installation of the client makes no sense, everything is just elementary.

How to work with TortoiseSVN is described in detail in the TortoiseSVN manual Subversion client for Windows .

Duplicate this detailed guide, of course, no desire, but still describe the super-fast-start work with tsvn.

1) To view any repository after installing TortoiseSVN, open the context menu on any file in the system, select the TortoiseSVN → Repo-browser menu. In the window that opens, enter the repository address with the protocol (for example, localhost : 8443 / svn / test or svn: // someserver: 3690 / proj1 / trunc ). The repository viewer window will open (using the button opposite the address bar, you can select which revision to view; HEAD is the latest revision).

2) To create a local repository (without using the server), the TortoiseSVN → Create repository here ... menu item is launched in the required directory. In the Repo-browser, this repository is accessible via the file: /// protocol.

3) To download a version from an existing repository, select the TortoiseSVN → SVN Checkout menu item on the directory into which the version will merge.

4) If you have not used SVN yet and want to upload your current source version to the server, launch the menu item TortoiseSVN → Import ... on the directory containing the version (do not forget that you need to pour the branch to the trunk).

5) TortoiseSVN → Export ... is used to get a clean version of the source code from the repository (without service version control files).

6) If the context menu is called up on a directory that is a local (working) copy of the repository, the context menu will significantly expand. For example, the items Update (merge the latest changes from the server) and Commit (upload your changes to the server) appear.

Lastly, I recommend reading an interesting series of articles Working with Tortoise SVN .

Source: https://habr.com/ru/post/29440/


All Articles