Skip to content

Instantly share code, notes, and snippets.

@fforbeck
Last active December 17, 2015 10:18
Show Gist options
  • Save fforbeck/5593255 to your computer and use it in GitHub Desktop.
Save fforbeck/5593255 to your computer and use it in GitHub Desktop.
Setup Jenkins Environment on Ubuntu 13.04
## Default setup: http://pkg.jenkins-ci.org/debian/
## Setup with oracle-jdk, mvn3, git, nginx and useful jenkins plugins
Remove OpenJDK first if installed by this command:
sudo apt-get purge openjdk*
Then add the Webupd8 Team PPA repository and then reload the packages:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer // <6, 7, 8>
Installing maven 3
sudo apt-get install maven
If you get the error:
Errors were encountered while processing:
/var/cache/apt/archives/libwagon2-java_2.2-3+nmu1_all.deb
Then a quick fix:
sudo dpkg -i --force-all /var/cache/apt/archives/libwagon2-java_2.2-3+nmu1_all.deb
Installing NGINX
sudo apt-get install nginx
Setup reverse proxy:
cd /etc/nginx/sites-available
sudo rm default
sudo vim /etc/nginx/nginx.conf
Include the following content after 'include /etc/nginx/sites-enabled/*;':
##
# Reverse proxy port 80 to port 8080 for Jenkins
##
server {
listen 80 default;
server_name _;
location /{
proxy_pass http://127.0.0.1:8080;
}
}
Installing Jenkins
sudo apt-get install jenkins
Just in case you need to remove and install a new one
sudo apt-get remove jenkins
sudo apt-get purge jenkins
Then I:
sudo apt-get update
sudo apt-get install jenkins
Adding Security
Allow only logged in users to manage the system:
Jenkins -> Manage Jenkins -> Configure Global Security. The check the box next to “Enable Security”. Under Access Control select “Jenkins’s own user database” Under Authorization select “Anyone can do anything” for now. Click on save.
Once that’s enabled, go to Jenkins -> Manage Jenkins -> Manage Users. Create a user account and proceed to login with that username. Then navigate back to Jenkins -> Manage Jenkins -> Configure Global Security.
user admin: all permissions;
user anonymous: read only permissions;
Under Access Control select “Matrix-based Security”. Create an entry for the user just created, then click on the little icon next to the red X, which toggles all the checkboxes at once. Click save or apply.
Installing Git
sudo apt-get install git
git config --global user.name "Jenkins"
git config --global user.email "jenkins@<yourdomain>"
Setup GitHub
sudo su jenkins
ssh-keygen -t rsa
(don't forget to let the passphrase empty)
copy the content from 'cat /var/lib/jenkins/.ssh/id_rsa.pub' and add the key on github account.
ssh [email protected] //to authenticate
Jenkins -> Manage Jenkins:
Set your SCM to Git and add your Repository URL and add an specific branch if you need.
Installing new Plugins:
mailer
external-monitor-job
ldap
pam-auth
ant
javadoc
cvs
chucknorris
audit-trail
jquery
jquery-ui
depgraph-view
python
subversion
translation
credentials
github-api
ssh
sounds
embeddable-build-status
maven-plugin
analysis-core
ci-game
git-client
git
github
cobertura
throttle-concurrents
view-job-filters
ssh-credentials
ssh-slaves
greenballs
cron_column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment