WINDOWS7五步快速搭建Centos7环境

2021-12-17 12:17:53 浏览数 (1)

下载VirtualBox并安装:

代码语言:javascript复制
https://www.baidu.com/link?url=9delYKQ6ORC2fJwk6glYdpQQpOlr6h4YHHRWQ0IK_dmFEf1Td3K28obPy-o7Ymfwy9dKK00PsW-pRHZjKycAqP9dxdyHKY2C3EhnKQqzNb_&wd=&eqid=8e13ced40000aa9c000000025ade9aed 

2.下载Vagrant并安装:

代码语言:javascript复制
https://releases.hashicorp.com/vagrant/2.0.4/vagrant_2.0.4_x86_64.msi 

3.在任意空目录下通过Vagrant初始化Centos7

vagrant init centos/7

出现以下则表示初始化成功:

代码语言:javascript复制
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

4.安装Centos7并启动

vagrant up

出现以下内容则表示安装并启动成功:

代码语言:javascript复制
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' is up to date...
==> default: Setting the name of the VM: docker-node1_default_1524538386737_11529
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Rsyncing folder: /cygdrive/c/A/vmimage/docker-node1/ => /vagrant

5.SSH连接并进入虚拟机:

代码语言:javascript复制
vagrant ssh

出现以下命令行则表示连接成功:

vagrant@localhost ~$

这就已经连接到Centos下,可以进行相关操作

版权属于:逍遥子大表哥

本文链接:https://cloud.tencent.com/developer/article/1920462

按照知识共享署名-非商业性使用 4.0 国际协议进行许可,转载引用文章应遵循相同协议。

0 人点赞