Created
August 6, 2020 00:32
-
-
Save kencoba/18eb7db2c00d917fe5ebe27b931c4899 to your computer and use it in GitHub Desktop.
Vagrantfile for Jenkins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "ubuntu/bionic64" | |
# for Jenkins 8080 -> 8090 | |
config.vm.network "forwarded_port", guest: 8080, host: 8090, host_ip: "127.0.0.1" | |
config.vm.network "private_network", ip: "192.168.33.12" | |
# config.vm.network "public_network" | |
config.vm.synced_folder ".", "/vagrant_data" | |
config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# vb.gui = true | |
vb.memory = "1024" | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
# To solve the issue of "vagrant@127.0.0.1: permission denied (publickey)." | |
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config; \ | |
sudo systemctl restart sshd; | |
apt-get update | |
# Install OpenJDK 11 (Jenkins officially supports versions 8 and 11.) | |
sudo apt-get install -y openjdk-11-jdk | |
# Step 1 - Install Jenkins | |
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - | |
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' | |
sudo apt update | |
sudo apt install -y jenkins | |
# Step 2 - Start Jenkins | |
sudo service jenkins start | |
# Install Maven | |
sudo apt-get install -y maven | |
# Install JUnit | |
sudo apt-get install -y junit4 | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment