Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^106) CHAPTER 8 ■ TESTING, DEPLOYMENT, AND CONTINUOUS INTEGRATION


Installing Subversion


Subversion can be installed from package management on almost any distribution of Linux.
With Debian/Ubuntu style package management, the following command will install Subversion:

> apt-get install subversion subversion-tools

This will provide all the tools you need to create a local Subversion repository. A repository
is a version-controlled directory of files and folders. You can create multiple repositories, typi-
cally for multiple projects, and these tools will allow you to administer them on your server.

■Note Subversion is also designed to work remotely via the Apache web server. For this function, you need
to additionally install the libapache2-svn package, which provides the necessary bindings between Apache and
Subversion. Then you should take extra care to secure the server properly. If you chose to use Apache with
Subversion, I strongly suggest that you deploy Secure Sockets Layer (SSL) client-side certificates, as explained in
Chapter 21.

Setting Up Subversion


Administering a Subversion repository is actually quite simple. First, find a suitable location on
your server to store your repositories; I suggest /usr/local/svn, but any location will do. Next,
use the svnadmin create command to create a repository in this directory:

> svnadmin create myfirstrepo

You will now see a new directory (/usr/local/svn/myfirstrepo), which contains all the
files and databases needed to manage your project.
The next step is to get a working checkout of your repository. A checkout is a workspace for
Subversion, where you will add files and make changes. It is important to never make changes
directly to the files within your repository directory. To create a checkout, go to a new directory—
I suggest your home directory—and issue the svn checkout command:

> cd ~
> svn checkout file:///usr/local/svn/myfirstrepo
Checked out revision 0.

■Caution Do not call svn checkout within the repository containing directory /usr/local/svn/.


You will now see your repository directory. If you have an existing project, you can use the
svn import command to bring those files under revision control:

> svn import ~/existingproject file:///usr/local/svn/myfirstrepo

McArthur_819-9C08.fm Page 106 Friday, February 22, 2008 9:06 AM

Free download pdf