Skip to content

Instantly share code, notes, and snippets.

@sumitsaiwal
Last active January 23, 2018 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sumitsaiwal/1a8569395c0da2a975cb1214ba0cab25 to your computer and use it in GitHub Desktop.
Save sumitsaiwal/1a8569395c0da2a975cb1214ba0cab25 to your computer and use it in GitHub Desktop.
#jenkins_user=Admin/admin
#Password=cloud
sudo add-apt-repository -y ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates openjdk-8-jdk unzip
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y docker-engine
#sudo apt-get install -y docker-engine=1.13.1-0~ubuntu-xenial
sudo service docker start
sudo docker run --name demo hello-world
sudo groupadd docker
sudo usermod -aG docker $USER
#wget -P /home/sumit/ --no-check-certificate https://docs.google.com/uc?export=download&confirm=JE_a&id=0BxQmkXkVFaJAWjg4bDVJMjhjRlE
unzip -oq -d /home/sumit/.jenkins /home/sumit/jenkins.zip
#wget -P /home/sumit/ https://updates.jenkins-ci.org/download/war/2.19.3/jenkins.war
wget -P /home/sumit/ https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/2.19.3/jenkins-war-2.19.3.war
sudo tee /etc/systemd/system/jenkins.service <<-'EOF'
[Unit]
Description=Jenkins Daemon
[Service]
ExecStart=/usr/bin/java -jar /home/sumit/jenkins.war --httpPort=7777
User=sumit
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl start jenkins.service # starts the service manually
#sudo systemctl stop jenkins.service
#sudo systemctl restart jenkins.service
systemctl enable jenkins.service # enable the service to start with system startup;
# please note that it does not start the service instantly
#sudo systemctl disable jenkins.service # disable automatic start
# after successful run of this script, login to docker without being a root user, and in jenkins configurar=tion change the host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment