Monday, 08 February 2010

Below you'll find my slides for the presentation at fosdem 2010

Setting up a new machine to be able to do drupal development often takes a lot of time, googling and tweaking. To ease that process i've created a automated installation process which takes you up to speed in roughly 20 minutes.
The whole installation process is split up in three different steps.

  • Setup Lamp Server
  • Setup Drush
  • Setup Eclipse

These steps have been automated based on a freshly installed Ubuntu 9.04.
Just run the following code and follow the trivial installation steps.

SETUP UBUNTU

  1. mkdir ~/bin
  2. cd ~/bin
  3. wget http://krimson.be/sites/default/files/setup_ubuntu.sh && chmod +x setup_ubuntu.sh && ./setup_ubuntu.sh

SETUP DRUSH

  1. cd ~/bin
  2. wget http://krimson.be/sites/default/files/setup_drush.sh && chmod +x setup_drush.sh && ./setup_drush.sh
  3. . ~/.profile

SETUP ECLIPSE

  1. cd ~/bin
  2. wget http://krimson.be/sites/default/files/setup_eclipse.php.txt && mv setup_eclipse.php.txt setup_eclipse.php && chmod +x setup_eclipse.php && ./setup_eclipse.php

Please go through the last slides for some extra manual steps to give even more power in drupal,eclipse and firefox

I'll paste the current version of those scripts here for further reference and discussion.

setup_ubuntu.sh : SETUP Drupal friendly LAMPSERVER in Ubuntu

  1. #PREPARE ubuntu dev machine
  2. sudo apt-get update
  3. #sudo apt-get upgrade
  4. sudo tasksel install lamp-server
  5. sudo apt-get install phpmyadmin
  6. sudo apt-get install php5-cli
  7. sudo apt-get install curl php5-curl
  8. sudo apt-get install php5-xdebug
  9. sudo apt-get install subversion
  10. sudo sed -i 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini
  11. sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 128M/' /etc/php5/apache2/php.ini
  12. sudo sed -i 's/post_max_size = .*/post_max_size = 256M/' /etc/php5/apache2/php.ini
  13. #for installing PECL libs
  14. sudo apt-get install php5-dev php-pear
  15. #better uploadprogress bar
  16. sudo pecl install uploadprogress
  17. sudo sed -i '/; extension_dir directive above/ a\
  18. extension=uploadprogress.so' /etc/php5/apache2/php.ini
  19. #cleanurl
  20. sudo sed -i 's/AllowOverride (None)/AllowOverride All/' /etc/apache2/sites-available/default
  21. sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart

TEST Point your browser at http://localhost and Apache will tell you it's working

setup_drush.sh : SETUP Drush in Ubuntu

  1. #default directory structure
  2. DEFAULT_WORKSPACE=$HOME/workspace
  3. if [ ! -d "$DEFAULT_WORKSPACE" ];then
  4. echo "create workspace folder"
  5. mkdir $DEFAULT_WORKSPACE
  6. fi
  7. cd $DEFAULT_WORKSPACE
  8. #install drush
  9. #NOTE : WHEN changing the drush folder, also update the $PROFILE_PATH
  10. DRUSH_ROOT=$DEFAULT_WORKSPACE/drush
  11. PROFILE_PATH='\n # set PATH so it includes drush if it exists \n
  12. if [ -d "$HOME/workspace/drush" ] ; then \n
  13. \t PATH="$HOME/workspace/drush:$PATH" \n
  14. fi \n'
  15. DRUSH_VERSION=2.1
  16. DRUSH_TGZ=drush-All-Versions-$DRUSH_VERSION.tar.gz
  17. if [ ! -d "$DRUSH_ROOT" ];then
  18. echo "grabbing drush"
  19. wget http://ftp.drupal.org/files/projects/$DRUSH_TGZ
  20. if [ -a "$DRUSH_TGZ" ];then
  21. tar -zxvf $DRUSH_TGZ
  22. rm $DRUSH_TGZ
  23. else
  24. echo "ERROR : unable to download $DRUSH_TGZ"
  25. fi
  26. fi
  27. if grep -q drush ~/.profile
  28. then echo 'DRUSH already in path'
  29. else echo -e $PROFILE_PATH >> ~/.profile
  30. source ~/.profile
  31. echo '
  32. ----------------------------------------------------------------------
  33. | Please update your path by reloading your .profile. |
  34. | Just run the command at the bottom from your terminal. |
  35. | Note : this will only work in current shell. if you want a decent |
  36. | DEV environment, you should logout/login. |
  37. | |
  38. | the command to run : |
  39. | |
  40. | . ~/.profile |
  41. ----------------------------------------------------------------------
  42. '
  43. fi

