Menu Close

Installing Oracle Linux 8 on virtual box with just 3 commands.

Sounds fun, right? Yes you can install Oracle Linux’s latest version with just 3 commands.

For TL;DR : This can be achieved using vagrant.

Vagrant is an open-source software product developed by HashiCorp (Same company behind Terraform) for building and maintaining portable virtual software development environments.

Prerequisite

  • You should have VirtualBox and Vagrant installed on you machine, can be downloaded from here and here respectively.
  • Create a directory for your vagrant files and from within that directory, you will issue the 3 commands,

Installation

  • Creating init file
This initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile if one does not already exist.
 
Now you can create a vagrant box using any of available boxes in Vagrant Cloud which is a repository pre-built VM images like Gold Images. Tim from Oracle-Base have a great article about this, you can read that one here.
 
But in this blog I am using Oracle’s own box which is part of their GitHub repository
 
Depending on the version you need, you can choose the json file to create vagrantfile in your directory created as part of prerequisite. Currently Oracle provides 3 versions as below, you can check the updated files here.
 
  • Oracle Linux 8: https://oracle.github.io/vagrant-projects/boxes/oraclelinux/8.json
  • Oracle Linux 7: https://oracle.github.io/vagrant-projects/boxes/oraclelinux/7.json
  • Oracle Linux 6: https://oracle.github.io/vagrant-projects/boxes/oraclelinux/6.json

 

vagrant init oraclelinux/{release} <box json url>

Now you can see there will be a file created at your vagrant directory “C:/users/jit3n/vagrantOL8” (in my case). You can tweak that file you change things like, name, disk size, memory size of VM, Networking setting and many thing more depending on how good you are in vagrant.

If I remove all the comments my vagrant-file looks like this, you can keep it as it is if not sure about various settings. I just changed VM name, some IP configs.
 
  • Startup Machine
“vagrant up” that’s all you need to start machine. Just like that, and now you have your VM running in Virtual Box.
 
  • SSH into Machine
To ssh in to your VM, use ‘vagrant ssh’, you will be login as vagrant user which have sudo privilegs to do any admin tasks, or switch to other users including “root”.
Basic Admin tasks
#List all boxes downloaded
vagrant box list

#Remove a box
vagrant box remove <box name>

#Change state of a VM
vagrant halt
vagrant up
vagrant reload
vagrant destroy -f
explore completed vagrant documentation here.
~thank you for reading

Related Posts

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *