Tech Tip: Setup Your Linux Server to Use a Serial Console
Do you have a linux server without a keyboard or monitor? Need to administer the server on-site but don't want to lug over a monitor and keyboard (or kvm)? Then setup the server to output the console to a serial port and use screen/minicom (Hyperterminal or putty in Windows) to console into the server over a serial cable.
To set this up, you need to edit /etc/inittab to tell it to start a terminal on the serial port for the console. If you want to see the kernel load and see all the services start then you also need to configure grub to use the serial port as well.
Edit /etc/inittab and add the line starting with "co" to the file (substitute the device name of your serial port for ttyS0 below):
co:2345:respawn:/sbin/agetty ttyS0 57600 vt100-nav # ADD THIS LINE 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6
To watch the kernel load (and all the services) you must configure grub to enable the console option in the kernel on boot. Edit /boot/grub.conf and add the "serial" and "terminal" lines below, and modify the "kernel" line to include the console specification:
serial --unit=0 --speed=57600 terminal --timeout=5 serial console title CentOS (2.6.9-55.0.2.EL) root (hd1,0) kernel /vmlinuz-2.6.9-55.0.2.EL ro root=/dev/VolGroup00/LogVol00 console=ttyS0,57600n8 initrd /initrd-2.6.9-55.0.2.EL.img
To connect to the server just hook a serial cable from your laptop to the server. Set the speed to 57600, no parity and 8bits. Boot up the server, you should see kernel output, services load, and finally a login prompt. After you disconnect you can easily re-connect and log in: just fire up your terminal emulator, connect your serial cable, hit enter a few times and you should get a prompt to log in.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
|Enter to Win Archive DVD + Free Backup Solution||May 18, 2015|
|Using Hiera with Puppet||May 14, 2015|
|Urgent Kernel Patch for Ubuntu||May 12, 2015|
- Dr Hjkl on the Command Line
- Initializing and Managing Services in Linux: Past, Present and Future
- Goodbye, Pi. Hello, C.H.I.P.
- Using Hiera with Puppet
- Enter to Win Archive DVD + Free Backup Solution
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Infinite BusyBox with systemd
- Mumblehard--Let's End Its Five-Year Reign
- It's Easier to Ask Forgiveness...
- Urgent Kernel Patch for Ubuntu