我的博客已迁移到xdoujiang.com请去那边和我交流
======================Debian===========================
一、Debian安装配置ipmi
1、版本
cat /etc/debian_version 
5.0.2

2、查询下ipmi安装包
apt-cache search ipmi
ipmitool - utility for IPMI control with kernel driver or LAN interface

3、安装ipmitool
apt-get -y install ipmitool --force-yes

4、查看已安装的ipmi包
dpkg -l|grep ipmi
ii  ipmitool  1.8.9-2 utility for IPMI control with kernel driver or LAN interface

5、将ipmivd服务添加到启动项
update-rc.d ipmievd defaults

6、5.1和5.2二选一查看
5.1)、ls /etc/rc2.d/S20ipmievd 
lrwxrwxrwx 1 root root 17 2014-12-28 11:32 /etc/rc2.d/S20ipmievd -> ../init.d/ipmievd
5.2)、sysv-rc-conf --list |grep ipmi
ipmievd 0:off    1:off    2:on    3:on    4:on    5:on    6:off

7、查看相关信息
ll /lib/modules/`uname -r`/kernel/drivers/char/ipmi
total 232
-rw-r--r-- 1 root root 24164 2009-03-27 15:18 ipmi_devintf.ko
-rw-r--r-- 1 root root 59598 2009-03-27 15:18 ipmi_msghandler.ko
-rw-r--r-- 1 root root 21698 2009-03-27 15:18 ipmi_poweroff.ko
-rw-r--r-- 1 root root 75858 2009-03-27 15:18 ipmi_si.ko
-rw-r--r-- 1 root root 39538 2009-03-27 15:18 ipmi_watchdog.ko

8、加载ipmi模块
modprobe ipmi_si && modprobe ipmi_devintf && modprobe ipmi_msghandler

9、查看模块
lsmod |grep ipmi
ipmi_si                43656  0 
ipmi_devintf           15632  0 
ipmi_msghandler        40308  2 ipmi_si,ipmi_devintf

10、相关模块说明
1)、ipmi_msghandler(为IPMI接口处理传入和传出的信息)
Incoming and outgoing message handler for IPMI interfaces.
2)、ipmi_si(一个IPMI的系统消息处理程序接口的驱动程序。该模块支持各种IPMI的系统接口)
An IPMI system interface driver for the message handler. This module supports various IPMI system interfaces such as KCS, BT, SMIC, and even SMBus in 2.6 kernels.
3)、ipmi_devintf(Linux字符的消息处理设备接口)
Linux character device interface for the message handler.

11、设置grub参数方便查看Linux启动信息
cat /boot/grub/menu.lst|egrep -v  "^#|^$"
default        2
timeout        5
color cyan/blue white/blue
title        Debian GNU/Linux, kernel 2.6.26-2-amd64
root        (hd0,0)
kernel        /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda1 console=tty0 console=ttyS1,115200 ro 
initrd        /boot/initrd.img-2.6.26-2-amd64
title        Debian GNU/Linux, kernel 2.6.26-2-amd64 (single-user mode)
root        (hd0,0)
kernel        /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sda1 console=tty0 console=ttyS1,115200 ro single
initrd        /boot/initrd.img-2.6.26-2-amd64
PS:添加console=tty0 console=ttyS1,115200在这个配置文件里
console=tty0 console=ttyS1,115200参数传递到内核中,实现串口重定向
console=tty0 代表显示器输出  
console=ttyS0 代表定向到串口1 ,如果是ttyS1代表定向到串口2
115200则为串口通信采用的波特率,波特率和bios设置的一样

