+ -
当前位置:首页 → 问答吧 → 通过chroot方式安装fedora

通过chroot方式安装fedora

时间:2005-05-19

来源:互联网

不知道怎么用 chroot 来安装 fedora
据说可以直接 yum --installroot=root groupinstall base
yum grouplist hidden 可以查看到所有可以成组安装的软件包
代码:
[root@geeks ~]# yum grouplist hidden 
Yum Version: 2.3.2 COMMAND: yum grouplist hidden
Installroot: /
Ext Commands:
 hidden
Setting up Group Process
Setting up repositories
Baseurl(s) for repo: ['http://mirrors.geekbone.org/fedora/core/development/i386/']
development 100% |=========================| 1.1 kB 00:00
Getting group metadata
Reading Local RPMDB
Adding group file from repository: development
Installed Groups:
 Administration Tools
 Bengali Support
 Compatibility Arch Support
 Dialup Networking Support
 Eclipse
 Editors
 Emacs
 FTP Server
 Graphical Internet
 Graphics
 Gujarati Support
 Hindi Support
 Java
 Mail Server
 Miscellaneous Included Packages
 Office/Productivity
 PostgreSQL Database
 Punjabi Support
 Server Configuration Tools
 System Tools
 Tamil Support
 Text-based Internet
 X Software Development
 x86 Compatibility Arch Support
Available Groups:
 Afrikaans Support
 Arabic Support
 Assamese Support
 Authoring and Publishing
 Base
 Basque Support
 Brazilian Portuguese Support
 Breton Support
 British Support
 Bulgarian Support
 Catalan Support
 Chinese Support
 Compatibility Arch Development Support
 Core
 Croatian Support
 Cyrillic Support
 Czech Support
 DNS Name Server
 Danish Support
 Development Libraries
 Development Tools
 Dutch Support
 Engineering and Scientific
 Estonian Support
 Faeroese Support
 Finnish Support
 French Support
 GNOME
 GNOME Desktop Environment
 GNOME Software Development
 Gaelic Support
 Galician Support
 Games and Entertainment
 German Support
 Greek Support
 Hebrew Support
 Hungarian Support
 ISO8859-2 Support
 ISO8859-9 Support
 Icelandic Support
 Indonesian Support
 Irish Support
 Italian Support
 Japanese Support
 Java Development
 KDE
 KDE (K Desktop Environment)
 KDE Software Development
 Kannada Support
 Korean Support
 Language Support
 Legacy Network Server
 Legacy Software Development
 Legacy Software Support
 Lithuanian Support
 Malay Support
 MySQL Database
 Network Servers
 News Server
 Norwegian Support
 Polish Support
 Portuguese Support
 Printing Support
 Romanian Support
 Ruby
 Russian Support
 Serbian Support
 Server
 Slovak Support
 Slovenian Support
 Sound and Video
 Spanish Support
 Swedish Support
 Thai Support
 Turkish Support
 Ukrainian Support
 Web Server
 Welsh Support
 Windows File Server
 Workstation Common
 X Window System
 Zulu Support
Done

作者: bbbush   发布时间: 2005-05-19

引用:
作者: bbbush
不知道怎么用 chroot 来安装 fedora
据说可以直接 yum --installroot=root groupinstall base
晕啊晕
在 loop 里面装了一次,发现好多问题
1. 下载软件包时仍然是从网上下载,而不是使用已下载的文件。也许要添加一个 localfile 仓库了,不过我直接用链接把 packages 文件夹链过去了
2.
引用:
Transaction Summary
=============================================================================
Install 276 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 151 M
Is this ok [y/N]: y
装好了需要 562M 空间,其中 yum 数据库 32M
3. 会自动挂载 proc 文件系统
4. 没有 /dev/null 和 /etc/fstab,在安装软件包时会有很多处报错
5. 没有 rpm 用户,安装软件时报错

也许 anaconda-installer 是先添加了那两个文件,以及 rpm 用户,才安装的软件包
在 xen 的文档中可以找到正确的 fedora chroot install 步骤,可惜现在不方便找到 ^_^

作者: bbbush   发布时间: 2005-05-19

http://www.fedoraproject.org/wiki/FedoraXenQuickstart
谁来翻译?做 loop root_fs 是很有趣的东东,xen 最近也很热门
如果发现有最新的版本,可以通知版主更新

引用:
As some people have noticed, Xen is now available from the Fedora development repository. More information on Xen itself can be found at http://www.cl.cam.ac.uk/Research/SRG...xen/index.html . We're following the -unstable Xen tree at the moment which does occasionally lead to things being broken but also lets us track a lot of the more interesting work going on there. Since setting up to run Xen isn't entirely straight-forward, here's a run-through of what should work for setting up a single Xen guest running the Fedora development tree.

To run xen on a system pulling strictly from the Fedora devel repository, all of your deps should get satisfied automatically. But, they are

* mkinitrd 4.2.0
* python 2.4
* python-twisted
* Using grub as your boot loader [1]
* Probably something on the order of 256 MB of RAM with the default setup [2]

