主机环境 RedHat6.5 64位
实验环境 ip 172.25.29.6
安装包 asciidoc-8.4.5-4.1.el6.noarch.rpm
Lvs-fullnat-synproxy.tar.gz
kernel-2.6.32-220.23.1.el6.src.rpm
newt-devel-0.52.11-3.el6.x86_64.rpm
slang-devel-2.2.1-1.el6.x86_64.rpm
防火墙状态:关闭
重新编译内核之前,要保证根分区要有20G的内存。
如果没有足够的空间就添加一块20G的虚拟磁盘
1.给根分区分用lvm分20G的空间(如果有足够的空间,就不用做拉伸了)
[root@server6 ~]# fdisk -l #查看分区
Disk /dev/vdc: 21.5 GB, 21474836480 bytes #新添加的磁盘
16 heads, 63 sectors/track, 41610 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@server6 ~]# pvcreate /dev/vdc #用pv分成物理块
Physical volume"/dev/vdc" successfully created
[root@server6 ~]# pvs #查看,pv成功
PV VG Fmt Attr PSize PFree
/dev/vda2 VolGroup lvm2 a-- 8.51g 0
/dev/vdc lvm2 a-- 20.00g 20.00g
[root@server6 ~]# vgs #查看
VG #PV #LV #SN Attr VSize VFree
VolGroup 1 2 0 wz--n- 8.51g 0
[root@server6 ~]# vgextend VolGroup /dev/vdc #扩展VolGroup组
Volume group"VolGroup" successfully extended
[root@server6 ~]# vgs #查看
VG #PV #LV #SN Attr VSize VFree
VolGroup 2 2 0 wz--n- 28.50g 20.00g
[root@server6 ~]# lvextend -L 20G /dev/VolGroup/lv_root #扩展lv
Extending logicalvolume lv_root to 20.00 GiB
Logical volume lv_rootsuccessfully resized
[root@server6 ~]# df -lh #查看,根分区7.5G
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 7.5G 1.5G 5.7G 21% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 485M 55M 405M 12% /boot
[root@server6 ~]# resize2fs /dev/VolGroup/lv_root #扩展文件系统
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-lineresizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/VolGroup/lv_root to5242880 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 5242880 blockslong.
[root@server6 ~]# df -lh #查看,根分区20G
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 20G 1.5G 18G 8% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 485M 55M 405M 12% /boot
2. 重新编译内核,将fallnat模块添加到在内核及测试
A)重新编译内核
[root@server6 mnt]# ls
asciidoc-8.4.5-4.1.el6.noarch.rpm Lvs-fullnat-synproxy.tar.gz
kernel-2.6.32-220.23.1.el6.src.rpm newt-devel-0.52.11-3.el6.x86_64.rpm
lvs-fullnat-synproxy slang-devel-2.2.1-1.el6.x86_64.rpm
[root@server6 mnt]# rpm -vih kernel-2.6.32-220.23.1.el6.src.rpm #安装内核包
[root@server6 mnt]# yum install rpm-build -y #安装rpmbuild
[root@server6 mnt]# cd ~/rpmbuild/
[root@server6 rpmbuild]# ls
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
[root@server6 rpmbuild]# cd SPECS/
[root@server6 SPECS]# ls
kernel.spec
[root@server6 SPECS]# rpmbuild -bp kernel.spec #生成内核源码
error: Failed build dependencies:
redhat-rpm-config isneeded by kernel-2.6.32-220.23.1.el6.x86_64
patchutils is neededby kernel-2.6.32-220.23.1.el6.x86_64
xmlto is needed bykernel-2.6.32-220.23.1.el6.x86_64
asciidoc is needed bykernel-2.6.32-220.23.1.el6.x86_64
elfutils-libelf-develis needed by kernel-2.6.32-220.23.1.el6.x86_64
binutils-devel isneeded by kernel-2.6.32-220.23.1.el6.x86_64
newt-devel is neededby kernel-2.6.32-220.23.1.el6.x86_64
python-devel is neededby kernel-2.6.32-220.23.1.el6.x86_64
perl(ExtUtils::Embed)is needed by kernel-2.6.32-220.23.1.el6.x86_64
hmaccalc is needed bykernel-2.6.32-220.23.1.el6.x86_64
[root@server6 SPECS]# yum install redhat-rpm-config patchutilsxmlto elfutils-libelf-devel binutils-devel python-devel hmaccalcperl-ExtUtils-Embed -y #安装所缺少的包
[root@server6 SPECS]# cd /mnt/