Linux虚拟机的启动及相关命令
1.Linux是什么?作为一名初学者,我之前也简单的认为它是一个类似Windows的操作系统,但后来经过进一步学习,才知道,Linux是内核,Linux内核加上GUN所组织的软件才是Linux操作系统,Linux中比较出名的有Redhat、Ubuntu等。Linux的开源环境导致它在企业的运用中很受欢迎。
2.在以后,为了防止误删本机的相关配置文件,我将在虚拟机中进行以后的操作,那么应该如何打开虚拟机?这就需要打开终端,单击鼠标右键–>选择open in terminal,进入终端。
在启动虚拟机时会用到4个命令:
rht-vmctl start desktop
rht-vmctl view desktop
rht-vmctl reset desktop
rht-vmctl poweroff desktop
1.rht-vmctl start desktop:
- 这条命令在启动虚拟机时使用,在终端中输入这条指令,会在linux操作系统中启动虚拟机,但在启动虚拟机后不会在桌面上显示出来,而需要输入下面的指令。
2.rht-vmctl view desktop:
- 这条命令或显示打开的虚拟机,若没有打开虚拟机直接执行该指令则会提示用户输入错误:
Error: unable to view server - not currently running
- 若已经有虚拟机之前已经启动,则再次启动时会提示用户输入错误:
Error: desktop not started (is already running)
3.rht-vmctl reset desktop
- 若对虚拟机执行操作时不小心删除了用户配置文件中的一些东西,导致虚拟机不能正常启动则需要重置虚拟机,在终端中输入第三条命令后便可重置虚拟机。类似于手机中的恢复出场设置
4.rht-vmctl poweroff desktop
- 在终端中输入这条指令后可以关闭虚拟机
在输入相关指令时发生了错误会导致虚拟机不能正常运行,在下面我稍微总结了几类常见的错误:
1.rht-vmct view desktop(命令错误)
计算机会提示用户输入命令有误:
bash: rht-vmct: command not found...
2.rht-vmctl vie desktop(参数错误)
终端会提示用户输入有误:
Error: bad option, sta
This utility manages the Red Hat Training supplied VMs on the local
hypervisor.
Usage: rht-vmctl [-q|--quiet] VMCMD VMNAME
rht-vmctl -h|--help
where VMCMD is one of:
reset - poweroff, return to saved or original state, start VMNAME
view - launches console viewer of VMNAME
start - obtain and start up VMNAME
stop - stop a running VMNAME
poweroff - if running, force stop VMNAME
save - stop, backup image, start VMNAME
restore - poweroff, restore image, start VMNAME
fullreset - poweroff, reobtain from server, start VMNAME (bad save/image)
get - if not here, obtain VMNAME from server
status - display libvirt status of VMNAME
3.rht-vmctl start serve(虚拟机名称有误)
提示用户输入有误:
Error: unrecognized VMNAME specified, serve.
This utility manages the Red Hat Training supplied VMs on the local
hypervisor.
Usage: rht-vmctl [-q|--quiet] VMCMD VMNAME
rht-vmctl -h|--help
where VMCMD is one of:
reset - poweroff, return to saved or original state, start VMNAME
view - launches console viewer of VMNAME
start - obtain and start up VMNAME
stop - stop a running VMNAME
poweroff - if running, force stop VMNAME
save - stop, backup image, start VMNAME
restore - poweroff, restore image, start VMNAME
fullreset - poweroff, reobtain from server, start VMNAME (bad save/image)
get - if not here, obtain VMNAME from server
status - display libvirt status of
通过上面两部分就进入到了虚拟机,在虚拟机中便可输入相关命令进行操作
1.在linux中如何运行命令:
命令 参数 目标
ls -s test
a.参数用来指定命令的某些功能,可以加也可以不加
b.命令和参数和目标之间要用空格隔开
c.参数中“-”表示单词的缩写,“–”表示单词的全拼
d.在执行命令时通常遵循这些规则,特殊情况除外
e.命令必须在行提示符后输入,没有行提示符的输入是无效的
2.命令行提示符中几个区域所表示的含义:
[kiosk@foundation67 Desktop]$
1.kiosk
:运行shell的用户是谁
2.@
分割符号
3.foundation67
:主机短名称
4.Desktop
:所在当前主机的位置
5.$
:身份提示符: $
:表示普通用户 #
:表示超级用户