installing jenkins. sudo su before this

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list
apt-get update
apt-get install jenkins

check your jenkins dashboard: yourserver.com:8080 Add admin user, uncheck “allow users to sign up”, configure matrix-based security, install git and bitbucket plugin.

now, let’s download and install glassfish 4.1

wget http://download.java.net/glassfish/4.1.1/release/glassfish-4.1.1.zip

sudo unzip glassfish-4.1.1.zip -d /opt

add glassfish to PATH variable

export PATH=/opt/glassfish4/bin:$PATH

run test domain, and wait for it to start, and then stop it

asadmin start-domain
asadmin stop-domain

now let’s create our domain, and set admin user/password for it

asadmin create-domain yourdomain

glassfish will choose random port, because jenkins already took 8080, so now we can run them together on one instance.