TESTRun the command 'drush' from the commandline and retrieve info about most common drush commands.

setup_eclipse.php : SETUP Eclipse 3.5 in Ubuntu

  1. #!/usr/bin/php -q
  2. <?php
  3. $ECLIPSE_DOWNLOAD_URL="http://d2u376ub0heus3.cloudfront.net/technology/epp/downloads/release/galileo/SR1/eclipse-php-galileo-SR1-linux-gtk.tar.gz";
  4. $ECLIPSE_TAR_NAME=basename($ECLIPSE_DOWNLOAD_URL);
  5. $ECLIPSE_NEW_FOLDER_NAME="eclipse-pdt-galileo";
  6. $ECLIPSE_BIN_FILE="eclipse";
  7. echo "#Install JAVA Runtime\n";
  8. passthru("sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts");
  9. echo "#Get Eclipse ("+$ECLIPSE_NEW_FOLDER_NAME+") \n";
  10. passthru("mkdir -p ~/bin/packages");
  11. // Download it - if needed
  12. exec("rm " . $ECLIPSE_DOWNLOAD_URL ."*");
  13. if (!file_exists($ECLIPSE_TAR_NAME)) {
  14. exec("wget " . $ECLIPSE_DOWNLOAD_URL);
  15. if (file_exists($ECLIPSE_TAR_NAME)) {
  16. echo "Downloading " . $ECLIPSE_TAR_NAME . " was successful.";
  17. }
  18. else {
  19. echo "Unable to download $ECLIPSE_TAR_NAME from ". $ECLIPSE_DOWNLOAD_URL;
  20. }
  21. }
  22. system("mv " . $ECLIPSE_TAR_NAME . " ~/bin/packages/");
  23. system("cd ~/bin/packages/ && tar -zxvf $ECLIPSE_TAR_NAME && rm $ECLIPSE_TAR_NAME && mv eclipse $ECLIPSE_NEW_FOLDER_NAME");
  24. if (!file_exists($ECLIPSE_BIN_FILE)){
  25. $fh = fopen($ECLIPSE_BIN_FILE, 'w') or die("can't open file $ECLIPSE_BIN_FILE\n");
  26. $stringData = "#/bin/bash\n";
  27. fwrite($fh, $stringData);
  28. $stringData = "export GDK_NATIVE_WINDOWS=1\n";
  29. fwrite($fh, $stringData);
  30. $stringData = "`~/bin/packages/$ECLIPSE_NEW_FOLDER_NAME/eclipse -data ~/eclipse-workspace -vmargs -Xms128M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=512M &> /dev/null` & \n";
  31. fwrite($fh, $stringData);
  32. fclose($fh);
  33. system("chmod u+x eclipse && mv eclipse ~/bin/eclipse") ;
  34. }
  35. ?>

TESTLaunch eclipse from the commandline by running 'eclipse'.
For more mouse oriented people, drag 'n drop the eclipse command onto your top-panel.

File attachment: 

Written byRoel De Meester

This Open Source Evangelist is extremely serious. How serious you ask? He obtained a Masters in Quantum Physics (aka stuff only he understands), bailed out of his PhD studies to obtain a Masters in IT instead and finally ended up saying 'yes' when Dries 'Drupal' Buytaert asked him to maintain DRUPAL.be. Known for his communication skills and no-nonsense style (make it work - and keep it running) he comes up with solutions for problems the client has never even thought of. He also provides all Krew members with shoulder taps and weekly massages. After all, Drupal is about sharing, isn't it?

pdf corrupt?

hi, brilliant write-up, thanks!
i can't seem to open your pdf, file corrupt?

Pdf is corrupt

Indeed. the pdf is corrupt I will search for replacement asap

Drubuntu

I just discovered the Drubuntu project http://drupal.org/project/drubuntu
which seems to be doing roughly the same stuff.

Have to check if it's interesting to join forces.

New drush version

Drush 3.0 currently is the most recent version.

So in the script, you can change:

  1. DRUSH_VERSION=3.0
  2. DRUSH_TGZ=drush-All-versions-$DRUSH_VERSION.tar.gz

Change BOTH the version (2.1 => 3.0)
and the basic name (note the 'version' - was 'Version')

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h4> <br>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.
QR-code Krimson Antwerpen

Antwerp

Zénobe Grammestraat 34
2018 Antwerp, Belgium
Call us: +32 (0)3 298 69 98
E-mail us: info@krimson.be
QR-code Krimson Gent

Ghent

Hof ter Dampoort
Dendermondsesteenweg 48A - 101
9000 Gent, Belgium
E-mail us: info@krimson.be

Contact us

By submitting this form, you accept the Mollom privacy policy.