evilrobot's picture

This is a guide for installing CiviCRM in the Turnkey Linux Drupal 7 Appliance. Before you install CiviCRM you should make sure your system and Drupal are up to date.

Updating Turnkey Linux
To update Turnkey Linux you will need to login remotely using Shell in a Box, which is called Web Shell in the Configuration Console.
To use Shell in a Box enter https://192.168.XX.XXX:12320 into your web browser. The IP address you need to enter will vary depending on your network. The IP address information can be obtained from the system you have Turnkey installed on, when the system is on it will be displayed in the Configuration Console. Once you have entered the appropriate IP address into your web browser you should be greeted by a login prompt. It is a good idea to keep Shell in a Box open in a tab since at various points you will need to switch back and forth between other tabs during this walk through.

Login as your user and enter the following to preform an update.

# apt-get update && apt-get dist-upgrade


You will also need support for cURL in CiviCRM to make use of some of its features to do this use the following command to install php5-ucurl:

# apt-get install php5-curl

 

Update Drupal using Drush

First check to see what version of Drupal is installed.

# drush status

Enter maintenance mode

# drush vset --exact maintenance_mode 1

Clear the cache

# drush cache-clear all

Refresh Drush repository

# drush pm-refresh

Simulate update of Drupal to check for potential problems

# drush pm-update --simulate

Check to see if there are any available updates for Drupal

# drush up -n | grep available

Update Drupal

# drush pm-update

Once the update is complete exit maintenence mode

# drush vset --exact maintenance_mode 0

Clear the cache

# drush cache-clear all

Check to make sure Drupal has been updated

# drush status

                                                                                                                                          

Creating a MySQL database for CiviCRM (Optional at this stage)
With everything now up to date you can create a MySQL database for CiviCRM now or once your in the CiviCRM installer. If you would like to create a MySQL CiviCRM database from the CiviCRM installer you can skip this section.
Log into MySQL as root and create database for CiviCRM

# mysql -u root -p
mysql> create database civic;

mysql> grant all privileges on civic.* to civicu@localhost identified by 'your_password';

mysql> flush privileges;

mysql> exit

 

Download CiviCRM
Download CiviCRM from https://civicrm.org/download You can choose between the Long Term Support version (4.6+) or the Latest version (4.7+). It’s up to you to decide which version you would like to use either way the install process is the same. CiviCRM will be downloaded as a .tar.gz file and look something like this civicrm-4.6.xx-drupal.tar.gz.

 

Upload the civicrm-4.6.xx-drupal.tar.gz to your Turnkey Linux system
You can Upload the civicrm-4.6.xx-drupal.tar.gz using Filezilla or SSH if you wish but it would probably be easier for most people with minimal experience to use the Webmin file manager.
Once again the IP address for Webmin will vary depending on your network but you can get it from the Configuration Console of your Turnkey system, it should look something like this: https://192.168.xx.xxx:12321 We will still need to use Shell in a Box so open a new tab in your web browser for Webmin.
When you are logged into Webmin look in the Tools menu along the top left of the web browsers tab for the File Manager.                                                                                                                                        
Navigate to the following path, you want to be inside the modules folder: /var/www/drupal7/sites/all/modules

To upload the civicrm-4.6.xx-drupal.tar.gz file look for a green button with an up arrow in it along the top right of the web browser tab you have Webmin open in.
Click on it and you should see a small popup box appear with a 'Browse' button.
Click on the 'Browse' button and use the next window that appears to navigate to where you have the civicrm-4.6.xx-drupal.tar.gz file saved, select it, click 'Open' and then in the little box with the 'Browse' button click 'Okay.' The civicrm-4.6.xx-drupal.tar.gz file will then be uploaded to your Turnkey system.

 

Extract the civicrm-4.6.xx-drupal.tar.gz file
Once the upload is finished you will need to go back to the tab in your web browser that you have Shell in a Box open.
Enter into the folder that civicrm-4.6.xx-drupal.tar.gz was uploaded to.

