Install the desktop environment using YUM in CentOS
CentOS is very common as a server operating system, but it is rarely used as a desktop environment because it requires stability and is not very fashionable updates. Generally, you do not need to install the desktop environment on the server. you can install CentOS (minimal CentOS) with minimal installation. However, it is very convenient to install the desktop environment using YUM in CentOS with minimal installation.
On the server of the Organization, I installed the minimal CentOS operating system. However, my colleague said the operation was inconvenient, so I tried it and recorded the installation method by the way. Using the yum groupinstall command, you can easily install the Desktop System on the GUI.
Directory Contents
- 1. yum group Command
- 2. graphic desktop environment
- 3. Enable
1. yum group Command
Yum can install package packages in the program group mode. Supported software packages can be,
# yum grouplist
Found. In the group software package, Desktop, Desktop Platform, KDE Desktop, and X Window System are the main Desktop environments.
The software package list is displayed based on the language used by the system. Simplified Chinese file names are supported. Therefore, you are advised to query the above commands before installation. If the system uses Simplified Chinese and the installation command uses English, the system may fail to query the software package. The following installation commands are in English.
2. graphic desktop environment
To install the KDE Desktop Environment, run the command,
# yum groupinstall "X Window System" "KDE Desktop" Desktop
You can install three software packages at the same time. Note that the names of the KDE Desktop and X Window System packages contain spaces, which must be enclosed by quotation marks.
To install the Gnome desktop environment and execute commands,
# yum groupinstall "X Window System" "Desktop Platform" Desktop
You can install three software packages at the same time. X Window System is required, whether it is Gnome or KDE.
Since it is a desktop environment, you may also need fonts, management tools, such,
# yum -y groupinstall "Graphical Administration Tools"# yum -y groupinstall "Internet Browser"# yum -y groupinstall "General Purpose Desktop"# yum -y groupinstall "Office Suite and Productivity"# yum -y groupinstall "Graphics Creation Tools"
3. Enable
Start the graphic desktop environment directly from the command line,
# startx
In this way, the default Gnome or KDE Desktop environment will be started. If you prefer to install Gnome and KDE at the same time, refer to the CentOS documentation for the switching method.
If you want to enable the image desktop automatically at startup, You need to modify the startup configuration. Because CentOS 7 uses the systemd manager, the operation method is different from the previous version.
CentOS 7
In CentOS 7, directly use the systemd command to modify the startup target status.
Use,
# systemctl get-default
You can query the current status. Multi-user.target is equivalent to the previous level 3, that is, the command line terminal; graphical.tar get is equivalent to the previous level 5, that is, the graphical interface.
Therefore, if you want to set the default startup mode to the graphic interface, run the following command,
# systemctl set-default graphical.target
CentOS 6, etc.
Edit/etc/inittab
, Setid:3:initdefault:
Changeid:5:initdefault:
. (Note the colon here .) Refer to here.
It is very convenient to use sed directly,
sed -i 's/id:3:initdefault:/id:5:initdefault:/' /etc/inittab
After the GUI is started, if you want to switch from the GUI to the command line interface, you can useCtrl + Alt + F6
(In fact, both F1 and F6 are supported, but they represent different consoles in Linux), or vice versa.Ctrl + Alt + F7
Return to the graphic interface just now.