Vagrant for Jenkins on Ubuntu
A simple Vagrantfile you can use to set up Jenkins and start using it.
examples/vagrant-jenkins-ubuntu/Vagrantfile
# vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/cosmic64" config.vm.network "forwarded_port", guest: 8080, host: 8080, host_ip: "127.0.0.1" config.vm.provision "shell", inline: <<-SHELL apt-get update apt-get upgrade -y wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' apt-get update apt-get install -y openjdk-8-jre apt-get install -y jenkins SHELL end
- Create an empty directory.
- Copy the above file to it as Vagrantfile.
- Install Vagrant and VirtualBox if you don't have them yet.
- cd to the directory and run vagrant up. It will take a while to download the image and then to install Jenkins in the image.
- Then on your computer browse to http://localhost:8080/ It will want to get a secret code.
- On the command line type int vagrant ssh this will ssh into the VirtualBox running Jenkins
- type sudo cat /var/lib/jenkins/secrets/initialAdminPassword to get the secret, copy that secret to the browser
- Install the defaults, create a user for yourself.
- At this point I got a blank page (seems to be some bug) so I switched back to the terminal and restarted the machine by typiing in sudo reboot.
- Once the machine started again you can reload the page in the browser and it will (most likely) show you the login page of Jenkins.
Published on 2019-02-15
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post