Tuesday, November 13, 2012

Centos - Installing graphical X Window System (Boot Options, startx from command line)

Installing GUI

Installing the Graphical Window System (X.org-X11) and the Default Desktop Environment on CentOS 6

Performing the default "Minimal" install of CentOS 6 does not install the graphical subsystem (the X.org server) and the desktop environment (e.g. GNOME or KDE). Such OS install is nice for building an optimal system from scratch, setting up a headless server (no monitor, keyboard and mouse) and other purposes; but for one reason or another, you may still require a graphical user interface (GUI). This tutorial will show you how to install and start the graphical window system and the desktop environment of your choice.

To achieve the task, you will need to install the following package groups (groups of packages combined for a common purpose): "X Window System", "Desktop", "Fonts" and "General Purpose Desktop" (last two are optional). This will install about 500 additional packages on your system (~250MB download, or you may use the available OS installation DVD to retrieve packages).

Code:
yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
(Please enter this as is - package group names as well as package names are case sensitive).

Previous versions of RHEL and its derivatives provided a package group called "GNOME Desktop Environment", that was sufficient for a general purpose GNOME desktop. Currently, package group "Desktop" installs all critical components of GNOME, including gdm (the GNOME Display Manager), plus a few additional packages; enough to provide a minimalist GNOME desktop with mouse support, a graphical file manager, copy/paste functionality and the luxurious GNOME Terminal emulator - maybe just what you need. Thus, installing the "General Purpose Desktop" package group is optional, but will help you mimic the system you would probably get if you where to include the default graphical desktop during OS install. Alternatively, you can chose a single package group "KDE Desktop", for a general purpose KDE Software Compilation.

It is generally recommended to install the "Fonts" package group to improve usability of the GUI, no matter what desktop environment you choose to install.

You may view the complete list of available package groups by issuing:



Code:
yum grouplist
You may review the contents of each package group by entering:

Code:
yum groupinfo "Name of the Package Group"


Enabling booting into GUI - start GUI from command line

To boot directly into GUI, you will need to manually change the runlevel of the system from 3 (full multiuser environment with networking) to 5 (the same as mode 3 + X11), by changing the line "id:3:initdefault:" to "id:5:initdefault:" in /etc/inittab file. Or you can manually start X.org from console, by entering "startx" (without quotes).

Upon installation and subsequent reboot, you will be presented with the "Setup Agent" interface (even if you choose to stay in runlevel 3, you will see the text user interface of this tool - hence, the options provided will be different from the graphical variant). This is due to package "firstboot" being automatically installed by the "X Window System" package group and can be a handy way to setup a freshly installed system. All steps in "Setup Agent" are optional, so you can just skim through them, skipping any. Though, creating a new normal user on a freshly installed system is done best through this graphical tool, as it helps automatically create the new user and associate it with groups (such as the "video" group) appropriate for everyday use in a GUI environment . 


If you have installed the X Window System but are not seeing a graphical desktop environment once you log into your Red Hat Enterprise Linux system, you can start the X Window System graphical interface using the command startx.
Once you enter this command and press Enter, the graphical desktop environment is displayed.
Note, however, that this is just a one-time fix and does not change the log in process for future log ins.
To set up your system so that you can log in at a graphical login screen, you must edit one file,/etc/inittab, by changing just one number in the runlevel section. When you are finished, reboot the computer. The next time you log in, you are presented with a graphical login prompt.
Open a shell prompt. If you are in your user account, become root by typing the su command.
Now, type gedit /etc/inittab to edit the file with gedit. The file /etc/inittab opens. Within the first screen, a section of the file which looks like the following appears:
# Default runlevel. The runlevels used by RHS are: 
#   0 - halt (Do NOT set initdefault to this) 
#   1 - Single user mode 
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking) 
#   3 - Full multiuser mode 
#   4 - unused 
#   5 - X11 
#   6 - reboot (Do NOT set initdefault to this) 
#  id:3:initdefault:
To change from a console to a graphical login, you should change the number in the lineid:3:initdefault: from a 3 to a 5.

Warning

Change only the number of the default runlevel from 3 to 5.
Your changed line should look like the following:
  id:5:initdefault: 
When you are satisfied with your change, save and exit the file using the Ctrl-Q keys. A window appears and asks if you would like to save the changes. Click Save.

1 comment:

  1. What happens if before I saw this nice post I changed the inittab file from 3 to 5 only to realize that Windows X is not installed? Is there a way to open the inittab file to change back to 3 now on my 6.4 install?

    ReplyDelete