# cd /var/www/drupal7/sites/all/modules

You should now be in the modules folder. Extract the civicrm-4.6.xx-drupal.tar.gz file with the following command. Do not forget to enter the correct version number pertaining to your download.

# tar -xzvf civicrm-4.6.xx-drupal.tar.gz

 

Edit Permissions
When the extraction has completed you will need to assign proper ownership to the civicrm folder that was created.
Change permissions of the civicrm folder

# chown www-data: -R civicrm/

Make the default directory writable

# chmod +w /var/www/drupal7/sites/default

or

Making the default folder writable can also be done in the Webmin file manager if you prefer.
Navigate to /var/www/drupal7/sites and selected the default folder.
Click on the icon that looks like 2 human busts, if you hold your mouse over it it should display a little popup that says "Chown Selected."
A small window will then pop up with 2 fields, one will say 'User Name' and the other will say 'Group Name' type www-data into both fields and click on the Change button to save the changes.

 

Start the CiviCRM Installer
Login to your Drupal site using the following address with Admin permissions: https://your_drupal_site/sites/all/modules/civicrm/install/index.php
The CiviCRM Installer should be visible. Don’t worry if you see a message saying “Your database settings don’t appear to be correct.” This is to be expected because you haven’t entered the database details yet.

If you did not create a MySQL database for CiviCRM at the start of this guide you can do it now just fill in the information you would like to use for your MySQL CiviCRM database.

If you did created a MySQL database for CiviCRM at the start of this guide then just enter the information for that database.

For the MySQL Drupal database enter the appropriate information for it here.

The Installer includes an option to load a set of sample contact, group, and relationship data by default. Sample data can provide a useful head-start in learning to use CiviCRM. This is optional you do not have to check the Load sample data option if you don’t want to.

Now, click 'Re-check requirements' button. If everything is OK, you will see green banners telling you 'You’re ready to install.' Click on 'Check Requirements and Install CiviCRM' after which the installer will configure your databases, create the settings file and redirect you to your Drupal Home page.

You can now access CiviCRM through a link in the left-hand navigation menu of the site or at the top of the screen in the Drupal menu bar to the right of the help menu.

Hope this helps.

Forum: 
Jeremy Davis's picture

I haven't read through it in detail, but it looks fantastic, thanks! :)

I've just lodged a feature request (on our issue tracker on GitHub) to convert your step-by-step into appliance build code so we can add it to the library for v15.0.

If you are all interested in having a go at it yourself, then please let me know and I'm more than happy to point you in the right direction and give you a hand as much as I can. We've got a number of new appliances being built at the moment, so the timing is pretty good.

evilrobot's picture

I am very interested in building a CiviCRM appliance. I'm just really busy this month so I won't be able to work on it very often, however things will free up quite a bit for me in September.

I'm still learning how to use CiviCRM but already there are some extensions for it that I would like to include in the appliance, civivolunteer being the main one. Others include civicrm donor statistics and commerce civicrm for Drupal commerce intergration which seem like they would be of value as well.

I still have the links you sent me.

https://github.com/turnkeylinux-apps/drupal7/blob/master/plan/main

https://github.com/turnkeylinux-apps/drupal7/blob/master/conf.d/main

https://github.com/turnkeylinux-apps/drupal7/tree/master/overlay

Any other links you can think of that might be helpful would be greatly appreciated.

Jeremy Davis's picture

So the first place to start (when you get there) is to just use TKLDev to build an ISO. We also have a doc page with links to all the other pages which are likely to be of value (some are a little dated, but most, if not all should still be relevant.

Regardless, the TKLDev docs themselves are arguably the most important (and are most likely to be up to date). Start off with the overview and once you're ready, move on to the development section. Probably the one you will be most interested in will be new app development, but I would suggest that you don't skip straight to it as you will mist other important info such as the section on git config.

You can safely avoid the "advanced" and "transition" sections as it's unlikely that they'll be relevant for you at this stage.

Add new comment