This documentation relates to CiviCRM version 3.2. It's not maintained anymore.
Current version of documentation.

Installing CiviCRM from subversion (SVN) repository

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.


Documentation Search


CiviCRM 3.2 Documentation

Support and Participation

Developer Resources


CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

NOTE: You need PHP5 installed and working (note also you must have php-xml installed if your distribution does not include DOMXML support in the mail PHP executable, as is the case in Fedora). If you are using a Mac and don't want to compile your own PHP build, download and install the latest version of MAMP (Mark Liyanage's PHP/Apache set does not include SOAP support).

This document is primarily for developers who want to install and run code directly from subversion.

  1. Check out CiviCRM code from the repository to a local directory

    Make sure you are picking up the right svn version. The example above picks up the 'trunk' directory which is the current development version. For a branch version you would replace 'trunk' with the branch directory (e.g. for v3.2 use http://svn.civicrm.org/civicrm/branches/v3.2).  To see a list of all currently available branches go to: http://svn.civicrm.org/civicrm/branches.
    Note: all CiviCRM releases are checked into a branch, and then merged into trunk.

    Using release tags in an SVN installation

    If you want to maintain the data in this installation through one or more release cycles, then consider checking out tagged releases rather than checking out the latest revision from a branch. This is particularly useful if you are working with a copy of production data from a stable release over the course of an alpha / beta new release cycle. Learn more

    For the scenario where you do want to be running off a branch, but temporarily switch to the tagged release with the intention of switching back to the branch, it can be achieved with "svn switch" but it may be more efficient to download the tarball release, take a peek in civicrm-version.txt to get the revision number, and then do "svn update -r <revision>"

  2. Create a settings file for your installation.
  3. Edit civicrm.settings.php with your site values, read the comments carefully.
    • $civicrm_root should be set to DRUPAL_ROOT/sites/all/modules/civicrm, not ~/svn/civicrm. We'll create a symbolic link from DRUPAL_ROOT/sites/all/modules/civicrm to ~/svn/civicrm later.
    • CIVICRM_UF_FRONTEND is needed for Joomla but not for Drupal.  If you are using Drupal you can define( 'CIVICRM_UF_FRONTEND', 0 ) but it isn't necessary.
    • set CIVICRM_DSN to your database information
    • set CIVICRM_TEMPLATE_COMPILE_DIR to  DRUPAL_ROOT/sites/default/files/civicrm/templates_c (and make sure that it is writeable)
  4. Create a new file called settings_location.php at the civicrm top level and add the following php fragment.
  5. Create a symbolic link from DRUPAL_ROOT/sites/default/civicrm.settings.php to ~/svn/civicrm/civicrm.settings.php (note that we need a default site for GenCode.php)
    • Replace DRUPAL_ROOT with your drupal root.
  6. We need to tell Drupal where to find CiviCRM. So create a symbolic link from somewhere in your Drupal installation that is searched for modules (stanard practice is DRUPAL_ROOT/sites/all/modules to ~/svn/civicrm.
    • Replace DRUPAL_ROOT with your drupal root
  7. Run the code generation script.
    • This should echo lots of stuff on the screen. You can ignore those messages (assuming they are not errors or warnings). If there are errors/warnings (most likely with path / bad values), please fix and rerun GenCode.php
    • If you do an update from the svn repository, you will need to run GenCode.php again (most likely). The schema might have changed also, so you might have to reload the database.
  8. One of the things that GenCode does is generate the MySQL that you'll need for your installation. You can find that code in ~/svn/civicrm/sql/civicrm.mysql. Since we aren't using the automatic installer, we have to create the CiviCRM tables ourselves. Alternatively, you could use phpMyAdmin to do this.
    • You could also import sample data at this point. To do that, use civicrm_generated.mysql in place of civicrm_data.mysql.
  9. Create a file called civicrm-version.txt at ~/svn/civicrm. The file contents should be the string "<civicrm_version> Drupal PHP5", where <civicrm_version> is the version number that represents the version of the working tree i.e. the version you are upgrading to.  For example, "2.2 Drupal PHP5".
  10. You are all set.  Navigate to the drupal module administration screen and enable CiviCRM.

Note: The SVN installation is equivilant to a manual installation.  Therefore, you might find the latest manual install process page useful.

Keeping your SVN install up to date

If you are running a version of CiviCRM that is under active development there will be periodic (possibly frequent) changes in the schema / database objects. An easy way to update your schema and the automatically created DAO files is to run the provided setup.sh shell script whenever you notice schema changes in svn updates (anytime a file in xml/schema is updated - you've gotten some kind of schema change). The script will generate a fresh copy of all the DAO's (running GenCode.php) as well as sql/civicrm.mysql and sql/civicrm_data.mysql - and then drop / rebuild your database.

Configure setup.sh

  • $ cp bin/setup.sh.txt bin/setup.sh
  • edit setup.sh - adding the correct values for DBNAME, DBUSER and DBPASS (for your CiviCRM database)
  • make sure setup.sh has execute permissions

Run setup.sh

  • $ cd bin
  • $ ./setup.sh
Labels:

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.