Solution to install CentOS7 on virtual machine and forget to install graphical interface

The first step is to log in to the root user, enter the network-scripts directory with the command cd / etc / sysconfig / network-scripts /, and find ifcfg-eno16777736 (the specific name may vary depending on the system)

cd /etc/sysconfig/network-scripts/
ls   #查看文件

The second step is to open the network configuration file with the command vi ifcfg16777736, enter [i] on the keyboard to edit the mode, add or change at the end of the file, it is not necessary.

vi ifcfg16777736
ONBOOT=yes #启动网络时,启动该设备
DNS1=8.8.8.8
DNS2=2.2.2.2

Insert picture description here
After editing the content, enter [esc] on the keyboard to exit the editing mode, and enter [shift] +: wq on the keyboard again. Save and exit.
In the new operation line, enter: service network restart Reload the network configuration file to make the configuration file just take effect.

service network restart

Next, ping and check whether you can connect to the external network.

ping www.baidu.com

Insert picture description here
PS: My personal situation is that an error message appears: ping * UNkonwn (forget the screenshot, I ca n’t remember) The solution is to re-enter: service network restart.

The third step is to obtain and install the GNOME package

Use the yum command to check whether yum can be used normally

yum

Insert picture description here
After checking OK, enter yum groupinstall "GNOME Desktop" "Graphical Administration Tools" [enter] to install the GNOME graphical interface module.

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

Insert picture description here
Finally, there will be a prompt [Is this ok [y / d / N] directly select y, press Enter, and then Waiting ... until "Completed!" Appears
Insert picture description here
! [My personal situation appears the second time Is this ok [y / d / N]
Success!
Insert picture description here

The fourth step is to modify the default startup mode of CentOS7 to graphical interface mode

Run the systemctl get-default command to view the current startup mode

systemctl get-default #查看当前的启动模式,multi-user.target为命令行模式

Insert picture description here

systemctl set-default multi-user.target #将默认模式修改为命令行模式
systemctl set-default graphical.target #将默认模式修改为图形界面模式

Change to graphical interface mode with the command systemctl set-default graphical.target

systemctl set-default graphical.target

Enter systemctl get-default again to view the current default mode
Insert picture description here

The fifth step is to restart centOS7 and check the GUI interface effectInsert picture description here

Published 2 original articles · Likes0 · Visits8

Guess you like

Origin blog.csdn.net/weixin_43551437/article/details/105531938