-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantCommand
More file actions
58 lines (40 loc) · 1.76 KB
/
VagrantCommand
File metadata and controls
58 lines (40 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# download and store Vagrant box on local system
# source: https://app.vagrantup.com/boxes/search
vagrant box add jasonc/centos7
# Create a folder for Vagrant project
mkdir testbox01
# Create Vagrant configure file, be sure you're at the Vagrant project folder
cd testbox01
vagrant init jasonc/centos7
# This initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile if one does not already exist.
# create virtual machine and start it
vagrant up
# This command creates and configures guest machines according to your Vagrantfile.
# Open virtualbox; confirm That It's Running
# This command confirms the status as well
vagrant status
C:\Users\lingx\OneDrive\Documents\shellscripting\testbox01>vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
# ssh to the vm
vagrant ssh
C:\Users\lingx\OneDrive\Documents\shellscripting\testbox01>vagrant ssh
[vagrant@localhost ~]$
# Now you are connected to the Linux virtual machine as the vagrant user. The vagrant user has full sudo (administrative) privileges
# Exit the vm
[vagrant@localhost ~]$ exit
# run "vagrant halt" followed by "vagrant up" to activate any change from vagrantfile
vagrant halt
# or use "vagrant reload" to restart the vm and load the new configuration
vagrant reload
# command to destroy VM
vagrant destroy
# directory of the VM
# test1: Mounting shared folders...
# test1: /vagrant => C:/Users/lingx/OneDrive/Documents/shellscripting/multitest
# local: C:/Users/lingx/OneDrive/Documents/shellscripting/multitest
# VM: /vagrant