This is how I run linux in my machine.
I'm using brew for the installation.
1. Make sure brew is installed
hit brew --version
in the terminal to see if brew is installed already. If there is no brew installed, let’s just add it into our machine.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Install VirtualBox
Run this command to add VirtualBox in our machine
brew install cask virtual box
Then check the installation using this command vboxmanage --version
3. Install Vagrant
Next, we will need Vagrant to help us running and getting in to the linux machine.
brew install vagrant
Then check the installation using vagrant --version
4. Let’s start the linux machine
These are the main things to run linux.
- Creating a Virtual Machine
vagrant init <boxpath>
You can choose linux version that you want. go to this source here.
In case we want to use ubuntu1804, we can type vagrant init ubuntu/bionic64
.
This command will generate a Vagrantfile for us.
- Starting a Virtual Machine
vagrant up
This command will start our linux machine in virtualbox. We can see if our machine is up already by typing this command.
vagrant status
- Getting into a Virtual Machine
vagrant ssh <boxname>
In this case, we only use default Vagrantfile which is generated from vagrant init <boxpath>
instead of set the box name. We can simply run vagrant ssh
to get into out VM.
Welcome to linux machine !!
- Stoping a Virtual Machine
vagrant halt
This will stop the VM. We can simply run vagrant resume
to start the VM again.
- Cleaning up a Virtual Machine
vagrant destroy
This command will delete the VM, and we need to run vagrant up
if we want to run the Linux machine again.
Top comments (0)