Di recente ho installato CentOS 7 (installazione minima senza GUI) e ora voglio installare un ambiente GUI in esso.
Come posso installare gli ambienti desktop su CentOS7 precedentemente installato senza reinstallarlo?
Installa l'ambiente desktop GNOME qui.
# yum -y groups install "GNOME Desktop"
Immettere un comando come di seguito dopo aver terminato l'installazione:
# startx
Verrà avviato GNOME Desktop Environment. Per il primo avvio, viene eseguita la configurazione iniziale e devi configurarla per la prima volta.
Gli ambienti desktop GNOME iniziano come segue.
Il desktop GNOME predefinito di CentOS 7 inizia con modalità classica ma se desideri usare GNOME Shell, imposta come segue:
Opzione A: Se avvii GNOME con startx
, imposta come segue.
# echo "exec gnome-session" >> ~/.xinitrc
# startx
Opzione B: imposta l'accesso grafico del sistema systemctl set-default graphical.target
( maggiori informazioni ) e riavvia il sistema. Dopo l'avvio del sistema
Installa l'ambiente desktop KDE qui.
# yum -y groups install "KDE Plasma Workspaces"
Immettere un comando come di seguito dopo aver terminato l'installazione:
# echo "exec startkde" >> ~/.xinitrc
# startx
Installa Cinnamon Desktop Environment qui.
Per prima cosa aggiungi il repository EPEL (repository EPEL fornito dal progetto Fedora).
Pacchetti extra per Enterprise Linux (EPEL)
Come aggiungere il repository EPEL?
# yum -y install epel-release
# sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo # set [priority=5]
# sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/epel.repo # for another way, change to [enabled=0] and use it only when needed
# yum --enablerepo=epel install [Package] # if [enabled=0], input a command to use the repository
E ora installa Cinnamon Desktop Environment dal repository EPEL:
# yum --enablerepo=epel -y install cinnamon*
Immettere un comando come di seguito dopo aver terminato l'installazione:
# echo "exec /usr/bin/cinnamon-session" >> ~/.xinitrc
# startx
Verrà avviato Cinnamon Desktop Environment. Per il primo avvio, viene eseguita la configurazione iniziale e devi configurarla per la prima volta.
Cinnamon Desktop Environment inizia come segue.
Installa MATE Ambiente desktop qui (dovrai aggiungere il repository EPEL come precedentemente spiegato in precedenza).
# yum --enablerepo=epel -y groups install "MATE Desktop"
Immettere un comando come di seguito dopo aver terminato l'installazione:
# echo "exec /usr/bin/mate-session" >> ~/.xinitrc
# startx
Installa Xfce Desktop Environment qui (dovrai prima aggiungere il repository EPEL come sopra nell'installazione "Cinnamon").
# yum -y groupinstall X11
# yum --enablerepo=epel -y groups install "Xfce"
Immettere un comando come di seguito dopo aver terminato l'installazione:
# echo "exec /usr/bin/xfce4-session" >> ~/.xinitrc
# startx
Anziché utilizzare l'hacking di un comando startx
in un .xinitrc
file, probabilmente è meglio dire a Systemd che si desidera avviare una GUI grafica rispetto al terminale.
Per fare ciò basta semplicemente fare quanto segue:
$ Sudo yum groupinstall "GNOME Desktop"
$ ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
Quindi riavviare semplicemente.
L'ultimo bit assocerà il target runlevel 5 come predefinito rispetto a Systemd.
Puoi anche usare Systemd per farlo. Questo è probabilmente il metodo migliore poiché stai gestendo lo stato del sistema direttamente tramite Systemd e le sue CLI.
Puoi vedere qual è il tuo obiettivo predefinito attuale:
$ Sudo systemctl get-default
multi-user.target
E poi cambiarlo in grafico:
$ Sudo systemctl set-default graphical.target
In Systemd i target runlevel5.target e graphical.target sono identici. Lo stesso vale per runlevel2.target e multi-user.target.
Runlevel Target Units Description
0 runlevel0.target, poweroff.target Shut down and power off the system.
1 runlevel1.target, rescue.target Set up a rescue Shell.
2 runlevel2.target, multi-user.target Set up a non-graphical multi-user system.
3 runlevel3.target, multi-user.target Set up a non-graphical multi-user system.
4 runlevel4.target, multi-user.target Set up a non-graphical multi-user system.
5 runlevel5.target, graphical.target Set up a graphical multi-user system.
6 runlevel6.target, reboot.target Shut down and reboot the system.
On CentOS 6
Questo ha funzionato per me:
yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
yum -y groupinstall "KDE Desktop"