Skip to content

Instantly share code, notes, and snippets.

@snipe
Created February 16, 2013 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snipe/4965558 to your computer and use it in GitHub Desktop.
Save snipe/4965558 to your computer and use it in GitHub Desktop.
Initial setup for Linux server to prepare for CI using Jenkins and PHP unit tests
yum install openssl-devel git php ant php-xml php-devel gcc make gcc-c++ freetype-devel fontconfig-devel
# Install node.js
cd /usr/local/src
wget http://nodejs.org/dist/v0.8.15/node-v0.8.15.tar.gz
tar zxvf node-v0.8.15.tar.gz
cd node-v0.8.15
# Install npm and n for easier updating
ln -s /usr/local/bin/node /usr/bin/node
curl https://npmjs.org/install.sh | sh
npm install n -g
./configure
make
# pack a lunch - this will take a while
make install
# Install Java - SKIP THIS PART FOR STANDARD AWS LINUX
yum install java-1.6.0-openjdk
# Getcha some Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.reporpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
# Install xdebug
pecl install xdebug
# lots of output here
# Install composer
curl -s https://getcomposer.org/installer | php
# make composer available to all builds
mv composer.phar /usr/local/bin/composer
# Install Symfony 2 standards
pear config-show | grep php_dir
PEAR directory php_dir /usr/share/pear
# Start your engines
service jenkins start
# Install the Jenkins CLI tools
wget http://localhost:8080/jnlpJars/jenkins-cli.jar
# Install PEAR
wget http://pear.php.net/go-pear.phar
/usr/bin/php go-pear.phar
channel-discover pear.phpunit.de
pear config-set auto_discover 1
pear install pear.phpqatools.org/phpqatools pear.netpirates.net/phpDox
# I needed phpunit 3.4.1 for Zend Framework
# If you're using a framework, you should find out what version of
# phpunit it depends on, and use that.
pear install -a phpunit/PHPUnit-3.4.1
pear install pear.phpunit.de/phploc
pear install pdepend/PHP_Depend
pear install phpmd/PHP_PMD
pear install PHP_CodeSniffer
pear install phpunit/phpcpd
pear install phpunit/phpdcd-beta
# Change perms on session dir so jenkins can write to it
# Alternatively, you can just set php to use a custom session dir in php.ini
chmod -R 755 /var/lib/php/session
# Install plugins
# If you get a weird "short name" error here, break it up into multiple lines
# instead of putting all of the plugins on one line
java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin checkstyle cloverphp dry htmlpublisher jdepend plot pmd violations xunit github-api git multiple-scms parameterized-trigger token-macro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment