How to Boot CentOS in CLI?

35

11

I have a CentOS 6.2 OS which boots into GUI. How, upon startup, can I not boot into the GUI and instead, boot into the CLI? I want to do this at computer startup time.

bgmCoder

Posted 2012-05-19T20:51:53.097

Reputation: 1 771

Answers

49

When you are at the GRUB menu where you select which OS to boot (if this menu don’t appear, press ESC while you get the “Booting CentOS in X seconds”), press e to edit your boot commands. You should see a screen like this: (parameters may vary)

GRUB menu

Look for the line that begins with kernel. Choose it and then press e again. You will be at a simple editor, add 3 to the end of this line. This means booting in runlevel 3, which is text-mode only.

To make this stick: edit /etc/inittab and look for a line that begin with id:5. Replace the 5 in that line by 3. You can find a brief description of runlevels here, but shortly:

  • Runlevel 0 and 6: halt and reboot the machine, respectively.
  • Runlevel 1: No services running, only root can login.
  • Runlevel 2: Users can login but no networking.
  • Runlevel 3: Networking and text-mode.
  • Runlevel 4: unused.
  • Runlevel 5: GUI.

Renan

Posted 2012-05-19T20:51:53.097

Reputation: 7 463

Thanks it's fine for 6.4. I don't think this works for CentOS 7 though... – lppier – 2015-05-11T07:35:19.433

@lppier I haven't used CentOS 7 much, but likely it doesn't work since CentOS now uses systemd. – Renan – 2015-05-11T12:34:22.397

3For CentOS 7, type this into the Terminal: 'systemctl set-default multi-user.target' and to change it back, 'systemctl set-default graphical.target' – turiyag – 2015-08-24T18:43:16.083

@Renan In statement "add 3 to the end of this line" What "this line" refers too? – brainLoop – 2019-03-07T12:46:59.003

3After making the kernel edit for the runlevel boot mode, (and pushing b for "boot"), is it still supposed to load the splash screen? – bgmCoder – 2012-05-19T21:10:14.557

1@BGM I think so, but it should drop you to the login prompt after it finishes. – Renan – 2012-05-19T21:11:15.270

It works for level 1, but not for level 3. Is that strange? – bgmCoder – 2012-05-19T21:12:33.337

Anyway, Renan has the answer. I also found it here: http://www.linuxquestions.org/questions/linux-server-73/auditd-fails-to-start-on-boot-846100/

– bgmCoder – 2012-05-19T21:25:37.330

4

  1. Apart from what Renan mentioned, you can switch to another runlevel by simply executing sudo init [level-number] -- this is temporary, when you reboot, you get to your default, configured in /etc/inittab.
  2. If you don't want to see splash screen, you need to replace kernel param rhgb with text in boot menu. To make it permanent, edit /boot/grub/grub.conf.

Pavan

Posted 2012-05-19T20:51:53.097

Reputation: 41