This page provides instructions for installing CiviCRM from Subversion. Subversion is now deprecated. Source code is now managed through git. For more directions, see Contributing to CiviCRM using GitHub.
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) Start with a working CiviCRM install on your server/localhost. If you do not currently have CiviCRM installed, download the latest tarball and run the installer.
2) Usually the installer will have installed CiviCRM with the permissions of the webserver, in particular the folders used for template compilation usually under <site_root>/sites/default/files/civicrm. The OS user that you are logged in as for the next steps will need write access to those folders. In a development environment you don't have to worry about security so you can just do something like `chmod -R 777 <site_root>/sites/default/files/civicrm`.
3) Check out CiviCRM from the repository to update the code in your civicrm install with the following commands
cd <site_root>/sites/all/modules mv civicrm /tmp/old-civicrm (Note: outside the Drupal modules tree) svn checkout http://svn.civicrm.org/civicrm/trunk civicrm cd civicrm/xml php GenCode.php
Using windows explorer, cut and paste <site_root>\sites\all\modules\civicrm to a backup location somewhere outside the Drupal modules tree. Install TortoiseSVN if you don't already have it. In windows explorer, create a new empty folder called civicrm in \<site_root>\sites\all\modules. Inside the civicrm folder, right-click and choose "SVN Checkout". Fill out the repository url as http://svn.civicrm.org/civicrm/trunk Click OK. Open the civicrm folder and then shift-right-click on the xml folder and choose "open command window here". In the command window type php GenCode.php If you get an error "php is not recognized as an internal or external command", you can either add it to your path temporarily (set PATH=%PATH%;<path to php.exe>, or add it to your system path (control panel > system > advanced > environment variables). If you're using wamp or xampp, you'll need to hunt around for where it's installed, or do a file search for php.exe.
You can also do it the slightly harder way and install manually .
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.4 use http://svn.civicrm.org/civicrm/branches/v3.4). To see a list of all currently available branches go to: http://svn.civicrm.org/civicrm/branches.
Note: If you are installing a 4.x version with Drupal 6, you will also need to do the steps near the bottom of distmaker/dists/drupal6_php5.sh, where it replaces the drupal folder with the version from 3.4.
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
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 (for CiviCRM < v4.3)
Configure setup.conf (for CiviCRM >= v4.3)
|You can't use setup.sh on Windows. You will need to manually run the commands as described in the document at the link above installing manually, but start down at step 6 there.|