For automation of all of my processes I need Jenkins in my development server. First I had installed Jenkins as Docker container via Vagrant Docker provider. But with this architecture it was very complicated to create docker images and run Docker containers on the Docker host, in this case my Vagrant Virtualbox. So for simplification I have decided to install Jenkins with the provisioning of the Vagrant Virtualbox via a shell provider in my Vagrantfile.
...
# persistant storage for jenkins
config.vm.synced_folder "C:\\shared\\virtual_storage\\jenkins_home", "/var/lib/jenkins", type: "nfs", owner: 994, group: 992, create: true
...
# install jenkins
config.vm.provision :shell, :path => "add_jenkins.sh"
...
-
First I map a shared folder of my Windows Host to the Vagrant Virtualbox to persist my Jenkins Configuration.
-
Then I install Jenkins via the shell script add_jenkins.sh.
sudo yum -y install java
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum -y install jenkins
sudo sed -i -e 's/JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"/JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"/g' /etc/sysconfig/jenkins
sudo service jenkins start
-
Jenkins requires java, so I install it first.
-
After that I get the latest Long-Term Support (LTS) repository, import it and install Jenkins from there.
-
Then I do some configuration, which I need for my jobs and start Jenkins.
-
An open issue is, that I have to restart Jenkins after Vagrant restart, because the shared folders are unfortunatly mounted after service starts.
After first install you have to enter the credential information from the filesystem as requested, all later installations use the persistent Jenkins configuration, so you can login and start from where you have left Jenkins.
Here you find the source code for this blog.
Here you find more about the topic "Virtual Development Server".
That’s it!