Cloud computing entry (a), using the virtual machine installed vagrant + virtualbox

A, vagrant and virtaulbox Profile

Vagrant is a Ruby-based tool for creating and deploying virtualized development environment, we can use it to dry these things as follows:

Create and delete virtual machines
configured virtual machine operating parameters
to manage virtual machines running state
auto-configuration and installation development environment
package and distribute virtual machine operating environment

Run Vagrant dependent specific virtualization technology, the most common are VirtualBox and VMWare. Because it has a cross-platform, mobile, automated deployment without human intervention and so on.

In Vagrant system, the concept of a Box (box), which advantages similar docker System Image (mirror).

Second, the installation vagrant + virtaulbox

virtualbox and vagrant version to match, are recommended to download the latest version.

1. Download and install virtualbox
Download: https: //www.virtualbox.org/wiki/Downloads
installation process is very simple, fool-point down step by step.

2. Download and install vagrant
Download: https: //www.vagrantup.com/downloads.html
installation process still is not that hard, follow the instructions step by step next.

Note: windows system, you may need to configure the environment variables and open VT-x / AMD-V hardware acceleration.

Third, the image registration centos7.6

Download: CentOS7 the box: http://cloud.centos.org/centos/7/vagrant/x86_64/images/

vagrant box add CentOS7.6 e:\dev\linux\vagrant\CentOS-7-x86_64-Vagrant-1905_01.VirtualBox.box

Fourth, edit the configuration file

1. Create a working directory
mkdir d: \ Vagrant
cd D: \ Vagrant

2, create a configuration vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version ">= 1.6.0"
boxes = [
{
:name => "k8s101",
:eth1 => "192.168.48.101",
:mem => "4096",
:cpu => "2"
},
{
:name => "k8s102",
:eth1 => "192.168.48.102",
:mem => "4096",
:cpu => "2"
},
{
:name => "k8s103",
:eth1 => "192.168.48.103",
:mem => "4096",
:cpu => "2"
},
{
:name => "ran200",
:eth1 => "192.168.48.200",
:mem => "4096",
:cpu => "2"
},
{
:name => "reg201",
:eth1 => "192.168.48.201",
:mem => "4096",
:cpu => "2"
}
]

Vagrant.configure(2) do |config|
config.vm.box = "CentOS7.6"
boxes.each do |opts|
config.vm.define opts[:name] do |config|
config.vm.hostname = opts[:name]
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", opts[:mem]]
v.customize ["modifyvm", :id, "--cpus", opts[:cpu]]
end
config.vm.network :private_network, ip: opts[:eth1]
end
end
end

3, the process of creating: vagrant up

4, allows password

Login username / password: root / vagrant, vagrant / vagrant

(1) modify / etc / ssh / sshd_config file
vi / etc / ssh / sshd_
note, vagrant user that the file is read-only, you may not see anything
modify ssd_config in PermitRootLogin property to yes, and in front of the # removed

PasswordAuthentication yes to remove the # and

save and exit
(2) to restart sshd service
systemctl restart sshd
time again by xshell connected, you can use the account password, root / vagrant to log the

Guess you like

Origin www.cnblogs.com/lexiaofei/p/11519505.html