Linux内核升级,从2.6.18升级到3.2.14
今日在centos上安裝jsp環境,即(Nginx+jdk+mysql+tomcat)發現nginx啟動后無法訪問,于是查看日志,log如下
[root@AY12122501352213a7156 ~]# cat /var/log/nginx/error.log
2013/01/12 16:29:43 [emerg] 32055#0: eventfd() failed (38: Function not implemented)
2013/01/12 16:29:43 [alert] 32054#0: worker process 32055 exited with fatal code 2 and can not be respawn
到網上以查找,原來內核版本太低,沒有Linux-native aio,但是最新版Nginx?需要 Linux-native aio 啊,沒辦法,升級內核吧。
1、查看當前內核版本
[root@AY12122501352213a7156 ~]# uname -r
2.6.18-164.el5
2、下載linux-3.2.14內核包
[root@AY12122501352213a7156 ~]# wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.14.tar.bz2
[root@AY12122501352213a7156 ~]#tar -jxvf linux-3.2.14.tar.bz2
[root@AY12122501352213a7156 ~]#cd? linux-3.2.14
3、配置內核并安裝
?
# yum install ncurses-devel?????? #升級ncurses# make mrproper? #清除環境變量,即清除配置文件
# make menuconfig? #在菜單模式下選擇需要編譯的內核模塊
一定要勾選(輸入y選中,M編譯為模塊)
a、General setup→[*] enable deprecated sysfs features to support old userspace tools
b、Processor type and features→HighMemory Support。
c、找到以下選中選項并選中networking support → networking options → network packet filtering framework(netfilter)
(1)Corenetfilter configuration
- 勾中"Netfilter connection tracking support" -m state相關模塊是依賴它的,不選則沒有。
- 將netbios name service protocal support(new) 編譯成模塊,不然后面升級iptables后啟動時會出錯
- 勾中"Netfilter Xtables support (required for ip_tables)"
(2)IP: Netfilter Configuration
- 將 "IPv4 connection tracking support (require for NAT)" 編譯成模塊。
- 勾中IP tables support (required for filtering/masq/NAT) 。
- 將 "Full NAT" 下的 "MASQUERADE target support" 和 "REDIRECT target support" 編譯成模塊
(3)其它模塊可以根據自己的需要進行選擇,若不懂可以參考內核配置手冊.
# make clean #確保所有東西均保持最新狀態.# make bzImage #生成內核文件
# make modules #編譯模塊
# make modules_install #安裝模塊
# make install #安裝
注意:編譯內核的時候可能會出現如下問題:
cp include/linux/hidraw.h /usr/include/linux/
cp include/linux/hid.h /usr/include/linux/
vi samples/hidraw/hid-example.c
(在Linux下編譯程序有時會遇到這種問題,這貌似是一個Linux歷史遺留問題:
把所有#include <sys/xxx.h>都提到最前面,把#include <linux/xxx.h>的包含放在其后,就可以編譯通過了,之所以出現面的問題是存在循環引用所致。)
將13-15行的如下3行移動到33行以后。
???? 13 #include <linux/types.h>
???? 14 #include <linux/input.h>
???? 15 #include <linux/hidraw.h>
???? 29 #include <sys/ioctl.h>
???? 30 #include <sys/types.h>
???? 31 #include <sys/stat.h>
???? 32 #include <fcntl.h>
???? 33 #include <unistd.h>
vi /usr/include/linux/input.h
line 647
#define BUS_PCI???????????????? 0x01
#define BUS_ISAPNP????????????? 0x02
#define BUS_USB???????????????? 0x03
#define BUS_HIL???????????????? 0x04
#define BUS_BLUETOOTH?????????? 0x05
/*以下一行為新增*/
#define BUS_VIRTUAL???????????? 0x06
#define BUS_ISA???????????????? 0x10
#define BUS_I8042?????????????? 0x11
#define BUS_XTKBD?????????????? 0x12
#define BUS_RS232?????????????? 0x13
#define BUS_GAMEPORT??????????? 0x14
#define BUS_PARPORT???????????? 0x15
#define BUS_AMIGA?????????????? 0x16
#define BUS_ADB???????????????? 0x17
#define BUS_I2C???????????????? 0x18
#define BUS_HOST??????????????? 0x19
#define BUS_GSC???????????????? 0x1A
/*以下兩行為新增*/
#define BUS_ATARI?????????????? 0x1B
#define BUS_SPI???????????????? 0x1C??
然后重復(1)上面步驟即可完成
4、vim /etc/grub.conf,將 default=1 改為 default=0
#?vi /etc/grub.conf# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS Linux (3.2.2)
root (hd0,0)
kernel /vmlinuz-3.2.2 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
initrd /initramfs-3.2.2.img
title centos (2.6.32-71.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-71.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
initrd /initramfs-2.6.32-71.el6.i686.img ?
5、重啟系統,并查看內核
# reboot # uname -r 3.2.14-rt24 6、問題及解決辦法 HOSTCC scripts/basic/fixdepHOSTCC scripts/kconfig/conf.o *** Unable to find the ncurses libraries or the*** required header files.*** 'make menuconfig' requires the ncurses libraries.****** Install ncurses (ncurses-devel) and try again.***make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1make: *** [menuconfig] Error 2 如果出現上面的錯誤,記得要安裝ncurses-devel,如果你設置了本地源的話,就很簡單了。 # yum install ncurses-devel? 注意,如果在編譯內核或者模塊以及安裝過程中有錯誤或者警告,請把信息放到百度或者google里面查一下,免得重啟后出現各種問題。 還有切勿遠程升級內核,要升級內核最好現場升級。轉載于:https://www.cnblogs.com/wanghaosoft/archive/2013/01/12/2857766.html
總結
以上是生活随笔為你收集整理的Linux内核升级,从2.6.18升级到3.2.14的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: webservice发布
- 下一篇: linux系统服务设置命令--chkco