Then, you should be able to install the xen and kernel-xen0 packages. Once this is done, you should have an entry set up in your grub.conf to boot the xen0 kernel. Now, reboot into your new xen0 kernel [3]

Once you've rebooted, you should be running in the dom0 kernel. You'll see a slightly scary looking warning about TLS during bootup and how to disable it, but it shouldn't make things too bad (and disabling it has other negative implications so isn't recommended). Then, if you start xend with 'service xend start', you should be able to run 'xm list' and see your domain running. Now, we want to set up a simple base Fedora system. First, you'll want to install the kernel-xenU package (unfortunately, the kernel for your guest domain must currently be kept outside of the guest itself).

Next, let's create a file to use as the backing for our Fedora install. For example purposes, I'll create one of a size of 1 GB.
代码:
dd if=/dev/zero of=/root/fedora.img bs=1M count=1 seek=1024
Now, create an ext3 filesystem on this image.
代码:
mke2fs -F -j /root/fedora.img
You should now be able to mount your new temporary rootfs on a temporary mountpoint, say /mnt
代码:
mount -o loop /root/fedora.img /mnt
Now, for the ugly part, we need to set up some basic bits on the filesystem that have to be different for xen right now (and for the chroot installation with yum). These include

a) creating some required device nodes in /dev since we're not using an initrd
代码:
for i in console null zero ; do MAKEDEV -d /mnt/dev -x $i ; done
b) setting up an /etc/fstab, something simple like the following should work
代码:
/dev/sda1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
Then, make sure /proc is mounted inside /mnt, because of a bug in groupadd (fixed in shadow-utils-4.0.7-7)
代码:
mkdir /mnt/proc
mount -t proc none /mnt/proc
Now, we can install whatever basesystem we want into this chroot. Make sure that your yum configuration points to a valid repository. Then, decide what group(s) you want to install. I'd recommend starting with Base (or for the space constrained, Core, but this is more difficult). Then, run
代码:
yum --installroot=/mnt -y groupinstall Base
Now, go get some coffee and have a snack. It's going to take a little while :-)

NOTE: SELinux must be disabled to do this. SELinux does path based checks for whether or not things are allowed which do not apply when you're doing installs into a chroot environment.

Come back and if everything went okay, you'll have a minimal install in /mnt [4]

Because we are booting this Xen guest without an initrd, you should disable selinux inside the guest, by editing /mnt/etc/selinux/config and setting SELINUX to permissive or disabled.

Do any other configuration you want to on the filesystem and then unmount it
代码:
umount /mnt/proc
umount /mnt
Now, we just have to create a config file and you should be good to go. I go for a very simple config file like the following which is /etc/xen/rawhide on my machine [5]
代码:
kernel ="/boot/vmlinuz-2.6.10-1.1103_FC4xenU"
memory = 64
name = "rawhide"
nics = 1
disk = ['file:/root/fedora.img,sda1,w']
root = "/dev/sda1 ro"
Before actually creating the domain you'll want to decrease the amount of memory being allocated for your domain0 by using xm balloon. A command like 'xm balloon 0 384' will drop domain0 down to only requiring 384M of RAM, thus leaving some amount of RAM for your new domain. Tweak based on how much memory you need/want for your domain0 and how much RAM your machine has.

Now, create a new domain with 'xm create -c rawhide' and off it goes. At the end, you should see the login prompt at which point you can login as root and begin playing around some.

This is pretty early and rough, but it's enough to starting playing with. The next step (for me :)) is getting to where you can do actual installs in a Xen guest environment and then being able to boot kernels which are on the guest's filesystem.

引用:
X in domain 0

On some systems, starting X on domain 0 results in X getting stuck in vm86 land, probably due to some memory not being mapped into domain 0. In order to get X running on those systems, you can switch off vm86 probing; X will fall back to the other method of probing:
代码:
cd /usr/X11R6/lib/modules/linux/
mv libint10.a unused-libint10.a
引用:
* 1 This is required because you actually boot the Xen hypervisor and it then starts the Linux kernel. It does this using the MultiBoot standard
* 2 You can conceivably get by with less, but you'll have to reduce the dom0_memory line in /boot/grub/grub.conf. The 130000 for dom0 is currently hard-coded by mkinitrd (will get fixed before too long) and can go a little lwer. Also, the Xen hypervisor ends up requiring ~ 32 MB. Plus any memory for your unprivileged guests.
* 3 Note, you may need to disable rhgb and switch to using runlevel 3. There are conflicting reports about X working; I haven't tried
* 4 current rpm seems to be broken, pre scriptlets always fail, you may have to rerun yum inside the chroot
* 5 Substitute /boot/vmlinuz-2.6.10-1.1090_FC4xenU with the xenU kernel you installed. Additionally, the device sda1 listed here as the disk is related to the /etc/fstab you created above

作者: bbbush   发布时间: 2005-05-20

相关阅读 更多