Press "Enter" to skip to content

Running Jenkins CI for PHP on Amazon EC2 [5/7]

Last updated on January 11, 2012

Continued from Connecting to Amazon EC2 using PuTTY

Installing and Configuring Jenkins CI

  1. Connect to your Amazon EC2 image as per Connecting to Amazon EC2 using PuTTY
  2. In the SSH window, run: sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  3. In the SSH window, run: sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
  4. In the SSH window, run: sudo yum install jenkins
  5. In the SSH window, run: sudo service jenkins start
  6. Whilst we are waiting for Jenkins to start up, we can install PHP and associated modules
  7. In the SSH window, run: sudo yum install php git
  8. In the SSH window, run: wget http://pear.php.net/go-pear.phar;sudo php go-pear.phar
  9. You will be prompted if you want to make any changes to the PEAR installation. Select to change the “Installation base ($prefix)” 1 to /usr
  10. You will be prompted if “Would you like to alter /etc/php.ini”, select “Yes”
  11. In the SSH window, run: sudo pear config-set auto_discover 1
  12. sudo yum install php-devel gcc make ImageMagick ImageMagick-devel php-dom php-pdo dbus-devel libxml2 libxml2-devel ant php-mbstring swig

  13. In the SSH window, run: sudo pecl install xdebug channel://pecl.php.net/dbus-0.1.1
  14. In the SSH window, run: sudo pear install pear/XML_RPC2 pear.phpqatools.org/phpqatools PHPDocumentor pear.phpunit.de/PHPUnit channel://pear.php.net/Text_Highlighter-0.7.1 channel://pear.phpundercontrol.org/phpUnderControl-0.6.1beta1 channel://pear.php.net/HTTP_Request2-2.0.0RC2 channel://pear.php.net/Net_URL2-0.3.1 pear.pdepend.org/PHP_Depend phpunit/PHP_CodeBrowser channel://pear.docblox-project.org/docblox-0.15.1
  15. In the SSH window, run: sudo su
  16. In the SSH window, run: echo 'zend_extension="/usr/lib64/php/modules/xdebug.so"' >> /etc/php.ini
  17. In the SSH window, run: echo 'extension=dbus.so' >> /etc/php.ini
  18. In the SSH window, run: echo 'date.timezone="Etc/UTC"' >> /etc/php.ini
  19. In your web browser, go to http://ec1-23-456-78-901.xx-yyyy-1.compute.amazonaws.com:8080 (where http://ec1-23-456-78-901.xx-yyyy-1.compute.amazonaws.com is the hostname of your Amazon EC2 image)
  20. Click “Manage Jenkins” on the left hand side and then select “Configure system” (in Chrome, you may get the “LOADING…” grey screen covering most things for a long time, just try a different browser)
  21. Select “Enable security”
  22. Under “Access Control->Security Realm” select “Jenkins’s own user database” and tick the “Allow users to sign up”
  23. Under “Authorization” select “Matrix based security”
    • Along side “Anonymous” select “Overall->Read”
    • In “User/group to add” add your preferred username and click “Add”
    • Give yourselves full access by checking the entire row
  24. Scroll down and click “Save”
  25. From the home page of Jenkins click “Sign-up now”
  26. Enter the same username as you did before and your preferred password, name and email address. Click “Sign up”
  27. Once you’ve logged back in, select “Manage Jenkins” and “Manage Plugins”
  28. Select “Available” and check the following plugins:
    • Checkstyle
    • Clover PHP
    • DRY,
    • JDepend
    • Plot
    • PMD
    • Violations
    • Analysis Collector Plugin
    • xUnit

    If you are developing using GitHub, also select “Github Plugin”

  29. Scroll down and click “Install”
  30. Wait and then select “Restart Jenkins when no jobs are running”
  31. Wait whilst Jenkins restarts
  32. Go back to “Manage Jenkins->Configure System”
  33. Scroll down to “Ant” and “Add Ant” and call it “Ant” and select “Install automatically”
  34. Under the “E-mail notification” under the “Default user e-mail suffix” and “@” followed by your domain name and your email address under “System admin e-mail address”
  35. Click Save
  36. Continued in Make a backup of the Amazon EC2 configuration