Skip to content

Instantly share code, notes, and snippets.

@ionixjunior
Last active March 30, 2024 15:04
Show Gist options
  • Save ionixjunior/7432192 to your computer and use it in GitHub Desktop.
Save ionixjunior/7432192 to your computer and use it in GitHub Desktop.
Jenkins Server script installation.
#!/bin/bash
# Dependences and tools
apt-get -y install php-pear
apt-get -y install php5-mysql
apt-get -y install php5-memcache
apt-get -y install php5-imagick
apt-get -y install php5-curl
apt-get -y install php-apc
apt-get -y install php5-sqlite
apt-get -y install php5-xsl
apt-get -y install php5-xdebug
apt-get -y install php5-intl
apt-get -y install ant
apt-get -y install git
apt-get -y install svn
apt-get -y install graphviz
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
pear install PHP_CodeSniffer
wget https://phar.phpunit.de/phploc.phar
chmod +x phploc.phar
mv phploc.phar /usr/local/bin/phploc
wget http://static.pdepend.org/php/latest/pdepend.phar
chmod +x pdepend.phar
mv pdepend.phar /usr/local/bin/pdepend
pear channel-discover pear.phpmd.org
pear channel-discover pear.pdepend.org
pear install --alldeps phpmd/PHP_PMD
wget https://phar.phpunit.de/phpcpd.phar
chmod +x phpcpd.phar
mv phpcpd.phar /usr/local/bin/phpcpd
wget http://phpdoc.org/phpDocumentor.phar
chmod +x phpDocumentor.phar
mv phpDocumentor.phar /usr/local/bin/phpdoc
# Jenkins
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
apt-get -y update
apt-get -y install jenkins
service jenkins start
sleep 60
# Install plugins
curl -L http://updates.jenkins-ci.org/update-center.json | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://127.0.0.1:8080/updateCenter/byId/default/postBack
wget http://127.0.0.1:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar -s http://127.0.0.1:8080 install-plugin checkstyle cloverphp crap4j dry htmlpublisher jdepend plot pmd violations xunit
java -jar jenkins-cli.jar -s http://127.0.0.1:8080 safe-restart
sleep 60
# Configuration template for PHP
mkdir /var/lib/jenkins/jobs/php-template
wget -P /var/lib/jenkins/jobs/php-template/ https://raw.github.com/sebastianbergmann/php-jenkins-template/master/config.xml
chown -R jenkins:jenkins /var/lib/jenkins/jobs/php-template/
java -jar jenkins-cli.jar -s http://127.0.0.1:8080 reload-configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment