Installing Subversion on CentOS
I’ve been using subversion a lot recently – from using repositories with client development companies to installing it for clients – it seems to be the SVN month.
Anywhere, here’s how I did it. Using CentOS 4.2. For anyone learning or using Subversion I highly recommend that you read the book.
First you need to get the package and install it.
# wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
# gunzip subversion-1.3.2.tar.gz
# tar -xvf subversion-1.3.2.tar
# cd subversion-1.3.2
# ./configure
# make
# make install
Then you’ll need to setup at least one repository. I’m going to need multiple repositories that I can use for different clients so I have a bit of extra admin work ahead of me. You can setup as many repositories as you need, but no matter what you’ll need at least one. Here create the folders…
# mkdir /svn
# mkdir /svn/repo
Then we need to tell subversion to make our first repository.
# svnadmin create /svn/repo/myproject
For the time being, I’ll use the default svn server called svnserve. You can use apache to get a ton of extra features and better security. Click here for more information on using Apache with subversion. I need do some additional research for my multiple-repository setup before switching to apache though.
First, I need to setup a config file for svnserve.
# vi /svn/repo/myproject/conf/svnserve.conf
Then, look for variations of the following code and edit it as necessary. By default any anonymous user can access the code so to disable that you must include anon-access = none, just commenting the value out will not prevent anonymous access.
anon-access = none
password-db = passwd
realm = My SVN Repository
auth-access = write
The password-db is just a path to a file containing usernames and passwords. This is automatically created by svn inside the repository conf directory. So, save your changes and then we’ll edit said user file.
# vi passwd
Enter in something like:
[users]
username = password
Yes, pretty basic. See what I meant about svnserve and security? The password is in plain text so if someone ever got your system or that file, they’ll have the passwords inside. That’s one more reason to move to apache.
Anyway, you’ll need to start the svn server.
# svnserve -d
One side note – svnserve just runs and doesn’t have a way to stop besides killing the process. If you make changes to the svnserve.conf or user file you’ll need to restart svnserve.
# killall svnserve
Then, go ahead and test (best to do so on a different machine).
# svn co --username=myusername svn://<hostname>/svn/repo/myproject
The system should then ask you for your password and off you go!
Update 6/25/09: Minor clarifications thanks to Andy Hunt.
No related posts.