Create SLES 15 SP4 Vagrantbox
Vagrant is very popular, especially for development purposes. Unfortunately, SUSE has decided to no longer offer such boxes for SLES 15 SP4 - for the previous releases SP2 and SP3 there were still corresponding downloads. An inquiry with the support has confirmed this assumption - unfortunately a corresponding reference is missing in the Release Notes.
If you need such a Vagrantbox, you can use the templates of the generic project to build your own Vagrantboxes with Packer. Another less time-consuming and complex option is to update the existing SP3 Vagrantbox.
This is done by downloading the last SP3 vagrantbox and importing it:
1$ vagrant box add sles15-sp3 SLES15-SP3-Vagrant.x86_64-15.3-$provider-QU4.vagrant.$provider.box
$provider
should be replaced with the appropriate provider, for example libvirt
. At the time of article publication, QU4 was the current image.
Then the following vagrantfile
is created:
1Vagrant.configure("2") do |config|
2 config.ssh.insert_key = false
3
4 config.vm.define :test_vm do |test_vm|
5 test_vm.vm.box = "sles15-sp3"
6 end
7end
As usual the VM is created with vagrant up
, with vagrant ssh
a SSH connection is established.
Then the VM is registered and updated:
1# SUSEConnect -e <email> -r <registration_code>
2# zypper up
3# reboot
After a reboot, the service pack will be updated:
1# zypper in zypper-migration-plugin
2# echo 'installRecommends=false' >> /etc/zypp/zypp.conf
3# zypper migration
4# reboot
Finally, some important tools missing in the original Vagrantbox are added:
1# zypper in rsync nfs-client bzip2
When creating a VirtualBox Vagrantbox, the guest extensions still need to be updated. To do this, the make
, perl
, gcc
and kernel-default-devel
packages must be installed and the appropriate ISO inserted. A virtual CD/DVD drive must also be configured for this purpose.
The SP migration may have created orphaned packages (e.g. old Python 2.7 installation), these can be detected and removed as follows:
1# zypper pa --orphaned
2# zypper remove -u <pkg>
Before creating the Vagrantbox, the Zypper cache must be removed and the machine deregistered:
1# zypper clean ; rm -Rf /var/cache/zypp/*
2# SUSEConnect -d --cleanup ; rm -f /etc/SUSEConnect
3# rm -f ~/.bash_history ; exit ; sudo rm -f ~/.bash_history ; exit
Now the vagrantbox can be created:
1$ vagrant package --output SLES15-SP4-Vagrant.libvirt.box
Finally, a new .box
file can be found in the current folder, which again can be imported:
1$ vagrant box add sles15-sp4 SLES15-SP4-Vagrant.libvirt.box
It's a pity that SUSE creates unnecessary additional work for the user here.