Monday, 6 August 2018

How to Vagrant in SUSE Leap 15

Whenever I need to quickly setup some demo system on my laptop, vagrant has been my go to tools.

vagrant packages can be found in the following repositories:
http://download.opensuse.org/repositories/Virtualization:/vagrant/openSUSE_Leap_15.0/

By default, vagrant works well with virtualbox which is currently part of default openSUSE Leap 15.0.

Install virtualbox and add your current user to vboxusers. Assuming your username is called testuser, run the following command:

> sudo zypper in virtualbox
> sudo usermod -G vboxusers testuser

Logout and re-login again so that your OS reload user group information. You can verify that your user belongs to vboxusers by running the following command:

> id

Now the system is ready for vagrant. Add the repo above and install vagrant

> sudo zypper in vagrant

I usually make a separate directory to keep my demo environment.

> mkdir vagrant
> cd vagrant

You can easily download and startup another openSUSE Leap 15.0 using the following command:

> vagrant init opensuse/openSUSE-15.0-x86_64
> vagrant up
> vagrant ssh 

You will be login into your newly created VMs. 

I might be doing something wrongly, but when I try to initialized my VM, I notice that it is missing directories. I run the following to fix it:

> cd /usr/lib64/ruby/gems/2.5.0/gems/vagrant-2.1.2 
> ln -sf /usr/share/vagrant/plugins .
> ln -sf /usr/share/vagrant/templates .
> ln -sf /usr/share/vagrant/keys .

Let me know if anyone managed to run it without manually linking the directories. See you again in the next how to !!!

No comments:

Post a Comment