Skip to end of metadata
Go to start of metadata

Introduction

The introductory session is intended for programmers who are new to open-source programming on LAMP (Linux-Apache-MySql-PHP).

The idea for this session came about after a conversation at the CiviCRM European Code Sprint in December 2011. We felt that there are many developers out there who would love to learn CiviCRM but are not yet familiar with the LAMP environment. It makes sense to provide a "crash course" in LAMP and other open source tools.

Aimed at

A typical person would be someone with programming experience in another setting - perhaps as .NET or Java developer in an organization, or perhaps someone with HTML and Javascript skills. Typically, they would have reasonable developer skills but not in a Linux environment. They will also have curiosity and willingness to learn more about the open source world.

From the perspective of the CiviCRM project, we need more developers. These may not necessarily be from the Open Source world, but may come from company environments where their experience has been mostly Windows-based. This session is intended for those developers.

Learning points

  • participants will become familiar with installation of the LAMP stack.
  • participants will install Ubuntu and then Drupal and Drush.
  • participants will learn about Drupal's modular infrastructure, extending a Drupal installation with modules and themes.
  • participants will become familiar with the basics of module development with PHP.
  • participants will be able to checkout code from CVS and git.

Drupal crash course

This is a work in progress, with ideas for a training session for Windows developers new to Linux and Drupal. It can be considered as useful in its own right as not just as a starting point for CiviCRM development.

Of course, we ought to emphasise that CiviCRM works with Joomla and Wordpress also, and that in a sense Drupal is being used as an example because it is quite well-used in the CiviCRM community.

Get Ubuntu Linux. http://www.ubuntu.com/download. Download Ubuntu, not Ubuntu server. A nice option if you want to try Ubuntu and keep using your Windows machine as normal is the Windows Installer (Wubi).

If you get frozen screen with wubi:
http://ubuntuforums.org/showthread.php?t=1696717

Once you have Ubuntu installed: install LAMP (Linux-Apache-MySQL-PHP) - this will effectively create a development web server on your computer.

https://help.ubuntu.com/community/ApacheMySQLPHP#To_install_the_default_LAMP_stack_in_Ubuntu_7.04_.28Feisty_Fawn.29_Ubuntu_7.10_.28Gutsy_Gibbon.29_Ubuntu_8.04_LTS_.28Hardy_Heron.29.2C_8.10_.28Intrepid_Ibex.29.2C_9.04_.28Jaunty_Jackalope.29.2C_9.10_.28Karmic_Koala.29.2C_10.04_.28Lucid_Lynx.29_and_11.04_.28Natty_Narwhal.29

In Ubuntu, Ctrl Alt T to open a command window. Then type the following commands.
sudo apt-get install tasksel
sudo tasksel install lamp-server
This last command will launch a wizard which installs Apache, MySQL and PHP.

One thing to remember in general with Ubuntu:

sudo means "run the following command as a super user".
So if you try to run a command like mkdir foldername and you get a permission denied error, sudo mkdir foldername will usually work.

Once you have your LAMP installation done you should be able to go to http://localhost using Firefox and see an It Works! html page.

Install Drush. Drush stands for "Drupal Shell". It is a tool which allows you to install and manage Drupal very easily from the command line.

http://drupal.org/project/drush

cd /var/www
sudo drush dl
… will install drupal in /var/www/

Try to surf to localhost/drupal-7.9/ (or whatever drupal version you have downloaded to /var/www)

We encountered this error.
http://drupal.org/node/594728

Create the Drupal database in mysql

Go to Create the Drupal database on this page.
http://drupal.org/documentation/install/developers

Install Drupal
Go to Alternate: Bypassing the Wizard (and most other steps) with Drush
http://drupal.org/documentation/install/developers

Now, you should have a working Drupal site at http://localhost/drupal-7.x where drupal-7.x is the name of the folder within /var/www/ on your Ubuntu machine.

Next steps
Download and install modules with Drush
Learn the modules using nodeone.se screencasts
Download and install themes with Drush

When you want to put a website on a production server
Get an account with bluehost.com or similar web provider
Get ssh access to your web server

Version control
Get a github.com account
Install git on your local Ubuntu machine

Apache settings
/etc/apache2/
sudo a2ensite settingsfile

Linux tips
Command Line
ls -altr
history | grep 'search term'
grep -rin 'search term' .

Vim
vimtutor

Drupal module builder module, creates a skeleton module to start off with. Consider adding this to the Drupal Crash Course.

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.