CentOS: Enable CentOS GNOME Desktop

Mostly the CentOS servers that I am using is run on CLI (Command-Line Interface) mode. But in some cases, I need to have a desktop to install some applications with GUI (Grapich User Interface) mode. In this case, I will use GNOME, the most popular user-friendly desktop for any UNIX based system.

Variable that I used as below:

OS: CentOS 6.2 64bit
Desktop environment: GNOME

1. Using yum, we will need to install X Windows System  as the based for GUI and rich input device capability:

$ yum groupinstall -y 'X Window System'

2. Only then we can install GNOME desktop environment on top of it:

$ yum groupinstall -y 'Desktop'

3. Since previously the server is running on CLI mode, we need to change some value to tell CentOS to boot up in the GUI mode. Open /etc/inittab via text editor and change following line:

id:3:initdefault:

To:

id:5:initdefault:

4. Start the GUI:

$ init 5

Note: You can switch from GUI to CLI mode manually by using following method:

GUI to CLI: Ctrl + Alt + F6
CLI to GUI: Ctrl + Alt + F1

If you want to start the desktop from CLI console (not SSH session), use following command:

$ startx

In some cases, when you login into the system via GUI, you will see some kind of weird boxes replacing the fonts. You can overcome this problem by installing fonts group via yum:

$ yum groupinstall -y Fonts

Done! We now have user-friendly interface like below:

34 thoughts on “CentOS: Enable CentOS GNOME Desktop

  1. This worked for me the first time precisely as written. Thanks very much for the assistance.

    Reply

  2. Nice post, I used it for CentOS 6.2 . Although i got CentoS GNOME after using these commands but the problem is with the language. At login screen in says everything with boxes. and if i log in . Every thing is written as boxes in menus instead of English language.

    Reply

    1. Hi Adnan,

      What is the output of following command:
      cat /etc/sysconfig/i18n

      Reply

  3. This was helpfull, thank you. However when I did this under a minimal install the Gui came up with no text, not fonts, all blocks on the screen. I learned from another post I had to add:
    yum groupinstall fonts

    then the GUI came up fine.

    Reply

    1. Hi B-Rock,

      Thanks for sharing this information. I will put on some notes to the post based on your experience.

      Reply

  4. I’ve done this as well and got the Gnome GUI installed onto a minimal server. However I am having problems getting the GUI apps installed. I’m trying to get the tools under the Applications menu – any idea how to identify the package names for the various tools under this (or other) menus?

    Reply

    1. You can go to System > Administration > Add/Remove Software to manage application in CentOS. By using this wizard, you can install various application similar to YUM but through GUI. Application installed using this method will appear in the Application menu list.

      Reply

  5. Good Article. I am trying to enable GUI on one of my pre-installed CentOS 6.2 image on cloud. However, after changing the boot to id:5:initdefault: It hangs after loading the CentOS 6.2 and not doing anything.

    I need to SSH it and change it back to CLI mode in inittab to make it working again. Any idea what I have done wrong?

    Regards,

    Reply

    1. What happen if you use id:3:initdefault and then once the server reach console login, you run command “startx” or “init 5”? On the other hand, during the CentOS 6.2 splash page, press F1 to see the sysinit details. Maybe you got stuck in some other services like anacron or sendmail?

      Reply

  6. Hi,
    How can I install X Windows from DVD using rqm command?

    Reply

  7. Good Tutorial , Just wondering if you want to install just nglish fonts instead of all the fonts , how would you do that?

    Thanks

    Reply

    1. English fonts? Do you mean normal character encoding? You may find the font you want by running following command:
      $ yum search font

      This will list out all fonts in Fonts group repo. You may just choose the fonts that you want to use.

      Reply

  8. The reboot after changing the init is unnecessary.

    After changing /etc/inittab, you can type init 5 (instead of init 6) and the GUI will start.

    Reply

  9. Hi

    I followed the install however when I startx startx I get the error below help please:-(

    xauth: creating new authority file /root/.serverauth.1501

    X.Org X Server 1.13.0
    Release Date: 2012-09-05
    X Protocol Version 11, Revision 0
    Build Operating System: c6b7 2.6.32-220.el6.x86_64
    Current Operating System: Linux yusuf-net 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64
    Kernel command line: ro root=/dev/xvda1 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD console=hvc0 KEYTABLE=us SYSFONT=latarcyrheb-sun16 rd_NO_LVM rhgb quiet rd_NO_DM rhgb quiet
    Build Date: 22 February 2013 11:30:37AM
    Build ID: xorg-x11-server 1.13.0-11.el6.centos
    Current version of pixman: 0.26.2
    Before reporting problems, check http://wiki.centos.org/Documentation
    to make sure that you have the latest version.
    Markers: (–) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: “/var/log/Xorg.0.log”, Time: Fri Mar 15 03:41:02 2013
    (==) Using default built-in configuration (30 lines)
    Initializing built-in extension Generic Event Extension
    Initializing built-in extension SHAPE
    Initializing built-in extension MIT-SHM
    Initializing built-in extension XInputExtension
    Initializing built-in extension XTEST
    Initializing built-in extension BIG-REQUESTS
    Initializing built-in extension SYNC
    Initializing built-in extension XKEYBOARD
    Initializing built-in extension XC-MISC
    Initializing built-in extension XINERAMA
    Initializing built-in extension XFIXES
    Initializing built-in extension RENDER
    Initializing built-in extension RANDR
    Initializing built-in extension COMPOSITE
    Initializing built-in extension DAMAGE
    Initializing built-in extension MIT-SCREEN-SAVER
    Initializing built-in extension DOUBLE-BUFFER
    Initializing built-in extension RECORD
    Initializing built-in extension DPMS
    Initializing built-in extension X-Resource
    Initializing built-in extension XVideo
    Initializing built-in extension XVideo-MotionCompensation
    Initializing built-in extension SELinux
    Initializing built-in extension XFree86-VidModeExtension
    Initializing built-in extension XFree86-DGA
    Initializing built-in extension XFree86-DRI
    Initializing built-in extension DRI2
    Loading extension GLX

    Fatal server error:
    no screens found
    (EE)
    Please consult the CentOS support
    at http://wiki.centos.org/Documentation
    for help.
    (EE) Please also check the log file at “/var/log/Xorg.0.log” for additional information.
    (EE)
    Server terminated with error (1). Closing log file.
    giving up.
    xinit: No such file or directory (errno 2): unable to connect to X server
    xinit: No such process (errno 3): Server error.

    Reply

  10. I found an easier way… ..if you only need just a quick GNOME..

    $ yum install -y ‘Desktop’

    Reply

  11. Thanks a lot. This blog was very helpful. I was cracking my head for days because I thought my server had crashed and was not able to boot. I tried rescuing my linux box through single user mode and rescue mode. Everything was working fine, still was not able to get the gui. Then this blog happened to me. It worked like magic. Thanks SecaGuy. I owe you.

    Reply

  12. How can I open it if I have a VM on google cloud? I can only connect at the moment via SSH.

    Reply

    1. Hi William,

      If you can’t connect via direct console, use VNC to connect to Linux-based GUI. It’s similar to what Remote Desktop does with Microsoft Windows. But you have to enable VNC server on that host, then use VNC client/viewer like RealVNC, VNC Viewer or TightVNC to access.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *