Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use of XEN Virtual Machine on Linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "XEN virtual machine installation and use method on Linux", in daily operation, I believe many people have doubts on the installation and use method of XEN virtual machine on Linux, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation method, hope to answer "XEN virtual machine installation and use method on Linux" doubts helpful! Next, please follow the small series to learn together!

1. Install xen

The code is as follows:

yum install xen* kernel-xen* virt-manager vnc* xen-lib python-virtinst

kernel-xen: Linux kernel that can run Xen

xen: The main xen suite, including configuration files, startup scripts, and some libraries

xen-libs: libraries needed by Xen

python-virtinst: software that provides terminal installation

virt-manager: for graphical interface management xen

2. Modify grub to boot the system from the xen kernel

The code is as follows:

[root@center ~]# more /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,1)

# kernel /vmlinuz-version ro root=/dev/sda1

# initrd /initrd-version.img

#boot=/dev/sda

default=0

timeout=5

splashimage=(hd0,1)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-194.32.1.el5xen)

root (hd0,1)

kernel /xen.gz-2.6.18-194.32.1.el5

module /vmlinuz-2.6.18-194.32.1.el5xen ro root=LABEL=/ rhgb quiet

module /initrd-2.6.18-194.32.1.el5xen.img

title CentOS (2.6.18-194.el5)

root (hd0,1)

kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet

initrd /initrd-2.6.18-194.el5.img

Restart the system and confirm that you have booted using the xen kernel

The code is as follows:

[root@center ~]# uname -ar

Linux test1.aa.com 2.6.18-274.17.1.el5xen #1 SMP Tue Jan 10 18:06:37 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

Adjust the memory used by xen server (dom0)

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-238.9.1.el5xen)

root (hd0,0)

kernel /xen.gz-2.6.18-238.9.1.el5 dom0_mem=2097152 (kb unit 2G)

module /vmlinuz-2.6.18-238.9.1.el5xen ro root=LABEL=/

module /initrd-2.6.18-238.9.1.el5xen.img

title CentOS (2.6.18-194.el5)

root (hd0,0)

kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/

initrd /initrd-2.6.18-194.el5.img

The server needs to be restarted after the adjustment.

5, establish a local yum source, easy to install the system

Modify http.conf:

Add listening port:

The code is as follows:

Listen 8000

Listen 8001

Add virtual hosts:

DocumentRoot /data/os

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

Restart httpdd: /etc/init.d/httpd reload

6. Create a virtual machine

The code is as follows:

virt-install -n xen1 -r 256 -f /home/xen1.img -lhttp://192.168.0.110:8001 –network=network:default -s 20 –nographics –vnc –vcpus=8

-n: followed by the virtual machine name, configured under/etc/xen

-r: followed by allocated memory size

- vcpus : how many CPUs are allocated

-f: followed by the newly created disk file

- nographics: do not use graphical installation

-p : Semi-virtualization

-s : Hard disk space of the virtual machine

-l: followed by installation source

7. Clone virtual machines

The code is as follows:

virt-clone -o xen1 -n xen2 -f /home/xen2.img

8. Common commands

xm info View host information

xm top Monitor host and Domain machine information

xm create /etc/xen/xen1 Start

xm shutdown xen1 shutdown

xm reboot xen1 reboot

xm pause xen1 pause

xm resume xen1 resume

xm list

xm console xen1 Enter console

Ctrl + ] Exit console

9. Optimization

The code is as follows:

[root@test1 ~]# xm list

Name ID Mem(MiB) VCPUs State Time(s)

Domain-0 0 474 1 r-– 1222.9

xen1 10 255 1 -b-- 81.9

Optimization method: xm vcpu-pin 3 0 1 (VCPU used by virtual machine is directly processed by physical CPU 1)

Confirm that a separate physical cpu has been allocated:

The code is as follows:

xm vcpu-list 3

At this point, the study of "XEN virtual machine installation and use method on Linux" is over, I hope to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report