12、通过ipmitool命令还可以对ipmi进行配置
1)查看ipmi信息
ipmitool lan print 1
2)设置BMC ip,作为远程管理ip
ipmitool lan set 1 ipaddr 172.16.*.*
3)ip设置成静态
ipmitool lan set 1 ipsrc static 
4)设置掩码
ipmitool lan set 1 netmask 255.255.255.0
5)设置网关
ipmitool lan set 1 defgw ipaddr 0.0.0.0
6)连接目标终端
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 sol activate
7)结束目标终端
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 sol deactivate
8)重启目标终端
ipmitool -Ilanplus -H 172.16.1. -U root -P 123456 power reset
9)查看电源情况
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power status
10)开机
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power on
11)关机
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 power off
12)修改bios启动项为网络启动
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 chassis bootdev pxe
13)设置channel 1允许访问
ipmitool -I open lan set 1 access on
14)配置ipmi管理用户
ipmitool user set name 2 root
ipmitool user set password 2 "123456"
15)获取传感器中的各种监测值和该值的监测阈值,包括(CPU温度,电压,风扇转速,电源调制模块温度,电源电压等信息) 
ipmitool -I open sdr list(ipmitool -I open sensor)
16)显示温度
ipmitool sdr type Temperature
Temp             | 01h | ok  |  3.1 | -56 degrees C
Temp             | 02h | ok  |  3.2 | 50 degrees C
Temp             | 05h | ok  | 10.1 | 42 degrees C
Temp             | 06h | ns  | 10.2 | Disabled
Ambient Temp     | 0Eh | ok  |  7.1 | 20 degrees C
Planar Temp      | 0Fh | ok  |  7.1 | 37 degrees C
CPU Temp IF      | 76h | ns  |  7.1 | Disabled
Temp             | 0Ah | ok  |  8.1 | 31 degrees C
Temp             | 0Bh | ns  |  8.1 | Disabled
Temp             | 0Ch | unc |  8.1 | 45 degrees C
Ambient Temp     | 07h | ok  | 10.1 | 29 degrees C
Ambient Temp     | 08h | ns  | 10.2 | Disabled
当然也可以ipmitool sdr type直接回车
ipmitool sdr type
Sensor Types:
    Temperature                 Voltage                  
    Current                     Fan                      
    Physical Security           Platform Security        
    Processor                   Power Supply             
    Power Unit                  Cooling Device           
    Other                       Memory                   
    Drive Slot / Bay            POST Memory Resize       
    System Firmwares            Event Logging Disabled   
    Watchdog                    System Event             
    Critical Interrupt          Button                   
    Module / Board              Microcontroller          
    Add-in Card                 Chassis                  
    Chip Set                    Other FRU                
    Cable / Interconnect        Terminator               
    System Boot Initiated       Boot Error               
    OS Boot                     OS Critical Stop         
    Slot / Connector            System ACPI Power State  
    Watchdog                    Platform Alert           
    Entity Presence             Monitor ASIC             
    LAN                         Management Subsystem Health
    Battery                     Session Audit            
    Version Change              FRU State
17)退出ipmi
~.
18)保持ssh连接的退出ipmi
在使用ipmitool命令进行sol activate连接目标机器时加上-e选项
-e <sol_escape_char>
Use supplied character for SOL session escape character.  
The default is to use ~ but this can conflict with ssh sessions.
举例(这里的q是自定义 可以随意指定 这样就可以再退出ipmi时保持着ssh sessions)
ipmitool -I lanplus -H 172.16.1. -U root -P 123456 -e "q" sol activate
[SOL Session operational.  Use q? for help]
10.1.1.1 login: q. [terminated ipmitool]
root@10.1.1.1.:~# 
这里实际按的就是q.

ipmitool命令参数说明
lan用于远程访问,电源管理等。 open用于本地访问。 lanplus用于sol。

13、inittab配置(因版本不同 配置有相应的变动)
1)配置如下
cat /etc/inittab|egrep -v  "^#|^$"
T1:23:respawn:/sbin/getty -L ttyS1 115200 vt100
ipmi必须需要注意 有的时候是ttyS1有的时候ttyS0  根据情况更改ttyS1还是ttyS0
2)使/etc/inittab配置生效
init q               (Q or q tell init to re-examine the /etc/inittab file. ) 
3)查看
ps aux |grep tty
root      1975  0.0  0.0   3788   548 ttyS1    Ss+  14:05   0:00 /sbin/getty -L ttyS1 115200 vt100
======================Centos===========================
二、Centos安装配置ipmi
1、发行版本
cat /etc/redhat-release 
CentOS release 6.2 (Final)

2、查询下ipmi安装包
yum list |grep -i "ipmi"
OpenIPMI.x86_64                         2.0.16-14.el6                    @base  
OpenIPMI-libs.x86_64                    2.0.16-14.el6                    @base  
ipmitool.x86_64                         1.8.11-21.el6                    @updates
OpenIPMI-devel.i686                     2.0.16-14.el6                    base   
OpenIPMI-devel.x86_64                   2.0.16-14.el6                    base   
OpenIPMI-libs.i686                      2.0.16-14.el6                    base   
OpenIPMI-perl.x86_64                    2.0.16-14.el6                    base   
OpenIPMI-python.x86_64                  2.0.16-14.el6                    base   
freeipmi.i686                           1.2.1-6.el6_5                    base   
freeipmi.x86_64                         1.2.1-6.el6_5                    base   
freeipmi-bmc-watchdog.x86_64            1.2.1-6.el6_5                    base   
freeipmi-devel.i686                     1.2.1-6.el6_5                    base   
freeipmi-devel.x86_64                   1.2.1-6.el6_5                    base   
freeipmi-ipmidetectd.x86_64             1.2.1-6.el6_5                    base 

3、安装ipmitool OpenIPMI
yum -y install ipmitool OpenIPMI

