|
SVN installation on Windows |
|
There are a few tools you should absolutely use if you're a developer. These are: - Version control system
- Bug tracker
- Automatic build system
- Unit tests framework
- ... and many more :)
All the above raises your process maturity, but 1 & 2 are really crucial, and should be used even for simple projects with single developer working on it. One of the best version control systems is Subversion (SVN). SVN is released under an Apache/BSD-style open source license, so it's free of charge. Below you can find detailed, step by step tutorial how to install SVN on Windows PC. - Download Subversion binaries for Windows from here. Current version is svn-1.4.5-setup.exe. All the '-setup.exe' versions comes as Windows installer, so download the latest you can get.
- Run the installer and follow the installation instruction. One of the question you can get (only if you have Apache installed) is if to install and configure Subversion modules for Apache. As this tutorial describes how to setup standalone svnserve.exe server as a Windows service - uncheck this option. The rest of options are trivial (installation directory, etc ...) so I'll skip this.
- Setup server as a Windows service using the following command:
sc create SvnServe binpath= "C:\Program Files\Subversion\bin\svnserve.exe --service --listen-port 3690 -r \"C:\SvnData\"" start= auto WARNING: The single space characters after the '=' sign in sc parameters matters!!! - Start service manually for the first time (or restart system):
net start SvnServe - Create directory for your repositories:
md C:\SvnData - Create repository for your project:
"C:\Program Files\Subversion\bin\svnadmin.exe" create C:\SvnData\MyProject - Edit repository configuration file: C:\SvnData\MyProject\conf\svnserve.conf and edit the file. You can set there the following parameters:
- anon-access - defines the access level of the anonymous users - the options are read|wite|none with default value read
- auth-access - defines the access level of the authorized users - the options are read|wite|none with default value write
- password-db - defines file name of the password database - the default is passwd file in the same directory as svnserve.conf
- authz-db - defines file name of the authorization database - the default is authz file in the same directory as svnserve.conf. This file let you create user groups and manage access to the projects in more detailed way. You will no need it with a simple access scenarios.
- realm - defines the database realm, which is by default unique to the project. Set this value to some common with other project if you want to authorize once for all the projects (if you do so the password-db parameter should be set to common user database file).
Sample configuration file: [general] anon-access=none auth-access=write password-db=passwd realm=LocalSvnRealm - Edit password database file: C:\SvnData\MyProject\conf\passwd and optionally move the file to the target location if you changed default location in configuration file. The file structure is:
[users] user1 = password1 user2 = password2 and don't require more comment I think.
SVN server and project repository are ready now. All you need is to use any client (I prefer TortoiseSVN available from Tigris.org but you can do it using command line tools of course) and initially checkout repository to your working directory - the repository URL is svn://localhost:3690/MyProject. "C:\Program Files\Subversion\bin\svn.exe" checkout --username=user1 --password=password1 svn://localhost:3690/MyProject c:\WorkingCopy There are a few more things: - adding Subversion binaries directory to your PATH variable will help you working with SVN on everyday use
- it's good (but not mandatory) to create standard repository layout to keep your project data. So you should create the following directory structure in the project
- trunk - this directory will store working copy
- branches - this directory will store branch copies
- tags - this directory will store tag copies
After you create those directories you can switch your working directory to svn://localhost:3690/MyProject/trunk and start development. md c:\WorkingCopy\trunk c:\WorkingCopy\branches c:\WorkingCopy\tags "C:\Program Files\Subversion\bin\svn.exe" add c:\WorkingCopy\trunk c:\WorkingCopy\branches c:\WorkingCopy\tags "C:\Program Files\Subversion\bin\svn.exe" commit --username=user1 --password=password1 --message="Directory structure created" c:\WorkingCopy "C:\Program Files\Subversion\bin\svn.exe" switch svn://localhost:3690/MyProject/trunk c:\WorkingCopy - the default port for svnserve is 3690 so you can skip it in service creation command as well as in repository URL (it was included here for presentation purposes)
|