When we install CentOS7, if we choose "Minimal Install" to install, then the system only has a command line interface, but no graphical interface, as shown in the figure below: The complete steps to solve the problem are as follows: 1)
Start
CentOS7 and log in as the root user (be sure to use root user login, and other common users have insufficient permissions), where localhost login is root, and Password is the password of root user.
2) Configure the network card first to ensure that it is connected to the external network (if it is not connected, the subsequent operations cannot be performed): enter the command in the
command line interface cd /etc/sysconfig/network-scripts/
to enter the network-scripts directory, and then enter ls to view the directories under the network-scripts directory. At this time, we will see a file named ifcfg-ens33, as shown in the figure below:
Then enter the command vi ifcfg-ens33
to open the network configuration file, i
press the key enter the edit input mode, add the following content at the end of the file:
then 【ESC】
press the key to exit the edit mode , and then enter the command :wq
to save and exit the network configuration file, and then be sure to reload the network configuration file, because the configuration we just made will take effect only after reloading. The command to reload the network configuration file is as shown service network restart
below :
At this point, the configuration is complete, check whether you can access the external network, and enter the command ping -c 3 www.baidu.com
, as shown in the figure below:
The successful ping proves that the configuration of the second step is successful.
3) Install the GNOME package of the graphical interface:
first enter yum
to check whether yum can be used normally, as shown in the following figure:
Then enter the command yum grouplist
to list the graphical interfaces supported by this system. Many graphical interfaces are supported. We choose the default graphical interface (GNOME Desktop), as shown in the figure below: Then enter the command to obtain and install the default graphical interface GNOME program
of yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
CentOS Package, (case cannot be changed, Linux is strictly case-sensitive).
During the installation process, there will be a prompt similar to "... is ok? (y/b/n)", just select y and press Enter. Then wait for the automatic installation (I installed it myself because the network speed is relatively poor, it takes about ten minutes), until the prompt "Completed!", indicating that the GNOME package has been installed, as shown below:
4) (Optional step) Modify the default startup mode of CentOS7 to the graphical mode:
Enter the command systemctl get-default
to view the current default mode multi-user.target
, that is, the command line mode, we want to modify it to the graphical interface mode, as shown in the figure below:
Enter the command again at this time systemctl get-default
You can view the current modified default mode graphical.target
, that is, the graphical interface mode, as shown in the figure below:
5) Restart CentOS and check the effect of the GUI interface:
Enter the command reboo
t to restart the CentOS system. After restarting, it has switched to the GUI graphical interface mode, as shown in the figure below:
Log in to the system and see the desktop of CentOS at this time, as shown in the figure below:
From the command line above All operations to the graphical interface are completed.