Site icon Ryadel

CentOS - How to Boot into a Graphical Environment: Auto-Start to GUI - StartX

Protect CentOS from unwanted SSH failed login attempts with Fail2Ban

Right after you install CentOS, you'll be able to access your system with the standard Linux login screen on a command-line prompt. If you want to access to a GUI, you need to do the following:

  • Be sure to have it installed.
  • Log-in, then type the following command: startx

In case you don't have a Graphical Environment installed, you can easily fix that by installing GNOME with the following shell commands:

It's worth noting that manually issuing the  startx  command will launch the GUI just for that specific session: in other words, it's a one-time fix and won't change the log in process for future logins.

To set up your system so that the GUI will be launched upon each login automatically, you need to do the following:

CentOS 6.x and earlier

  • Open the /etc/inittab  file.
  • Change the runlevel  option from 1 (or 3) to 5.

The /etc/inittab file tells init which runlevel to start the system at and describes the processes to be run at each runlevel. An entry in the inittab file has the following format:

Here's a list of all the available runlevels values:

You can alter the etc/inittab file with the text-editor you like: for example, you can do

or

 

CentOS 7.x and later

With the introduction of systemd, the file /etc/inittab is no longer used to set the default run level: the new /etc/inittab file became nothing more than a readme containing a short (and useful) guide to the new target-based system:

That pretty much summarizes what we have to do to enable the GUI on boot.

Open a shell command-prompt and type the following:

This sets the default runlevel to 5, which is multiuser with auto-loading the Graphics Environment on boot / startup sequence.

You can try these new settings with a reboot, which should prompt you with something similar to the following screenshot (if you're using GNOME):

CentOS - How to Boot into a Graphical Environment: Auto-Start to GUI - StartX

That's about it: happy GUI!

 

Exit mobile version