How to Enable Serial Console Output in CentOS

In our environment, we have a few caching servers that are distributed across branch offices. These branch offices usually lack a KVM - which means tracking down a monitor, keyboard, mouse, etc. What a pain! If only we could simply hook up a serial cable and use Putty - oh wait we can!

  1. Let's open up our text editor: nano /etc/sysconfig/grub
  2. Find the line labeled GRUB_CMDLINE_LINUX and add console=ttyS0 to the end (this assumes your serial port is ttyS0). It should look something like this: GRUB_CMDLINE_LINUX="rhgb quiet console=ttyS0"
  3. Save the file and exit
  4. Run stty -F /dev/ttyS0 speed 9600
  5. Then grub2-mkconfig -o /boot/grub2/grub.cfg
  6. Finally systemctl start getty@ttyS0

Now when you boot up the server, you can use the console port for a headless server. And if you happen to find a monitor and keyboard, you can still use that as well!

Posted on
Tagged in centos , linux
Chris Reinking

comments powered by Disqus