Set up a CentOS virtual server with Vagrant
What is Vagrant
A command line tool for easily building virtual machines and managing virtual machines so that the same environment can be reproduced anywhere.
procedure
Procedure to install in Windows (64bit) environment
1. Install VirtualBox and Vagrant
DL and install each installer from the following URL.
- Vagrant
https://www.vagrantup.com/downloads.html - VirtualBox
https://www.virtualbox.org/wiki/Downloads
After installation, restart your PC and check the version at the command prompt.
>vagrant -v
Vagrant 2.1.2
2. Search for the Box you want to make
Search for the Box file to install at https://app.vagrantup.com/boxes/search.
For example, for CentOS, “bento / centos-7.3”.
3. Initialize Vagrant
First, create a dedicated folder
mkdir centos7
Initialize Vagrant
#This command is "2.You can check it with "Search for the Box you want to make"
vagrant init bento/centos-7.3
→ OK when Vagrantfile is created in the centos7 folder.
4. Edit Vagrantfile
~
config.vm.box = "bento/centos-6.7"
#↑ Here, the Box name specified at the time of vagrant init is set.
~
config.vm.network "private_network", ip: "192.168.33.10"
#↑ Uncomment here and use your favorite IP address
~
4. Start the virtual machine
vagrant up
5. Log in to the virtual machine
Log in from an SSH client such as Rlogin.
–Destination host name
IP address written in Vagrantfile (192.168.33.10)
–Port
No. 22
–Username / Password
vagrant / vagrant
root / vagrant