Getting Started with Vagrant on Windows 10
To get started, go ahead and install these tools:
- Mobaxterm (MobaXterm X server and SSH client)
- centos/7 CentOS Linux 7 x86_64 Vagrant Box
Create Your Projects
Now that you have it all set up, you can start your first Vagrant project by creating a project folder, which will house the various configurations for each of your VMs. You'll use the command line to run Vagrant commands from within these folders.
Create your first project folder and call it
As a Windows user, you can quickly open a command prompt to your project by holding down shift and right-clicking the project folder, then choose "Open MobaXterm terminal here".
By default, MobaXterm does not preserve Windows "PATH" environment variable: this is why you obtain "command not found" when running "javac". In order to tell MobaXterm to preserve Windows PATH, you just have to go to "Settings" --> "Configuration" --> "Terminal" tab and check "Append Windows PATH environment variable" option.
Modify Virtualbox default VM path
At the same time, set VAGRANT_HOME to the new path.
Using Vagrant with CentOS 7
First of all, type the following:
vagrant init centos/7
Now that you have a vagrant file, you can spin up the VM with this command:
vagrant up --provider virtualbox
If you want to download the vagrant box directly, just find the box versions page, and append the strings [/providers/virtualbox.box] to the link address.
Then, you can point to the folder where vagrant and copy the box file to same location. After you may run as follows:
vagrant box add custom-box-name name-of-the-box.box vagrant init custom-box-name vagrant up
- If you encounted the issue "could not be found or could not be accessed in the remote catalog", please refer to Can't download boxes on Windows 10
- The default memory is only 512, you'd better to adjust it in Vagrantfile
- Upgrade RHEL from 7.3 to 7.4: ArrayIndexOutOfBoundsException in sun.font.CompositeStrike.getStrikeForSlot If you get the trouble on setup Intellij idea like above, just run
sudo yum install -y dejavu-sans-fontsto solve this issue.
First, Type this to get your SSH info:
It will tell you the IP and SSH port to use and a few other bits of info.
Second, login the system via mobaxterm, and enter the follows in session settings:
- host ip
- private key
Now, you are in the system.
X11 Forwarding Configuration on Linux
# /etc/ssh/ssh_config for ssh client ForwardAgent yes ForwardX11 yes ForwardX11Trusted yes
# /etc/ssh/sshd_config for ssh server X11Forwarding yes X11UseLocalhost no
The “base” boxes are stored in the %userprofile%/.vagrant.d/boxes folder. These will be used over and over for any projects you create that use the same box.
If you destroy all VMs that use a certain box, this does not delete the box itself.
You can turn the VM off by using
vagrant halt, or suspend it with
vagrant suspend. Then turn it on again any time with
vagrant up. Type
vagrant status to see the current state of the VM.
All commands can be found here.