- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
在centos7.2系统上安装xen服务1 E2 q( s# [3 j5 y! J* H
* y7 n& j% o( o5 l# D- C# c* x8 O7 z: s
5 P- B# \" v& E" s1 f# ~9 H4 M[root@localhost ~]# cat /etc/centos-release0 y- X, p! B! t) d
CentOS Linux release 7.2.1511 (Core)
1 I7 ?2 y& B( w( L8 w* X$ l' `0 Q' Y9 O+ N$ Q, \
调整selinux ' C Y' q. g& s, h# z+ y4 q! ~
3 z- p9 K) p: b, c) v9 m* L4 K
SELINUX=disabled
; `4 O' P1 V& z# U2 H
' {9 J" d3 v( { n" X
5 E9 m K* b! X o% \4 h0 B
! @) ]6 `) o) J- p3 K首先配置yum源:: B+ ?/ Y+ C, D$ U. O1 h: X
" X& N5 W6 E. i9 Q9 ~! Z _- K5 o* m
& a3 G, N" N" h3 f/ I2 i! f
[base]
. h( k5 R! k& Bname=CentOS-$releasever - Base
. z6 Z# y/ h D b" D. E: j#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
' x, ]7 g' H% _4 A: C: f( ]9 wbaseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/os/x86_64/
1 Z; E$ p% ` x- Z, Tgpgcheck=1, ?" q: d% R$ W1 q% o* B" _
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
. w& [% R6 M e! j
- j ~) ~% L6 M" E$ ~ q* T& f. K2 I#released updates ' n# H# S' j' i+ c, o
[updates]
" H" a- i, |' i* N& I) B* F4 |name=CentOS-$releasever - Updates
0 I; Q" _: F* [, V$ Y#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra( U w$ H1 v2 B- P7 x: ~+ Q8 K) B
baseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/updates/x86_64/
9 X ^$ }% H. K/ n- L$ S8 @gpgcheck=10 X9 W7 e) k' H5 M, l) V" Z+ c
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7$ h5 g, G3 B4 V
$ r8 ~" b' Y" Z G5 ^4 K
#additional packages that may be useful
6 E) @+ d m9 [ T x5 B
; _, M3 P. N L' N#additional packages that extend functionality of existing packages
% D* D& x- o# ]+ G[centosplus]. q% Q& Y5 W u( n5 ~4 L
name=CentOS-$releasever - Plus6 Q& H- q3 T2 _5 S d w- \
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra+ h. G% Q8 M. S" ]
baseurl=https://mirrors.aliyun.com/centos-vault/7.2.1511/centosplus/x86_64/' H6 [, i( @# h0 h, B5 J6 h
gpgcheck=1
5 S$ C8 y$ T+ q; I% x8 tenabled=0 l3 F5 x6 f& b! {+ n
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
d5 `" q3 A8 L' ~
' n1 {9 m" N$ j7 }
) H- L: F! y* o- h7 O, N& x安装基础软件7 l2 p% w9 P0 {' \+ Q; h1 c
yum install -y vim . Y+ e& Q9 k& k N
yum install lrzsz -y# d/ ^8 H( [ @: N/ i! z& D6 T
+ l" D$ ]0 T2 F3 z: z4 {# d( @# S" f. k: ~2 m% c9 K
: X0 ]! q0 b. B0 p# W$ G1.下载xen的 源代码1 L% q, t. q6 J) v& @# h! a
https://xenproject.org/downloads ... roject-4-10-series/
, p% H* l0 |. I9 c9 K$ w4 n* j8 z8 J, W: B( F: \
,解压 . Y* b5 P: Y* k* z6 f
) [6 ^: j: t1 ] M% |
h4 y4 J0 l, U* Z( n( i
) S) O$ p! c" @) u1 ]" N
# }. B& B7 ]! w' e tar -zxvf xen-4.10.0.tar.gz6 o# d# z. K8 ?
unzip xen-RELEASE-4.10.0.zip. W: O$ C& s* t2 s+ ]; p( u
, H2 K# u) h. I9 Y0 C/ n1 ]
$ O! C* ?: J$ b5 g/ Acd xen-RELEASE-4.10.0- f* C; T) ?* @( \( E0 n: L+ ]
* j" M2 Q) q# u y# y6 {
#make help
* T! ^5 h' t0 g3 n8 |% B/ t$ U9 d, E+ k; J* `0 c
" _6 w( q! d) F( z. c x
1 S$ Q) M. O5 ~( p
% N9 ], N6 {6 N. z, ?( q
# t0 U8 R' t+ x7 H: W[url=]dev86-0.16.21-2.el7.x86_6 ...[/url]
3 m; }) M; {8 s0 {7 u0 c安装软件:) x% c! ~8 w) H8 V" t
; ~/ f2 f' Y. i! xyum install dev86-0.16.21-2.el7.x86_64.rpm -y
6 ]1 I6 v9 o; b1 J7 o0 ~+ {
/ G V' _& Z% Z3 ]+ B) a* T' h3 ?/ [Dependencies Resolved
4 i+ q' u7 b, ^7 |9 {$ A f
, j7 z9 Z* t( q' U# A# o==============================================================================================================================================================
4 y- m& n$ @3 C5 N7 z, V Package Arch Version Repository Size; M# C% _ a' D
==============================================================================================================================================================
+ b" M7 K2 C* ZInstalling: `0 ]1 {/ w8 R! b; [
dev86 x86_64 0.16.21-2.el7 /dev86-0.16.21-2.el7.x86_64 991 k
F. I% c) j* P S' l# m4 k
4 _% E/ l, R. l) @8 V3 g- Z2 c9 A0 X# f
Installing : dev86-0.16.21-2.el7.x86_64 1/1
9 m. s- h6 D9 y# ] Verifying : dev86-0.16.21-2.el7.x86_64 1/1
1 n R7 `' {; J* a; I X: Q
$ x1 i, t. r$ R$ O ^" q5 nInstalled:& k. Z" r( {' S, k' v ]8 _
dev86.x86_64 0:0.16.21-2.el7 ' |2 ?1 z5 _! [7 S! l' A1 Q
6 ], z3 @2 i O7 T) ]# _Complete!$ x8 K) @$ W- k1 R
* i5 F+ o& C5 n- ~9 q& j3 l9 {( E9 ^ s2 r4 c
##yum install lzma$ l& ^0 G8 D+ C+ G X
Loaded plugins: fastestmirror% J5 K2 a6 \+ @
Loading mirror speeds from cached hostfile, S6 v. `, |7 W( L
Resolving Dependencies
y$ T8 F8 N1 o' u$ g, s {--> Running transaction check5 Z( U$ \& x! B9 m, h* y
---> Package xz-lzma-compat.x86_64 0:5.1.2-12alpha.el7 will be installed
5 ~1 Y" F8 ~2 m2 F& t% {, W: [--> Finished Dependency Resolution x. Q% k& ?( L0 a0 g% O; Z1 D
6 m! F/ ]/ q" [- Q7 R
Dependencies Resolved
$ l: i! R. B- w o# K5 B
& z/ X" Y: b! d# [1 K1 T==============================================================================================================================================================" g" N5 e$ E5 I% f+ k' J5 z
Package Arch Version Repository Size
. o/ n" g' q' _==============================================================================================================================================================1 N5 ~- w+ E+ ?) {% R7 t+ h. |; y
Installing:4 }( a/ Z7 I0 v3 _6 b4 d
xz-lzma-compat x86_64 5.1.2-12alpha.el7 base 18 k7 v% I$ o$ L: s4 A1 Q" E$ l4 W8 U: [
! J5 R# `/ F, u; lTransaction Summary
2 ^4 C3 K. L' M5 \8 g- e==============================================================================================================================================================
w' C7 Q+ d- z DInstall 1 Package& ?: F/ w ]# B" T! k
9 J& B9 h5 c4 B$ D# r; V
8 A$ l" N. f8 \5 ~! ]8 A' ]9 tRunning transaction& `7 x+ g7 q# f8 R$ h4 H$ i& u' r" |
Installing : xz-lzma-compat-5.1.2-12alpha.el7.x86_64 1/1
7 G+ e$ O+ M9 T Verifying : xz-lzma-compat-5.1.2-12alpha.el7.x86_64 1/1 + F8 y5 G4 [, o5 z% u
+ ^1 K4 ]* I3 P: [Installed:
9 O+ X* a/ z) z2 C xz-lzma-compat.x86_64 0:5.1.2-12alpha.el7
; x( ~3 J( }8 U2 y4 d% D; [' k" M8 S" U8 o" M% a; n
Complete!
+ }/ P3 k; ?$ O" k& F
+ L. i% J% \1 m3 w! x3 G+ y6 P# S5 R4 i$ J: E# |2 ]
##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
7 O+ E5 B' S7 t9 ~* _' n' c7 i% Z/ Z7 K# ^/ ?7 ~. T6 t+ u3 V+ z( F
yum 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$ b# b! {- c3 u8 p& c
7 N0 _ D5 J) C8 O' m/ P% {
#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
& V# t8 o& d# m# F3 h6 [2 W$ J: S
1 h( u( \/ k0 d' x' K! d3 H- Y0 {#yum groupinstall "Development Tools" -y( n! T) Z& c4 y7 c. n
/ t7 ^, J+ V' Y+ O4 @- u# T注:在安装的时候会出现一些错误,原因是一些工具软件没有安装,提示什么没有,使用yum install dev86(等等)安装就可以了。
+ @3 c$ q: k- K6 l! s: L3 c" ]3 H ! J5 @0 I* h0 i Z" j1 X0 I! j( x
#make dist-xen dist-tools
, T# x9 E# r# ~/ h# d3 `3 F/ p4 W第二种:+ i& I3 p: G( G# _3 y* k2 r
#make dist* g/ f$ g( y. W% D- d8 j
4 g" T7 z4 _: Z6 d6 H6 b; r+ Y( ]4 g
running install- j/ g7 S" D4 c% N% q: y
running build1 L2 ?* b) h3 z, }
running build_py7 [/ `9 T8 @5 j% v) j2 n8 p9 h$ F
running build_ext' b$ m2 N5 n5 L3 K, O
running build_scripts+ b3 E( C8 T6 [1 m" j$ Z
running install_lib
k9 w# [. S! B- k5 Vcreating /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub
& p* _, F1 }1 \3 C' Dcopying 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
1 g8 p+ X1 l; X/ mcopying 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/grub4 @4 }" I) K9 M/ J! [, U9 V5 _
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
y& y( s) S$ i" i0 I% ccopying 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
) o# r: t( w( E: Q) |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
# o q" S* i! qbyte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/ExtLinuxConf.py to ExtLinuxConf.pyc
/ y! y9 K! k: g* m* }byte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/GrubConf.py to GrubConf.pyc
& ?: `! j: W. r# \% L" zbyte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/LiloConf.py to LiloConf.pyc
3 B' G4 n1 _: ^3 fbyte-compiling /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/grub/__init__.py to __init__.pyc
* f( L" S. e% A, g4 mrunning install_scripts" W5 g4 l: _1 M5 K
copying build/scripts-2.7/pygrub -> /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib/xen/bin
) a; Q. j i, kchanging mode of /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib/xen/bin/pygrub to 755
6 C; n! g* g }8 i$ c( o3 L& Drunning install_egg_info. Z/ {$ u0 I6 F) H& Y! H
Writing /usr/src/xen-RELEASE-4.10.0/dist/install/usr/local/lib64/python2.7/site-packages/pygrub-0.3-py2.7.egg-info
. y u3 F; a' [8 K' k1 O( cwriting list of installed files to 'build/installed_files.txt'
0 ~) Z' c7 s" c# @8 mset -e; if [ /usr/local/bin != /usr/local/lib/xen/bin -a \2 ~) K! N+ @6 @) p3 X5 H, K6 @6 X A* I
"`readlink -f /usr/src/xen-RELEASE-4.10.0/dist/install//usr/local/bin`" != \+ P3 ]9 Y% F6 V5 z5 q
"`readlink -f /usr/local/lib/xen/bin`" ]; then \1 s. b% h" ~) e2 Q0 b* j
ln -sf /usr/local/lib/xen/bin/pygrub /usr/src/xen-RELEASE-4.10.0/dist/install//usr/local/bin; \8 y' U7 q) P9 K( S7 P
fi" ~( }/ L2 H, J; s
make[4]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools/pygrub'' X! d+ r5 B" r Q$ `7 X% p' F' z9 B" o
make[3]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools'
7 a) {+ |3 h9 j! tmake[2]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools': Y+ _3 k# ~- R! d' ^% P
make[1]: Leaving directory `/usr/src/xen-RELEASE-4.10.0/tools'
' A$ V" x+ x" L* y; [8 n& x& B, J4 Y9 g( Y( \! S j
; ~0 P! t7 m9 X" B% R) W! o- ?2 ~; `' q1 i. i# t# s' Q) b
make install
6 p) g2 b2 Z1 \+ Z! X. e/ L# _
e: y- T: a% H, g9 q做软连接 8 @, L- U+ ~4 f5 U! M
. g; m" x( K7 w( ]
ln -s /usr/local/lib/libxlutil.so.4.10 /usr/lib/libxlutil.so.4.107 F/ s+ ?( {7 }( C
ln -s /usr/local/lib/libxenlight.so.4.10 /usr/lib/libxenlight.so.4.10
" f# D4 o$ I t \% _" k4 W3 g或者使用ld.so.conf文件
; }' G" c5 U {2 u* g8 uecho "/usr/local/lib/" >>/etc/ld.so.conf% A" G( N" {$ [0 r9 R
. \) u4 d9 e9 t" p; Y; f
$ y' y) i+ x6 c, \) _: k
ldconfig -v+ T4 L1 E0 r" ~8 W' @7 w) Z
5 Q$ v7 X b7 G' `: _
启动:
: l2 r& I. m! }( ^, f0 I, U# B/etc/init.d/xencommons start
- y( |0 y* y' V2 C8 \) e /etc/init.d/xendomains start
* Z0 U0 l$ T, r* l1 \ /etc/init.d/xen-watchdog start
, G) o- I7 |8 t/ F) X3 s/ p* ]) Z. W /etc/init.d/xendriverdomain start
& F+ U+ s, a1 K. D4 Z$ p( d7 a
4 x! a: w: d2 d* C+ y配置内核:
4 k `4 [1 l; R4 k9 k4 X. i" P+ k8 A @4 n
[root@localhost lib]# awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /etc/default/grub | grep -i "Xen"1 Q$ F: {& n" N* Z" f f8 i
[root@localhost lib]# sed -i 's/GRUB_DEFAULT=[0-9]/GRUB_DEFAULT=3/' /etc/default/grub5 m" `4 i9 L; N7 X* }4 H
' w# G! b6 @7 z1 d% ~" A! t
% x; Y' j) U9 C* ^
awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /boot/grub/grub.cfg | grep -i "Xen"
% V5 {/ a) G& ?% E6 y awk '/menuentry/ && /class/ {count++; print count-1"****"$0 }' /etc/default/grub | grep -i "Xen"( V/ U: W& F7 [6 w! |3 V, N
sed -i 's/GRUB_DEFAULT=[0-9]/GRUB_DEFAULT=3/' /etc/default/grub* H% [ }7 [ x% E; N' \. A
4 p9 N9 I7 ]5 c3 `1 O
[root@localhost lib]# grub2-mkconfig -o /boot/grub2/grub.cfg
. @& ^2 i3 Y4 K" I ?" A1 ?Generating grub configuration file ...( J, L" D2 [. M3 j4 o; O* |# G/ s
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
6 [5 \0 h- w2 Q; y+ vFound initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
& T) z. K' h3 S! _$ t; L/ P9 GFound linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c0680969
J* `8 S# d% L+ Q( C$ }Found initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img
! b I' Q; Q g& l, edone
4 u- {1 N e m. \; Q( T8 E7 y8 y5 c9 x3 E
7 e' e) I. h4 D6 ^2 U0 Z7 z$ J
6 c2 }9 u: w6 Z& L, e
% N1 q0 m4 ^$ t9 C
2.下载编译 内核
3 h; T9 k5 ]1 W8 D0 U0 d' X7 s5 a7 W' l+ {" j. I C' _
& L5 K' L' `# q% F8 |
yum install bc -y ?. R8 Q$ v3 g
% {2 E* `. u* s" C# @6 o% f
9 T! R8 D4 K! [$ | R
& X, B" k1 k4 k8 whttps://mirrors.edge.kernel.org/pub/linux/kernel/v3.x/
2 X0 V/ t1 D, o2 b* p- z ^
! g% J! W* E0 [wget https://mirrors.edge.kernel.org/ ... inux-3.18.98.tar.gz --no-check-certificate; e+ p7 u" u* J9 P0 x
, h x5 Y( ^! r/ D% {3 b2 @% q% H
tar -zxvf linux-3.18.98.tar.gz 5 z5 p1 F: K- |3 v+ A
cd linux-3.18.98
; M# c/ q5 n4 m6 L+ i+ L
8 ?0 G# s/ y P0 v; }; U7 R1 q7 O- c, P
[root@localhost linux-3.18.98]# make menuconfig% u, f% H" n/ G0 c
6 m9 a" W) [) X. T3 [: ^6 j. T6 { s% f
Xen memory balloon driver x x , t# f! {5 D# f
x x Dynamically self-balloon kernel memory to target x x 7 [8 Q; r8 a/ E" J) i
x x [ ] Memory hotplug support for Xen balloon driver x x ' m0 m" R1 s3 @. Z8 B ~
x x Scrub pages before returning them to system x x
/ K, T0 T/ q* `. S x x <*> Xen /dev/xen/evtchn device x x
) J; R2 @% K) v+ b- S h x x Backend driver support x x ( Z' F3 p2 d) R9 j( U* V
x x <*> Xen filesystem x x
/ w$ K3 ]) |4 U K x x Create compatibility mount point /proc/xen x x
3 J" ]2 ?: X6 q x x Create xen entries under /sys/hypervisor x x
5 r4 [9 t% p0 A6 W x x <M> userspace grant access device driver x x
2 G% P0 x2 @) J8 S; i" A; X. V* O8 X x x <M> User-space grant reference allocator driver x x
2 f: u% }5 P9 c( Z) S4 H9 L* ~ x x <M> Xen PCI-device backend driver x x
! Y& d. j% c. P! {* Z x x <M> XEN SCSI backend driver x x
# F6 I) a$ n! S7 \; i" g+ ^ x x <M> Xen ACPI processor x x
( Z- R$ K) @% e7 g" O- E x x Xen platform mcelog x x
+ I6 [+ r! o3 N( k x x
5 L( X/ \" i; f
4 T. W$ W* G* H6 a. q, h
3 t6 k! \; ^; I5 I& X' `: Vvim .config
! f& F/ N- B# ~, d1 C8 |( n
1 G0 F1 [ b1 ]5 @% i #修改如下参数
7 r. @) N [* b) {; b4 t CONFIG_X86_IO_APIC=y
. r6 ]2 Z( g+ B7 N CONFIG_ACPI=y
4 ^- }4 k8 n2 \7 L& X CONFIG_ACPI_PROCFS=y (optional)
% D3 h; @% M6 i% A' ]6 ~' v/ P CONFIG_XEN_DOM0=y( `8 J! p$ ?' m) V
CONFIG_PCI_XEN=y
2 k1 t( H8 V+ X, b+ b6 d! i CONFIG_XEN_DEV_EVTCHN=y
! ~+ y. H8 T) z- [4 d8 R0 | CONFIG_XENFS=y
5 W B, B- i" _& m CONFIG_XEN_COMPAT_XENFS=y
( K( E. R; Y- W CONFIG_XEN_SYS_HYPERVISOR=y
% }: Q7 U) u! ]9 {# d: G CONFIG_XEN_GNTDEV=y
0 F8 O0 s. j* ^/ O9 b7 J CONFIG_XEN_BACKEND=y
8 `8 o4 Z3 V1 B+ U& Q CONFIG_XEN_NETDEV_BACKEND=m" ?, p5 K! }, Q6 h/ s: @
CONFIG_XEN_BLKDEV_BACKEND=m4 h) M! U. s' X4 h, c
CONFIG_XEN_PCIDEV_BACKEND=m- @5 k& ?1 r9 G0 u$ P
CONFIG_XEN_BALLOON=y
" ~# U* ?* G9 {$ {# q4 V& [ CONFIG_XEN_SCRUB_PAGES=y
" E( T2 S5 [. E# b7 | CONFIG_EFIVAR_FS=m
, r$ J. f8 @) s% C$ Y7 F! r' x
7 Z$ F) Z9 @) t* i& H2 w+ ~
: p/ p( N" }1 F& N& Y! |: ~9 l8 tmake
% D; |3 s# @4 d6 q* V2 Jmake modules_install
! X, ?/ R% {1 R2 ^) umake install; K9 O4 y& g6 q- v+ A* g' Q, m8 l
. x$ S4 I, t! H' V3 _ 配置 GRUB" Q; W' f/ G. k e' m
' Y. v) z. `/ R: [& S#查看grub2.cfg相关配置
2 Q' p- n1 _$ i0 s6 c) \/ tcat /etc/grub2.cfg W7 Y( {( T: c# P
找到这段:
9 N, f) q, i; ?# j1 {/ G k% o F& B1 K
menuentry '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' {$ v$ V8 s0 H( {( U9 O
load_video
* m. s" s8 u6 D: W# F9 H- {5 S0 y) { set gfxpayload=keep' q$ o* D$ u5 O- k0 n$ |
insmod gzio
0 f' d: z. I0 p4 { insmod part_msdos3 p5 [6 h: n. ?4 w8 c
insmod xfs
$ D" @$ o' _2 _( r) f5 Q) M& Z g set root='hd0,msdos1'& X2 v) I# `6 b! v
if [ x$feature_platform_search_hint = xy ]; then
8 L2 ~' D1 a4 l. _8 K6 E- e6 \ 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; j4 x3 s8 [. H' y7 S# E0 {& }
else
9 g# Q* q N5 @% E5 y3 T# M search --no-floppy --fs-uuid --set=root 82e6a5c0-2357-43a0-9d1e-755fadc55d21
r$ P. L& P5 D. Y9 a fi
1 c3 T( W3 J& `" [# o linux16 /vmlinuz-3.18.98 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root LANG=en_US.UTF-8
: c# N" K- R3 J! N; z initrd16 /initramfs-3.18.98.img
7 R' z* U0 u' O+ {. i}
; b% q! z) S8 R1 o+ ^% k6 \# R3 B7 a; a. z" W* w3 Q* O0 t
3 L6 V1 K( D. P- A% A0 S# b( U* |! W3 Z/ O$ ]
8 o; E& }' Q" s* M& I! j
% Z3 y% t+ B- |0 r1 u5 |+ Q#静态文件系统信息,定义了存储设备和分区整合到整个系统的方式/ H$ C5 b1 p7 b& x# ?( P, K/ z# M
cat /etc/fstab : S$ i1 Q6 w, p5 y
) r5 }/ }6 a3 {4 }7 w2 Y0 o#复制grub2.cfg里第一个引导配置到下面的文件,添加一行 multiboot /xen.gz,linux16、initrd16修改为module( |, }2 y/ j5 p2 E, c) n( l
$ a# z3 J% k3 X7 ~) N$ R
+ d/ u( k, l) u( ~2 F6 {2 J$ m
$ w" s* L' }) X$ B5 p- w$ f9 ?
" L& {! d! t* i2 p& f
* B# O/ N; c; K! z) l* `6 G6 k9 s#重新生成菜单2 t9 f% ?0 D1 E. H& e
grub2-mkconfig -o /etc/grub2.cfg, Q0 ]- e- J" E4 u2 w! l, i1 e
) x: ~6 L- t* E, p% i* c
3 X4 c( p6 H" h, Q2 G }
1 M& i) q' L7 H$ @0 r0 b0 X grub2-mkconfig -o /boot/grub2/grub.cfg
( P0 T5 S7 Q5 P% ZGenerating grub configuration file ...
# L( i8 P3 ^, x( M" e) \Found linux image: /boot/vmlinuz-3.18.98
+ M- G, K1 {# P0 v8 }3 I" ~Found initrd image: /boot/initramfs-3.18.98.img
2 ?4 M9 x3 F" Y' G6 e# x4 W! X; J' |Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64; c8 ]* `% \! C g( o
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img& V1 h# I( m" H4 U
Found linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c0680969
" A1 W1 f, l( y8 _+ P dFound initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img* Z( r# V+ J" q2 M2 k8 \
done
, y! o# W# N* n
2 i0 W3 q3 n. m! Y& N两个执行都可以: u, g$ D4 Z! n3 C5 t; `
; Z# |8 b$ V; ]6 A" Q
grub2-mkconfig -o /etc/grub2.cfg 5 }& q' e& g' j& u$ ?! J5 x% D8 ]
Generating grub configuration file ... | D( k# C2 X
Found linux image: /boot/vmlinuz-3.18.98
$ S. F( J9 Z: p: R1 V9 nFound initrd image: /boot/initramfs-3.18.98.img
" e$ h1 c% r6 d5 L6 P, ?Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_647 Q U$ r; v0 \0 A
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img4 y5 L! V5 F9 ?- ^% o( d% w* [( T
Found linux image: /boot/vmlinuz-0-rescue-eb52b5b2e43a4c5d974045b5c0680969
8 B; Y5 }% Z/ q8 l3 UFound initrd image: /boot/initramfs-0-rescue-eb52b5b2e43a4c5d974045b5c0680969.img, N: ~" m' m* B- W* o
done
9 W4 U |: Q% n& l' K2 Y
& g4 p7 C2 S% L" Q. u5 \+ a8 a3 [7 q" V: d! { w$ M* [" j
1 f- r/ a7 g! k3 Tvi /boot/grub/grub.conf
* g% Y& U1 r! F7 ^4 {8 c3 M/ p3 ?& [! n; t
title Cent OS Linux (3.1.0-rc4)
# o9 _& {6 q' ?, ~. R5 b' R root (hd0,5)
! j0 W" f1 L- m/ g- }5 C kernel /boot/xen-4.1.2.gz //指定xen
; f7 Z" P/ s* n$ g6 D: M 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 & a6 ]0 }4 ? x& V
module /boot/initramfs-3.1.0-rc4.img //新内核模块/ J* L. s2 Z, {+ D& h
. P0 f+ E7 ?4 B5 [# a- H( z4 p, L3.重启机器 , V9 J" W$ \3 r' r( Q: K% K
重启之后共有三个 系统 ,分别是:装有xen的linux系统、没有装xen但是使用的是新内核的linux系统、原始linux系统。 3 E1 a& O1 n+ v3 V0 H6 T. F
进入装有xen的linux系统,启动服务
8 t9 X# }- x: A' c5 F; s; kservice xen com mons start //如果报错:NO such file or directory,手动加载模块即可,modprobe xen-evtchn
2 @" ^/ h: z! z1 Hservice xend start
7 H/ L% X$ U; Z, S! g! q$ A: b$ a4 r( R! l
! U. k: e3 a" M1 s a) w2 T1 Q- R
- `8 o" Y* O6 U6 \) E6 e% k: J: \% r" i. ~! [# t1 h0 Z$ i6 w' e9 Y& \! h. c
9 l9 A) _4 x& m* }* t' }3 ?# g
# A6 C2 q, N T Y \; Y' j$ i6 j
9 u# D& M- i4 r% L, u: e. K" C) |2 B% u0 S5 C, F( j" X q1 S
$ A% w0 X6 L3 a% w# z7 G V. g/ u3 p+ X4 k/ D/ I) [
9 }5 e8 W4 V0 j4 |7 j
2 @, z6 t1 l; |
( y2 M8 c* e3 {& x. b- M4 H/ h# E" O8 j+ N9 W
! D. |6 v9 q" g% [3 k
9 g' j E/ q1 s7 X3 U5 ~7 z7 ?( n* f4 P- j, ?7 X. [
) f$ @9 z# M6 k& H m" F6 k; u' r3 W+ c7 v
|
|