VirtualBox virtual machine (Oracle VM)

1. VirtualBox installation

(1) Software download address:

地址:https://www.virtualbox.org/wiki/Downloads

(2) Virtualization is enabled:

主板上bios设置

2. Vagrant: Tools for Building Virtual Development Environments

(1) Features

统一开发环境
避免重复搭建开发环境
多个相互隔离开发环境

(2) Download:

地址:https://www.vagrantup.com/downloads

(3) Installation:

vagrant_2.2.19_i686.msi

直接安装→选择路径→重启

(3) Test:

指令:vagrant

(4) Vagrant download and install the mirror: mirror warehouse

1. Create an environment

指令(CENTOS7):vagrant init centos/7

2. Download the image: install and start the system

指令:vagrant up

完成后:ctrl + C  暂停

3, start the system: start

方法1:指令:vagrant up
方法2:右击Oracle VM VirtualBox里面的系统

4. Connect SSH

指令:vagrant ssh

5. Restart the virtual machine

指令:vagrant reload

6. Exit the connection

指令:exit ;

(5) Vagrant problem: if there is a problem, delete the installation directory directly, do not change the ip! ! ! ! ! ! ! ! ! ! ! !

C:\HashiCorp\Vagrant\

3. Vagrant download and install the mirror: mirror warehouse

(1) Username

vargant

1. Display login user information

指令:W
指令:who
指令:last

(2) Authority

$ 	普通
# 	超级

1. Change permissions

指令:su
root默认密码:vagrant
vagrant默认密码:vagrant

2. Change the password

指令:sudo passwd root
输入新密码:2次

(3) Shut down

1. Shut down immediately

指令:poweroff
指令:shutdown -h now
指令:init 0

2. Restart

指令:reboot
指令:shutdown -r now
指令:init 6

Three, VirtualBox network virtual port forwarding

IP地址访问虚拟机内的应用

(1) Settings in the virtual machine

设置→网络→高级→端口转发→添加/修改

(2) File configuration settings

C:\Users\Administrator\Vagrantfile
 		# config.vm.network "private_network", ip: "192.168.33.10"
去掉#: config.vm.network "private_network", ip: "192.168.33.10"

更改ip:ipconfig查询本地虚拟机地址
再根据虚拟机本地ip进行更改——最后那组要不同
 192.168.56.1——> 192.168.56.10

Guess you like

Origin blog.csdn.net/qq_25482375/article/details/124057850