You don't have to have a dedicated server—or even a Windows machine—to set up a Subversion server. If you're a Mac user, you can walk you through the steps of downloading the SVN command line tools for OSX, setting up a repository, and using the svnadmin and svnserve tools to manage your own local server.
- [Instructor] Let's set up a Subversion server on a Mac. This will be done using terminal commands, not a nice graphical interface. You might already have Subversion installed on your Mac. To check, just open a terminal window and type svn. Press Enter. If the subversion binaries are installed, you'll get a message about typing svn help to get more information. In that case, you're done and you can skip forward a bit. If Subversion isn't installed yet, you'll get a message like this saying that the developer tools are not yet installed.
And then you get a nice dialog asking if you want to install them. Why yes, you do. We don't need the full Xcode package in this case, just the command line developer tools. So click the Install button to install. Accept the license agreement. You can read all of this later if you'd like. And then we wait for the software to download and the install to finish. This usually takes a couple of minutes, but not too long. Once the install is complete, we can click Done. And back in the terminal window, we can make sure it works by typing svn minus minus version.
This shows you the version of SVN you just installed. Normally that's all you have to do. But if that didn't work for some reason, you can always go to the subversion.apache.org website, find the Binary Packages section, and download the Subversion package for Mac OS X. That's also an easy install, but not quite as the Apple developer tools. Now, let's the server and create a project. First we need to create a folder that will hold all of our repositories. I'll create an SVN folder on my desktop.
Right-click, New Folder. And I'll call that folder svn. Now I'll open that folder and create a repos folder underneath that. That will hold our repositories. Back at the terminal, I'll type svn serve space minus d space minus r. And then I need the full path to that repos folder I just created.
I'll press Enter, and that actually starts the Subversion server. And it'll use the new repos folder as our repository root. Keep in mind you need to use the full path to the repos folder here when you start the server. You can't use a relative path. To create a new repository, change directories to the repos folder in terminal. So I will change to desktop/svn/repos. And then I'll type: svnadmin create MacRepo1.
So MacRepo1 will be the name of our new repository that will get created in this repos folder. I'll click Enter. And back in Finder, we can see that we have a new MacRepo1 folder in our repos folder. That's good. And that MacRepo1 folder has a lot of files and folders that got automatically created. There's a configuration folder, a db folder. There's even a README.txt file. The only one we're concerned with right now is the configuration folder. That's called conf for short.
Switch into the conf folder and right-click the svnserver.conf file. Let's open that with a text editor. Let me increase the size of the font so you can read that more easily. And I'll make that window full-screen. So what we want to look at here is these two lines, anon-access read and auth-access write. Those are currently commented out with a hash symbol in front of the line. I'm going to delete the hash symbol for both of those so that anon-access equals read and auth-access equals write are actually enabled.
What those two lines mean is that anonymous users have read access to the repository, so that's anon-access read. And authorized users, so users with usernames and passwords, have read-write access. The other thing we want to do is uncomment out the password-db line, where it says password-db equals passwd. So what this says is, there's a file called passwd that's going to be used as our password database. That's all we have to do with this file.
So I'm going to save it and close. And now in that passwd file, we want to open it with TextEdit. And add a new user. So I'll add a user that's the same as my current username, which is julianrobichaux. So the name is julianrobichaux, and the password will be password. Press Enter, and we have a new user with a password of password.
I'm going to File, Save. And close that file. So we're ready to go. You don't even have to restart the server after we've made those changes. Let's test that and make sure it works. First, back in the terminal, we want to get our IP address. We can do that using the ifconfig command: ifconfig space pipe space grep space "inet space quote.
So this shows us the IP addresses in use at this machine. My IP address is 10.35.3.24. So what I can do is I can type svn info svn colon slash slash 10.35.3.24 slash MacRepo1, because MacRepo is the name of the repository I just created. Typing that and pressing Enter, I get some basic information about the repository I just created.
But more importantly, it shows that the server is running and we can access it, at least locally. At the point in time that you want to stop the server, you can type this command in terminal: killall svnserve. Or you can open Activity Monitor, sort by process name, find the svnserve process, and kill it with this Force a process to quit button.
- Trunks, tags, and branches
- Checkout, commits, and revisions
- Merging, locking, and working with a team
- TortoiseSVN on Windows
- SVN integration with Eclipse
- Connecting to a project
- Creating a new Java project in Eclipse
- Connecting to an existing Java project using Eclipse
- Dealing with projects that move to a new location
- Making changes and creating branches
- Tracking changes and dealing with conflicts
- Creating a release