- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
在centos7.2系统上安装xen服务& H/ w8 L I8 [% U
) M" x% e- ~1 g
6 f0 \2 @$ Q% i R& M) u
- F! u! _. [: m0 A
[root@localhost ~]# cat /etc/centos-release) B/ o0 |9 E0 k2 X
CentOS Linux release 7.2.1511 (Core)
B- M# O0 M% j0 k( L- w: E7 \7 G6 W( Q
调整selinux % G0 U. }4 d' a5 {5 h1 M5 a; ]
8 u% D) P) x. J
SELINUX=disabled
7 l6 ^7 ?4 E( c! p0 z" ^3 _3 z; Q! H# F3 b, [
: Z7 \$ X8 n# ^7 H* m- Z/ E* K7 V1 p. r* e- x3 N3 {* C
首先配置yum源:$ V) o: a9 l2 `* G; R
1 L( u5 x7 H5 R* E8 E6 [8 X. c2 r& O. k- u x0 N
[base]
& u& p8 B0 a8 g9 E3 Fname=CentOS-$releasever - Base
5 n+ L& W; Q9 d+ s9 P#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra2 L! N# Z( _$ p8 x1 ?8 N2 u
baseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/os/x86_64/7 h/ F4 a4 {6 D8 ?* Z
gpgcheck=1
6 w1 _4 k, d# Q* B' C2 H3 Ggpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
5 d3 l: B6 j; Y5 F. ^4 M/ |) f5 s4 y3 @: u0 q' g
#released updates
6 x/ U7 a7 Q4 l[updates]4 H+ r3 k& ?" C) R9 }: z
name=CentOS-$releasever - Updates' p S% F, G- F4 K; g0 P: e
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra* W+ @2 ?7 J2 S w2 c
baseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/updates/x86_64/
/ ^$ I9 T2 {4 \; _! {2 J( w- _gpgcheck=1, y+ w! e. ]' J5 ?" R! r8 ^9 H6 s
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-79 D+ p& ^1 S$ l0 c. m* ]% N
# B1 e. q* s, s; e% N, B#additional packages that may be useful! Y9 c+ T( b7 q
/ Q& X% s9 \% i; ?# i; b" e
#additional packages that extend functionality of existing packages
+ l7 F& M8 `: z" `* i/ p[centosplus]
2 O3 X6 W8 a' `6 dname=CentOS-$releasever - Plus
% z& i4 r( f/ F$ E$ \9 h% S/ m! T$ `* y#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra9 z& x6 v& K8 J& n4 `7 r+ A" ~
baseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/centosplus/x86_64/
$ M! S( g+ N, s3 Q, m/ jgpgcheck=1
0 V& Y$ ~' P9 O0 K7 }4 N* Denabled=0/ X# m1 s% G6 \ T( \; M) }
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
5 V# ^+ n; d1 C3 {; g$ w, Z: F) T. A2 A$ I- u
5 P7 m4 F# l7 c z
安装基础软件
7 \3 `4 e4 F+ V! C+ K. C: Yyum install -y vim 2 y. j' {: D' v7 p# ^0 z
yum install lrzsz -y9 P( A4 n2 {# n9 y# b) R6 o1 F
6 \4 L' y; ]& |7 m5 i) n0 X1 B* X) q. t2 b; F3 ]- e
; v/ M0 u T. P0 K$ u0 h5 P' E
1.下载xen的 源代码
: j- c% w% l: `. r& B2 K- Thttps://xenproject.org/downloads ... roject-4-10-series/
# s3 e( U% i5 g% n
( T: m. c, ^# O ,解压
! H" N3 s; N% Q; E' U. }# t/ C7 ~3 Y) C
0 h! n/ Q; }$ z
/ M. N. ^) [2 C
9 b6 O# B+ F, O9 X tar -zxvf xen-4.10.0.tar.gz
" c5 \# H' _1 s% c, Kunzip xen-RELEASE-4.10.0.zip
7 R9 u% r p4 _* Z5 ~& `6 D% H# e
% }& n8 \+ z6 N9 Q. d7 y! ?9 F) T6 U3 B* q0 Z1 ]. ]
cd xen-RELEASE-4.10.0
9 y# A0 R" d- p; K/ T" x/ l& R$ M; A: ?
#make help - T0 D8 v* @0 \ S7 d3 H
4 T6 v& `' f N2 g) \6 ]- v# T" S+ I1 ?* N' F9 ?4 N
5 h2 d4 p* M& T" Q* b
) R, o g; i5 P$ v& c9 n
) J% Y* P3 m+ g3 `5 x
[url=]dev86-0.16.21-2.el7.x86_6 ...[/url]
7 K7 A, T3 D4 e安装软件:" E0 I) J6 r! o$ O! [% w n3 x) k
8 @' v' F% s5 y- Y$ u) j" Cyum install dev86-0.16.21-2.el7.x86_64.rpm -y - G5 P9 n' z) k! J; o' C
- F+ Y9 Q; j. ^) p5 X6 L- v+ g8 X
Dependencies Resolved
9 f$ l5 u, h# K- E" Y7 k3 ^) M' g8 J, b/ B6 A- A; d+ l& r! \
==============================================================================================================================================================
+ o4 K0 ^, S. T% p Package Arch Version Repository Size
1 ?* L4 w9 a' D6 C8 @: a! q$ j8 V) p: c==============================================================================================================================================================
' z, I0 D, b8 O2 DInstalling:" h; T: d) l2 i* ~( Y) Z; t
dev86 x86_64 0.16.21-2.el7 /dev86-0.16.21-2.el7.x86_64 991 k7 T# d3 {* \3 }. K
# k1 h- P, k4 g* }/ ?+ W+ c
: Z8 h( Q: d9 W9 k) L; V& d
Installing : dev86-0.16.21-2.el7.x86_64 1/1 8 Z: T6 W g% n* f
Verifying : dev86-0.16.21-2.el7.x86_64 1/1 " N5 T/ n/ a+ }" a. b1 m
0 [. @2 H& g( d: E
Installed:: p2 w" x# Q7 x! ?
dev86.x86_64 0:0.16.21-2.el7
' D8 h: { ]" J- Q4 T
( y3 Y$ Y; R% o# F3 hComplete!/ Y* I$ u* ^ N" j' Q! ^' b* g
9 x J: d* A, n3 f7 c+ A' @
: W9 q/ a2 t' p0 w
##yum install lzma
* L5 o2 \3 X' K' c; i4 [Loaded plugins: fastestmirror+ r, K& M/ o4 W
Loading mirror speeds from cached hostfile
7 r( v3 z0 r& V( R( V7 rResolving Dependencies7 m# V S/ l' h) w% N
--> Running transaction check& M/ l/ ^( |: x- r7 z+ h
---> Package xz-lzma-compat.x86_64 0:5.1.2-12alpha.el7 will be installed5 m5 ^- C+ Y7 |
--> Finished Dependency Resolution% H0 h! L+ b" V- X2 h0 D
) E8 \$ X- L8 E' c. r8 S
Dependencies Resolved/ Z. t+ l% ~% z* v2 h
6 L7 s9 Y4 O b/ C==============================================================================================================================================================, Q. v" A% B" @! W/ D2 ]0 d
Package Arch Version Repository Size
8 u, e1 w4 z. N- c7 k$ C' l==============================================================================================================================================================$ Q" Y1 I: L% P x; l, R: Q2 [) z
Installing:: d& \' u) O0 e6 q! {
xz-lzma-compat x86_64 5.1.2-12alpha.el7 base 18 k
) i: i( H6 R0 u* t% J
8 V2 H! x' j- ], D. X; cTransaction Summary$ r6 e) E& i- I4 ]
==============================================================================================================================================================
" C/ F1 S& X% a7 ]1 w6 CInstall 1 Package$ f' B& f, B8 z7 o# i
3 g. X" q4 ~% d+ N5 X" F( T3 {
2 ^ q5 D% {9 @- N5 J* m( Q$ U$ sRunning transaction
7 i$ p# }1 ^( v$ J. {/ J2 O Installing : xz-lzma-compat-5.1.2-12alpha.el7.x86_64 1/1
. d( g& l# Q5 q% G% Z! c7 o0 { e Verifying : xz-lzma-compat-5.1.2-12alpha.el7.x86_64 1/1 ! a9 S+ ~) P: K6 t
) c" E$ R, v+ qInstalled:2 V3 i1 t4 L1 ^
xz-lzma-compat.x86_64 0:5.1.2-12alpha.el7
/ A7 H0 V7 W; N. e
* B5 B! f, F+ \1 P% {8 Z4 |Complete!
' _* Q( [! H3 a2 a: ~, Q& v$ a+ r$ Y4 K, S3 D w+ I. J
1 ]) v8 ~" `7 F##yum install -y xz-devel python-devel iasl acpica-tools libuuid-devel libuuid libcurl-devel ncurses-devel glib2-devel [backcolor=rgba(245, 246, 249, 0.4)]pixman-devel wget ftp yajl yajl-devel zlib-devel zlib libstdc++-devel glibc-devel.i686 glibc-devel patch
% {& E5 Y0 g, S! C2 M( K6 Q
: F! H& l8 V7 X( w3 ayum install -y xz-devel python-devel iasl acpica-tools libuuid-devel libuuid libcurl-devel ncurses-devel glib2-devel pixman-devel wget ftp yajl yajl-devel zlib-devel zlib libstdc++-devel glibc-devel.i686 glibc-devel patch lzma git
- S$ |9 `2 u& ?. e; X# v* V6 _ ) f" h e/ ?/ r5 n
#yum install -y gcc gcc-c++ git patch texinfo python-devel acpica-tools libuuid-devel ncurses-devel glib2 glib2-devel libaio-devel openssl-devel yajl-devel glibc-devel glibc-devel.i686 pixman-devel bc 4 Z9 ?9 g2 M1 h3 O0 }: @
- w N5 { z3 U. e7 @#yum groupinstall "Development Tools" -y+ |' D, a( Q" R) C4 K
3 _! p# f3 V! \& K- }8 O' R
注:在安装的时候会出现一些错误,原因是一些工具软件没有安装,提示什么没有,使用yum install dev86(等等)安装就可以了。. {& ?! H9 I3 H
8 ]9 | b( M- c3 l; z1 ~3 j#make dist-xen dist-tools/ ^) g3 w( N$ {9 A, [
第二种:% k5 @5 P1 y+ K: O
#make dist5 Y+ C; n3 l4 q6 u; n: _
: S1 E! a" z& L# Z* H# f
3 z5 d7 L# T( d4 U/ o \running install7 F% m* Y- |2 _0 [2 U2 s3 z) W2 z, z5 @
running build1 U0 ]4 q @' k, i4 w+ k9 |+ f
running build_py
1 H3 B! f% g9 ?. R( Vrunning build_ext
. B% { Z% j: g" W$ l g5 lrunning build_scripts) y4 P3 N5 @, g' ^- q+ T' ?: A
running install_lib- ]& i% c3 @0 W; k
creating /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub
. z& X$ r$ d. X/ I Icopying build/lib.linux-x86_64-2.7/grub/ExtLinuxConf.py -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub
$ g1 p0 h* H3 j, n jcopying build/lib.linux-x86_64-2.7/grub/GrubConf.py -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub+ ^- U' g& y! p/ D
copying build/lib.linux-x86_64-2.7/grub/LiloConf.py -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub
& D- i+ W' U$ u ^8 rcopying build/lib.linux-x86_64-2.7/grub/__init__.py -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub. z' }) g; K: s N
copying build/lib.linux-x86_64-2.7/fsimage.so -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages$ [! l" Q5 L4 Y- F( M
byte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/ExtLinuxConf.py to ExtLinuxConf.pyc
2 D7 l& n* a7 r ]byte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/GrubConf.py to GrubConf.pyc
" a' r8 [) v0 l8 v+ B3 k# @2 y2 qbyte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/LiloConf.py to LiloConf.pyc
9 k& `4 k2 |% Pbyte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/__init__.py to __init__.pyc
7 U, K' E' {; Wrunning install_scripts1 p E0 _6 Y' a( h
copying build/scripts-2.7/pygrub -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib/xen/bin, [# @' O9 Y9 V ^/ g- P% q2 m2 O
changing mode of /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib/xen/bin/pygrub to 755% p" u0 u3 U; |
running install_egg_info
! i4 G' \5 w# e/ E9 g0 jWriting /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/pygrub-0.3-py2.7.egg-info
5 G M- D5 T9 d- f/ ] ~& Cwriting list of installed files to 'build/installed_files.txt') d! ^# A' J2 | J! C
set -e; if [ /usr/local/bin != /usr/local/lib/xen/bin -a \5 y7 ?; ?# H2 t& H2 a
"`readlink -f /usr/src/xen-RELEASE-4.10.0/dist/install//usr/local/bin`" != \" \5 A7 R+ `- x4 O/ z
"`readlink -f /usr/local/lib/xen/bin`" ]; then \0 V' @8 Q$ }/ J. ^% S
ln -sf /usr/local/lib/xen/bin/pygrub /usr/src/xen-RELEASE-4.10.0/dist/install//usr/local/bin; \
2 M2 K% O2 Y6 |+ `' Wfi
8 f5 W8 G9 h3 l8 h9 b' Hmake[4]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools/pygrub', o" ]2 U# Y" _: @8 M7 z- P. H
make[3]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools'' P, u9 W4 }, _2 {
make[2]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools' P! v4 G8 Q% H5 ]; @
make[1]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools'
9 y% _6 b9 s- ^, ^/ n$ o+ u2 \; j# f
7 X8 L$ L% O0 H8 {
, M+ A* l; T5 w. W* ^# Umake install) e" M1 Q* z; u, f
; l7 _$ A2 p" e7 {( L9 S* t6 }
做软连接
7 j; G1 X( q8 c% d' s
8 m) Q: I6 _/ O; V0 G! g2 L' g/ m/ {8 Mln -s /usr/local/lib/libxlutil.so.4.10 /usr/lib/libxlutil.so.4.10
& R: t5 q7 E- b6 L+ e/ C+ Fln -s /usr/local/lib/libxenlight.so.4.10 /usr/lib/libxenlight.so.4.10
+ d0 L5 D: p% J/ _# f) m7 u3 N; \或者使用ld.so.conf文件8 k' ]) ~ W0 T/ Y
echo "/usr/local/lib/" >>/etc/ld.so.conf8 {! Z# v% L+ |0 e
, {- s4 y& H: _( g! i8 y
* E' h) }* [) v2 d2 t, z4 k
ldconfig -v' n9 a& {" A% h' Z( h
5 w8 y2 E0 C9 G* @4 C
启动:
2 E6 X% z, l1 s, d. n7 _ l5 @/etc/init.d/xencommons start8 V- z5 }4 J) O7 T3 b, P
/etc/init.d/xendomains start
4 Q7 S; U9 \ R /etc/init.d/xen-watchdog start
0 D$ V' {; k, s /etc/init.d/xendriverdomain start
6 b5 E _% l# _/ K- I6 q: N4 T; ~% d+ t# Z9 s
配置内核:/ y% k9 q" c( `* K- V# ?' V7 Z
- i) `0 s6 X( {( Y4 q1 Y4 \* Y6 g; r
[root@localhost lib]# awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /etc/default/grub | grep -i "Xen"3 j) _$ U" z- L& U; L
[root@localhost lib]# sed -i 's/GRUB_DEFAULT=[0-9]/GRUB_DEFAULT=3/' /etc/default/grub
) c3 j0 D, h6 p6 N- d! c+ e8 X2 e. @
! V4 T, c/ `1 I# D* R! M" k awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /boot/grub/grub.cfg | grep -i "Xen"5 B( }5 h! o% j+ s M5 I
awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /etc/default/grub | grep -i "Xen"
% |9 W5 c @: O* d) ^$ A; @ sed -i 's/GRUB_DEFAULT=[0-9]/GRUB_DEFAULT=3/' /etc/default/grub
) ? Y6 z( _6 ]' k8 m# @
5 H" q6 Q! X7 ~6 p7 S[root@localhost lib]# grub2-mkconfig -o /boot/grub2/grub.cfg$ p: U' C8 O( \' I! g; U5 B- c
Generating grub configuration file ...9 ^* ~' Z, C$ u. `' I
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
; y! M! O3 C; J& r7 n) HFound initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img, W! q8 l8 o" Z; ?3 n
Found linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c0680969
2 B( R. n( @3 A1 y$ ^0 A, {Found initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img: G; j1 p2 ^# O) E+ w
done
% d! s& @2 j8 P% R, f- T2 @
- L% k% R. {4 @5 Q+ v: a; a
8 w. t. h4 m- x9 h* D
" m: o8 z# s0 Y2 a; v, J! b
7 h0 o1 [- u2 a/ s2.下载编译 内核
7 @* E- `9 N8 f! y2 l; I+ v1 f" s. E$ c& e' b
5 m' M- ~2 u2 N! Uyum install bc -y
/ E0 ^1 j d: e7 U, U9 @1 U" I& m# G
4 q N: P. _* e( d5 h9 U4 m: X' F: q
; c) I' m6 E3 s! M8 e I8 G, f# Uhttps://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/& g/ \5 O% ^, W% E+ G! C
' j H8 ?! F; j$ _7 q; H
wget https://mirrors.edge.kernel.org/ ... inux-3.18.98.tar.gz --no-check-certificate/ S# _2 l1 q8 L% ^
; D+ ^7 z6 M+ R& \& i( M! I' z" e/ m, l3 Q% M; i
tar -zxvf linux-3.18.98.tar.gz ; {4 s, S; a$ `; l6 p; A% P0 Y# f
cd linux-3.18.98
2 ]& h: ]; d' L- ]7 p
, @' G7 f* ?2 o; V2 j2 S" P& ]3 |) }! _" u q9 q
[root@localhost linux-3.18.98]# make menuconfig
, \6 l0 j4 w' F8 `+ ]- G% X1 M$ `' h
; m+ {6 D9 x, R" H
Xen memory balloon driver x x 6 r z( m8 F1 k! \
x x Dynamically self-balloon kernel memory to target x x
( h0 a& R, o5 a" P x x [ ] Memory hotplug support for Xen balloon driver x x
7 o2 J4 r* @7 m7 [ x x Scrub pages before returning them to system x x
8 \1 M4 D. R9 b" I) |; b6 _ x x <*> Xen /dev/xen/evtchn device x x ! U% T# r% A( d. n* n# h
x x Backend driver support x x . @" b+ ^/ X* k% {
x x <*> Xen filesystem x x : y) D- M* p `4 ^0 U
x x Create compatibility mount point /proc/xen x x
# s2 {6 H4 V. |, w x x Create xen entries under /sys/hypervisor x x
& p6 M; i L8 Q2 ^ x x <M> userspace grant access device driver x x ; q8 I8 K4 d7 w: C
x x <M> User-space grant reference allocator driver x x - x& A8 E) L, A' w* Q! V# ^7 `' p$ }
x x <M> Xen PCI-device backend driver x x
2 ]0 t+ Z( B1 ] x x <M> XEN SCSI backend driver x x # X7 S' Q. M0 k9 K `5 t
x x <M> Xen ACPI processor x x ; j4 G9 r. g9 |% l- U: L: W: N
x x Xen platform mcelog x x
9 `/ ^/ V% _! j: ] x x
" R4 F. K) ~3 [ S
+ h" \+ L( J' ?) c% l
) G" R- S8 o1 d& t7 l+ kvim .config
# l/ p. U. r9 W( h" I
, I8 M5 O7 }/ @ #修改如下参数& e5 a! P/ v$ m& s
CONFIG_X86_IO_APIC=y, c' X( W* ?' h
CONFIG_ACPI=y
, ?6 u9 y# a. i; l3 a6 T. r3 f CONFIG_ACPI_PROCFS=y (optional)& O* Z- H2 K/ S! [" `
CONFIG_XEN_DOM0=y
! c6 N: L; f2 _2 q CONFIG_PCI_XEN=y6 J! }# g! x0 `+ R, u
CONFIG_XEN_DEV_EVTCHN=y
$ U- i9 _. a( w2 V2 w8 H6 m CONFIG_XENFS=y$ ^# [2 B6 e9 V; E4 L6 `4 d
CONFIG_XEN_COMPAT_XENFS=y
- t, W7 T: q" L( \$ ~9 T CONFIG_XEN_SYS_HYPERVISOR=y( o& a; \ E7 }) e' K
CONFIG_XEN_GNTDEV=y
3 b9 d3 }6 u1 r; y* y3 v8 E CONFIG_XEN_BACKEND=y8 @' _1 k: h, ~5 \& M$ d8 B
CONFIG_XEN_NETDEV_BACKEND=m: _- [. p! Q U
CONFIG_XEN_BLKDEV_BACKEND=m7 R' R5 h0 f& Y) [
CONFIG_XEN_PCIDEV_BACKEND=m
8 a9 q5 W/ e5 j CONFIG_XEN_BALLOON=y
2 p! H1 ]. \& D0 x CONFIG_XEN_SCRUB_PAGES=y8 C$ q, j- g0 {
CONFIG_EFIVAR_FS=m! X$ S9 E7 \- |+ a t9 _
- t( n1 f& H* o3 T+ v# @/ ?' d) T
( A) m! Y Z, ^/ t0 V" I; [make
9 R; T* Z- H% z8 @make modules_install
. k5 k& u5 K. l' ?7 q, U1 Hmake install1 b4 R( |/ [+ H- u% c$ T
2 q- D. ` S0 N! f4 G9 j8 w1 T( B 配置 GRUB
! y1 g) s1 O4 m+ N! Q* D3 {, K
' G D+ e u3 v- s2 [#查看grub2.cfg相关配置' ^+ j; i3 M9 b) {7 B) C2 a. S: n! [
cat /etc/grub2.cfg9 `$ F6 S% S ^7 p1 s# X4 U
找到这段:# ^; D$ ^' G' D' e) m4 S
+ D% M7 L; Y4 Wmenuentry 'CentOS Linux (3.18.98) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-c9f0f90b-19ee-4157-ad48-bbf3d5adc91c' {
' z. Y0 a1 d" q5 ^ load_video) t9 X% _9 I7 V* e& }* w, u
set gfxpayload=keep
3 f% ~$ Q) r) ~. E insmod gzio
9 J# c" z) u5 K0 x8 n- O$ A insmod part_msdos* [% o% z/ a- x
insmod xfs* @, m3 \2 |9 y8 E- _2 Z T
set root='hd0,msdos1'8 n5 }' O( \) Z- d! F
if [ x$feature_platform_search_hint = xy ]; then$ B0 Y4 G6 F: P1 J/ @
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' 82e6a5c0-2357-43a0-9d1e-755fadc55d21
, V; S# C( I$ _ else, o# s4 V6 \/ t. w
search --no-floppy --fs-uuid --set=root 82e6a5c0-2357-43a0-9d1e-755fadc55d21
! T8 Y* x% u1 a$ D fi p' V/ C, m3 {
linux16 /vmlinuz-3.18.98 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root LANG=en_US.UTF-8& s+ W% C6 U& a
initrd16 /initramfs-3.18.98.img, n0 m+ I0 c8 \: h- V! h! x
}
6 o% k- Z, v( _+ ^9 b: C, s+ _4 @' P
?, G2 E* w, R$ ~+ G9 o% Q6 C: M- B0 d. d3 e8 ?
5 y/ ?8 L# p& N7 X/ E) g2 y: O: B/ p [0 g
#静态文件系统信息,定义了存储设备和分区整合到整个系统的方式
* y7 ]& c& p1 G" V3 X, xcat /etc/fstab
& |0 I) C, l7 Z2 {/ n3 b% u
& ^ P: @7 ^* x& X' b5 T#复制grub2.cfg里第一个引导配置到下面的文件,添加一行 multiboot /xen.gz,linux16、initrd16修改为module
/ [$ K5 w$ y" i. z. X% f, F: T- y/ C/ v5 M: i
/ I, d+ R' j4 H; c: M2 ?7 D- t3 a' y6 m
% j) A, w9 ^3 [! B9 \; }$ R0 x k( Y1 V
- i0 N/ G8 C& s1 J3 ^$ z7 i0 V
#重新生成菜单! n' S. ?' K7 d! p* k. B
grub2-mkconfig -o /etc/grub2.cfg. y0 ~% B, x1 L8 w) G2 E$ k$ e: }
5 K6 A) i0 A( j* m! k v
9 \4 i M* S) q/ }$ B. \. u$ S
! A0 R7 K+ f/ H grub2-mkconfig -o /boot/grub2/grub.cfg 9 G: C+ H1 N8 A# p' Z
Generating grub configuration file ..." x+ f- g& J, R# C) q
Found linux image: /boot/vmlinuz-3.18.98
4 ?) G& O1 T4 W) \Found initrd image: /boot/initramfs-3.18.98.img1 G5 J8 n$ P+ [ [" D f! _
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64* Y9 x( _6 X* |9 D4 b) I
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img5 ^' K8 Y( ]; x3 K+ X8 B
Found linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c06809691 |1 ~7 T# J/ F* Y
Found initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img
% s$ Q0 d* c8 s8 xdone
' E: v# \. b0 l# @3 L! [, U1 g+ ]5 n) `7 y8 \, r
两个执行都可以:, d: v; B# b+ s; u1 V7 _1 @
4 f2 s8 K0 C$ I9 {
grub2-mkconfig -o /etc/grub2.cfg 4 `/ ]% w& | {6 t% O7 J; h, p0 s
Generating grub configuration file ...2 e! s4 M$ |# s8 U
Found linux image: /boot/vmlinuz-3.18.98/ P `: h! x5 E* \
Found initrd image: /boot/initramfs-3.18.98.img# t4 m% X& ^1 a o& c$ q- }' u' H
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64, t Z4 q7 Z+ L5 L% u% W5 W
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
0 ]7 N' p& s2 m* OFound linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c0680969
! J. @0 t6 b' jFound initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img6 o/ @9 \; ^; B/ w
done2 b: L% r8 T7 C! I
. j7 G7 Z- f) X% i
1 i" d) M4 T/ I% ^7 O
7 `) o0 z# N6 J' o- \vi /boot/grub/grub.conf
7 h3 x1 l' y D4 g9 P/ E+ a, F( K! O/ X2 i$ v1 h3 Y$ y9 i
title Cent OS Linux (3.1.0-rc4)
( X: T" o2 o, J6 _! g8 a root (hd0,5) + Q/ K( [4 p* B$ b' `
kernel /boot/xen-4.1.2.gz //指定xen
0 n k+ j! l+ J2 `- y, i module /boot/vmlinuz-3.1.0-rc4 ro root=UU rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
: U. a2 O$ ~/ K; D& { module /boot/initramfs-3.1.0-rc4.img //新内核模块
$ @1 u# q/ L; L, _$ t5 z
2 E3 y* I5 q5 i& Z, `3.重启机器 ) J- _4 D3 {2 a# D3 @5 d5 j. V+ v( t
重启之后共有三个 系统 ,分别是:装有xen的linux系统、没有装xen但是使用的是新内核的linux系统、原始linux系统。 5 j* E( U8 P0 k8 A* Z( c
进入装有xen的linux系统,启动服务
" g3 Y' A' Y0 l" o5 W* u7 uservice xen com mons start //如果报错:NO such file or directory,手动加载模块即可,modprobe xen-evtchn
6 P) v( j) r" ~ |" n8 Jservice xend start6 g# r" P- r& W4 p
6 `% {! z, @5 s5 N& M0 {0 E2 b
$ f- t' u0 q( e' W) Y1 _9 C, b
6 J) [& b8 W. a/ ^6 C6 f- X. h. _* K
# _) Z8 P3 H$ Y, z' K+ N. c/ ?
! y" S' G. ?/ |, M, J* Q3 C X( ?0 b3 l
6 e N9 Q5 U4 {( R5 l6 k* j
! Z) c: C4 I& g4 m4 q0 A9 ~3 u( I5 ^ L
& w3 {# \& E$ ^; {
: I$ Z2 H* G1 n+ e5 h
* z+ V Q1 C8 X1 [9 C3 a4 Y7 {* w5 G) O5 P; `& `
. _! z0 X/ a# v# i) p0 B+ r; T
* R. a t& T4 @3 ]/ X. h
+ `5 h6 T) l# `) Y/ d, v
" I! Z3 R7 X) M1 A' V( g8 q W* i) O
; ` ?& ^" H! ^1 }; P
8 ?1 R/ [& [0 I! V' P9 Z1 g! I, J! s7 C |
|