CentOS kernel upgrade and KVM installation (tested and feasible)

Source: Internet
Author: User
Tags svm

Because the default CentOS kernel is 2.6.18, You need to upgrade the kernel.

It's easy to upgrade the kernel to 2.6.27, but it took me a long time to upgrade the kernel to 2.6.28.

Upgrade to 2.6.27
Wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.27.tar.gz
Tar zxvf linux-2.6.27.tar.gz-C/usr/src
Cd/usr/src/linux-2.6.27
Make menuconfig
Make
Make modules_install
Cp arch/i386/boot/bzImage/boot/vmlinuz-2.6.27-root (Note: Directory i386 is based on your system type, if it is a 64-bit system, it is likely x86_64)
Cp System. map/boot/System. map-2.6.27-root
Mkinit RD/boot/initrd-2.6.27-root.img 2.6.27

Vi/etc/grub. conf
Title CentOS (2.6.27)
Root (hd0, 6)
Kernel/vmlinuz-2.6.27-root ro root =/dev/VolGroup00/LogVol00 rhgb quiet
Initrd/initrd-2.6.27-root.img
Title CentOS (2.6.18-92.1.18.el5)
Root (hd0, 6)
Kernel/vmlinuz-2.6.18-92.1.18.el5 ro root =/dev/VolGroup00/LogVol00 rhgb quiet
Initrd/initrd-2.6.18-92.1.18.el5.img
Title CentOS (2.6.18-53. el5)
Root (hd0, 6)
Kernel/vmlinuz-2.6.18-53.el5 ro root =/dev/VolGroup00/LogVol00 rhgb quiet
Initrd/initrd-2.6.18-53.el5.img
Title qrpeng windows xp
Rootnoverify (hd0, 0)
Chainloader + 1
Reboot

Upgrade to 2.6.33
Because LVS needs to be installed and the kernel version is 2.6.28 or later, it takes a long time to upgrade the new kernel. Finally, follow these steps:

Wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.tar.gz
Tar zxvf linux-2.6.33.tar.gz-C/usr/src
Cd/usr/src/linux-2.6.33
Make distclean
Cp/boot/config-2.6.18-164.el5. config
Make menuconfig
Modify the. config file and search CONFIG_SYSFS_DEPRECATED_V2 in the. config file. You will find the line # CONFIG_SYSFS_DEPRECATED_V2 is notset and change this line to CONFIG_SYSFS_DEPRECATED_V2 = y.
Make all
Make modules_install
Make install
Do not restart. You need to modify initrd.

1. Decompress initrd

Cp, boot, initrd-2.6.33.img, tmp
Cd/tmp/
Mkdir newinitrd
Cd newinitrd/
Zcat./initrd-2.6.33.img | cpio-I
2. Edit init and delete the duplicate two rows.
Echo "Loading dm-region-hash.ko module"
Insmod/lib/dm-region-hash.ko
Echo "Loading dm-region-hash.ko module"
Insmod/lib/dm-region-hash.ko
3. Repackage initrd

Find. | cpio-c-o> ../initrd
Cd ..
Gzip-9 <initrd> initrd-2.6.33.img

The initrd-2.6.33.img is the re-packaged initrd, and then copy the initrd-2.6.33.img to/boot.

Install kernel-devel

Go to the http://ftp.yz.yamagata-u.ac.jp/pub/linux/Vine/VineSeed/i386/RPMS.main/ or http://fr.rpmfind.net/linux/rpm/fedora/devel/ I #/fedora_project.html.

Install KVM

Enable SELinux
(If your SELinux is disabled, virt-install will not work)

System-config-securitylevel-tui

Kvm Installation
(A) check whether the CPU supports hardware virtualization-run commands

Egrep '(vmx | svm)'-color = always/proc/cpuinfo

(If the output result contains vmx, It is Intel; if it contains svm, It is AMD. If you cannot get anything, your system does not support virtualization .)

(B) install KVM and virtinst (a tool for creating a virtual machine). We run

Yum install kvm kmod-kvm qemu libvirt python-kernel Inst

Then restart the system:

Reboot

Check
Run the following command to check whether KVM is successfully installed:

Virsh-c qemu: // system list

The following result is displayed:

[Root @ server1 ~] # Virsh-c qemu: // system list

Id Name State

------------

[Root @ server1 ~] #

If an error message is displayed, it indicates that something is wrong.

Bridging Network
1) if you want the client to appear on the Intranet as a single host to make the entire network visible, you need to use a bridge network.

Yum install bridge-utils2) Create file/etc/sysconfig/network-scripts/ifcfg-br0

Vi/etc/sysconfig/network-scripts/ifcfg-br0

DEVICE = br0

TYPE = Bridge

BOOTPROTO = static

BROADCAST = 192.168.0.255

IPADDR = 192.168.0.100

NETMASK = 255.255.255.0

NETWORK = 192.168.0.0

ONBOOT = yes

Configure the IP address above as your local IP Address

3) Modify/etc/sysconfig/network-scripts/ifcfg-eth0, comment out the blue information, red to add new

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

# Realtek semiconduco., Ltd. RTL-8139/8139C/8139C +

DEVICE = eth0

# BOOTPROTO = static

# BROADCAST = 192.168.0.255

HWADDR = 00: 10: A7: 05: AF: EB

# IPADDR = 192.168.0.100

# NETMASK = 255.255.255.0

# NETWORK = 192.168.0.0

ONBOOT = yes

BRIDGE = br0

Note: You must comment out the IP address of eth0 (the physical network card, which is determined by your machine name). Otherwise, the configuration is incorrect.

KVM Management
GUI
Install virt-viewer or virt-manager

Yum install virt-viewer virt-manager

Install OS with GUI
Enter virt-manager in the terminal or click the System menu: Applications-> System tools-> Virtual Machine Manager. The GUI is displayed, which makes it easy to install the new operating System.

Note: before this step, make sure SELinux is disabled or permissive.

Management Client
You can use the virt-manager or virsh command to manage your resources.

Connect to the virtual shell and run

Virsh-connect qemu: // system

After entering, use the help command for help.

FAQ
If an Error is always reported when a new client is created, "Internal Error: Domain xxx didn't show up" is a problem with SELinux. Set SELinux to permissive.

 

When the 27 kernel is compiled in the Virtual MachineMake:***[_Modinst_post] Error137 error.

Check that swap is not big enough to get dizzy ......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.