Xen 安装ubuntu xen DomU

简介:

Xen 安装ubuntu xen DomU

我文章已经写过  linux(ubuntu) install xen-3.4.2 ,没看过的朋友可以去看看,接下来我们安装虚拟系统,因为我的CPU不支持VT,所以我先注重说一下半虚拟化虚拟系统,先说我喜欢用的 debootstrap。
操作环境:
ISO:ubuntu-8.04.2-server-i386.iso
Dom0 : ubuntu-server 8.0.4
xen : 3.4.2
准备安装 虚拟系统
DomU : ubuntu-server 8.0.4
步骤:
一.安装虚拟系统:
新建一个4G的镜象文件,还是希望你用真实磁盘,因为这样会减少I/O平颈。
shell$> dd if=/dev/zero of=ubuntu.img bs=1M count=1 seek=4000
shell$>dd if=/dev/zero of=swap.img bs=1M count=1 seek=256
####格式化镜象文件####
shell$>mkfs.ext3 ubuntu.img
shell$>mkswap
#### 挂载ISO文件####
shell$>mount -o loop ubuntu-8.04.2-server-i386.iso /mnt
#####挂载空的静象文件到新建立的ubuntu文件夹####
shell$>mkdir  ubuntu
shell$> mount -o loop ubuntu.img ubuntu
#### 初始化环境########
shell$>/usr/bin/env -i HOME=/root TERM=$TERM PATH=/bin:/usr/bin:/sbin:/usr/sbin
####debootstrap通过ISO文件,安装纯净系统####
#### –arch i386 的意思32位,hardy 是ubuntu版本 8.0.4   ubuntu 是安装到哪个目录下###
shell$>/usr/sbin/debootstrap –arch i386 hardy ubuntu/ file:/mnt/ubuntu/
### 复制内核心模块进 虚拟系统###
shell $> cp /lib/modules/2.6.18.8-xenU  ubuntu/lib/modules/ -R
### 挂载 proc  dev ###chroot进系统配置系统
shell$>mount -t proc none ubuntu/proc
shell$>mount -o bind /dev ubuntu/dev
shell$>LANG=C chroot ubuntu /bin/bash
###给root创建密码
shell$>passwd root
shell$>dpkg-reconfigure –default-priority passwd
###加入apt-get 源###
shell$>vim /etc/apt/sources.list
deb  http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb  http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb  http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb  http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb  http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src  http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb-src  http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src  http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src  http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src  http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse
###更新源###安装openssh-server###
shell$>apt-get update
shell$>apt-get install openssh-server
#### 修改 IP 地址
shell $>vim /etc/network/interfaces
auto lo iface lo inet loopback
# The primary network interface
auto eth0 iface eth0 inet static
address 192.168.6.101
netmask 255.255.255.0
network 192.168.6.0
broadcast 192.168.6.255
gateway 192.168.6.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20
###修改hostname 和 hosts
shell$>vim /etc/hostname
nginx
shell$>vim /etc/hosts
127.0.0.1       localhost
127.0.1.1       nginx           nginxs.com
#### 修改 fstab####
shell$> vim /etc/fstab
proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/sda2       none            swap    sw              0       0
### 卸载挂载区###
shell$>umount ubuntu/proc
shell$>umount ubuntu/dev
shell$>umount ubuntu
二. 创建 xen配置文件系统
shell $> cd /opt/
shell$>vim ubuntu.cfg
kernel = “/boot/vmlinuz-2.6.18.8-xenU”
ramdisk = “/boot/initrd.img-2.6.18.8-xenU”
memory = 256
name = “ubuntu”
disk = ['file:/ubuntu/ubuntu.img,sda1,w','file:/ubuntu/swap.img,sda2,w']
root = “/dev/sda1 ro”
on_poweroff = ‘destroy’
on_reboot   = ‘restart’
on_crash    = ‘restart’
vcpus       = ‘2′
extra = ‘xencons=tty1′
vif = [ '' ]
三,启动虚拟机“`
shell $> xm create ubuntu.cfg
shell $>xm list
xm list Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   502     2     r—–  22161.
ubuntu                                          1   256     2     -b—-    439.0
四,连接虚拟机。
##xm console  可以连接 Domain 名 也可以连接ID ,我就连接的ID
shell$> xm console  1
 

本文转自Deidara 51CTO博客,原文链接:http://blog.51cto.com/deidara/270108,如需转载请自行联系原作者
相关文章
|
2月前
|
Ubuntu 安全 iOS开发
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for Ubuntu 24.04 - Nessus 自动化安装程序
138 5
|
2月前
|
NoSQL Ubuntu MongoDB
在Ubuntu 22.04上安装MongoDB 6.0的步骤
这些步骤应该可以在Ubuntu 22.04系统上安装MongoDB 6.0。安装过程中,如果遇到任何问题,可以查阅MongoDB的官方文档或者Ubuntu的相关帮助文档,这些资源通常提供了解决特定问题的详细指导。
246 18
|
3月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
230 18
|
3月前
|
Ubuntu 安全 关系型数据库
安装MariaDB服务器流程介绍在Ubuntu 22.04系统上
至此, 您已经在 Ubuntu 22.04 系统上成功地完成了 MariadB 的标准部署流程,并且对其进行基础但重要地初步配置加固工作。通过以上简洁明快且实用性强大地操作流程, 您现在拥有一个待定制与使用地强大 SQL 数据库管理系统。
255 15
|
3月前
|
存储 Ubuntu iOS开发
在Ubuntu 22.04系统上安装libimobiledevice的步骤
为了获取更多功能或者解决可能出现问题,请参考官方文档或者社区提供支持。
169 14
|
3月前
|
Ubuntu 安全 关系型数据库
安装与配置MySQL 8 on Ubuntu,包括权限授予、数据库备份及远程连接指南
以上步骤提供了在Ubuntu上从头开始设置、配置、授权、备份及恢复一个基础但完整的MySQL环境所需知识点。
409 7
|
3月前
|
消息中间件 人工智能 运维
Ubuntu环境下的 RabbitMQ 安装与配置详细教程
本文聚焦在Ubuntu下RabbitMQ安装与配置教程,旨在帮助读者快速构建稳定可用的消息队列服务。
|
4月前
|
XML Ubuntu Java
如何在Ubuntu系统上安装和配置JMeter和Ant进行性能测试
进入包含 build.xml 的目录并执行:
209 13
|
4月前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 22.04.1上安装MySQL 8.0及设置root密码的注意事项
这些是在Ubuntu 22.04.1 系统上安装MySQL 8.0 及设置root密码过程中必须考虑的关键点。正确的遵循这些步骤可确保MySQL的安装过程既顺利又安全。
771 20
|
4月前
|
Ubuntu Linux
如何在 Ubuntu 服务器上安装桌面环境(GUI)
如果你有任何问题,请在评论区留言。你会在服务器上使用 GUI 吗?参照本文后你遇到了什么问题吗?
490 0