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.
- Readers' Choice Awards 2013
- Linux Kernel News - November 2013
- December 2013 Issue of Linux Journal: Readers' Choice
- Mars Needs Women
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Advanced Hard Drive Caching Techniques
- New Products
- Web Administration Scripts
- thanks for share, great
10 hours 15 min ago
- There are factors which are
15 hours 15 min ago
- Gnome 3 ?
16 hours 1 sec ago
- Reply to comment | Linux Journal
20 hours 7 min ago
- "Redis RethinkDB 4.5%" on Best NoSQL Databases
1 day 6 hours ago
- on the ground
1 day 12 hours ago
- I was able to read the whole
1 day 14 hours ago
- since i have read the title i
1 day 17 hours ago
- Belanja Online Cari Voucher Diskon
1 day 17 hours ago
- The kernel doesn't really
2 days 5 hours ago