4、查看已安装的ipmi包
rpm -qa |grep -i "ipmi"
OpenIPMI-2.0.16-14.el6.x86_64
OpenIPMI-libs-2.0.16-14.el6.x86_64
ipmitool-1.8.11-21.el6.x86_64

5、将ipmi服务添加到启动项
chkconfig ipmi on

6、5.1和5.2 2选1方式查看是否开机启动
1)ls /etc/rc3.d/S13ipmi 
lrwxrwxrwx 1 root root 14 May  6 16:26 /etc/rc3.d/S13ipmi -> ../init.d/ipmi
2)chkconfig --list|grep ipmi
ipmi 0:off    1:off    2:on    3:on    4:on    5:on    6:off

7、启动ipmi服务等于是加载ipmi驱动模块
1)/etc/init.d/ipmi start
Starting ipmi drivers:                                     [  OK  ]
2)用服务方式查看模块加载
/etc/init.d/ipmi status
ipmi_msghandler module in kernel.
ipmi_si module in kernel.
ipmi_devintf module loaded.
/dev/ipmi0 exists.
3)查看模块加载情况
lsmod |grep ipmi
ipmi_devintf            8049  0 
4)查看相关信息
ll /lib/modules/`uname -r`/kernel/drivers/char/ipmi
total 84
-rwxr--r--. 1 root root 24024 Nov 22  2013 ipmi_devintf.ko
-rwxr--r--. 1 root root 19592 Nov 22  2013 ipmi_poweroff.ko
-rwxr--r--. 1 root root 40440 Nov 22  2013 ipmi_watchdog.ko

8、或直接用modprobe加载上ipmi驱动模块
modprobe ipmi_devintf

9、相关模块说明
1)、ipmi_devintf
Linux character device interface for the message handler.

10、设置grub参数方便查看Linux启动信息
cat /boot/grub/grub.conf|egrep -v "^#|^$"
default=0
timeout=5
title CentOS (2.6.32-220.el6.x86_64)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/sda1 selinux=0 console=tty0 console=ttyS1,115200 ro
    initrd /boot/initramfs-2.6.32-220.el6.x86_64.img
PS:添加console=tty0 console=ttyS1,115200在这个配置文件里
console=tty0 console=ttyS1,115200参数传递到内核中,实现串口重定向
console=tty0 代表显示器输出  
console=ttyS0 代表定向到串口1 ,如果是ttyS1代表定向到串口2
115200则为串口通信采用的波特率,波特率和bios设置的一样

11、/etc/init/ttyS1.conf配置(因版本不同 配置有相应的变动)
1)配置如下
cat /etc/init/ttyS1.conf 
stop on runlevel [S016]
respawn
exec /sbin/agetty /dev/ttyS0 115200 vt100
2)使配置生效
start ttyS1
ttyS1 start/running, process 27985
3)查看
ps aux |grep tty
root      2384  0.0  0.0   4132   604 ttyS0    Ss+  Mar23   0:00 /sbin/agetty /dev/ttyS0 115200 vt100
4)错误信息解决:
modprobe ipmi_si && modprobe ipmi_devintf && modprobe ipmi_msghandler
WARNING: Could not open 'kernel/drivers/char/ipmi/ipmi_msghandler.ko': No such file or directory
FATAL: Could not open 'kernel/drivers/char/ipmi/ipmi_si.ko': No such file or directory
如果手动使用modprobe命令出错的话 就先使用depmod解决模块依赖关系 
之后再手动加载模块就行了depmod(可检测模块的相依性,供modprobe在安装模块时使用)
Linux  kernel modules can provide services (called "symbols") for other modules to use (using EXPORT_SYMBOL in the code). 
If a second module uses this symbol, that second module clearly depends on the first module.  These dependencies can get quite complex.

三、ipmi的键盘映射
Terminate connection          #~+.
Suspend IPMItool              #~+^+Z
Send break                      #~+B
Print escape sequence help      #~+?
F1                            #Esc+1
F2                            #Esc+2
F3                            #Esc+3
F9                            #Esc+9
F10                           #Esc+0
F11                           #Esc+!
F12                           #Esc+@
Home                          #Esc+h
End                           #Esc+k
Insert                        #Esc++
Delete                        #Esc+-
Page Up                       #Esc+?
Page Down                     #Esc+/
Ctrl+M                        #Esc+Ctrl+M
Ctrl+H                        #Esc+Ctrl+H
Ctrl+I                        #Esc+Ctrl+I
Ctrl+J                        #Esc+Ctrl+J
Alt+x (where x is any letter) #Esc+X+x
Ctrl+Alt+Del                  #Esc+R+Esc+r+Esc+R

四、参考文章
http://blog.chinaunix.net/uid-28705339-id-3513250.html
http://www.ibm.com/developerworks/cn/linux/l-ipmi/index.html