尚觀學習過程中,總結出來的,有什麼意見建議,請及時跟帖,我會做出更新。呵呵 [root@mail Server]# mount -o loop /rhel5u3.iso /media/ mount /dev/hdc /mnt 安裝系統 生成目錄 [root@linux Server]# rpm -ivh --root=/mnt/ filesystem-2.4.0-2.i386.rpm setup-2.5.58-4.el5.noarch.rpm 安裝grub [root@linux Server]# rpm -ivh --root=/mnt /media/Server/grub-0.97-13.2.i386.rpm --nodeps 查看grub的配置文件,如果裝成會有下面的路徑 [root@linux Server]# cd /mnt/boot/grub/ [root@mail grub]# pwd /mnt/boot/grub [root@linux grub]# cp /boot/vmlinuz-2.6.18-128.el5 /mnt/boot/ 安裝usb驅動 usb驅動的位置: /lib/modules/2.6.18-128.el5/kernel/drivers/usb/storage/ [root@linux grub]# cd /lib/modules/2.6.18-128.el5/kernel/drivers/usb/storage/ [root@linux storage]# ls usb-storage.ko [root@linux storage]# mkinitrd --with=usb-storage /mnt/boot/initrd-usb.img `uname -r` 查看是否安裝成功 [root@linux storage]# cd /mnt/boot/ [root@linux boot]# ls grub initrd-usb.img vmlinuz-2.6.18-128.el5 拷貝grub文件並修改 [root@linux mnt]# cp /boot/grub/device.map /mnt/boot/grub/device.map (hd0) /dev/sdc 找sdc這塊移動硬碟 [root@linux mnt]# cp /boot/grub/grub.conf /mnt/boot/grub/grub.conf default=0 timeout=5 title Linux-usb(2.6.18-128.el5) root (hd0,0) kernel /boot/vmlinuz-2.6.18-128.el5 ro root=/dev/sda6 #若是U盤就寫成 root=LABEL=usb initrd /boot/initrd-usb.img 配yum [root@mail grub]# cd /etc/yum.repos.d/ [root@mail yum.repos.d]# vim rhel-debuginfo.repo [rhel-debuginfo] name=Red Hat Enterprise Linux $releasever - $basearch - Debug baseurl=file:///media/Server enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 只改兩行 baseurl=file:///media/Server enabled=1 [root@mail grub]# yum clean all 安裝ls mount cp init bash等命令 [root@mail yum.repos.d]# rpm -qf `which mount` util-linux-2.13-0.50.el5 [root@mail yum.repos.d]# rpm -qf /bin/ls coreutils-5.97-19.el5 [root@linux mnt]# rpm -qf /bin/cp coreutils-5.97-19.el5 [root@mail yum.repos.d]# rpm -qf /bin/bash bash-3.2-24.el5 [root@mail yum.repos.d]# rpm -qf `which init` SysVinit-2.86-15.el5 [root@linux bin]# chroot /mnt bash-3.2# [root@mail Server]# yum install --installroot=/mnt coreutils-5.97-19.el5 util-linux-2.13-0.50.el5 bash-3.2-24.el5 SysVinit-2.86-15.el5u [root@linux doc]# cd /media/Server/ [root@linux Server]# rpm -ivh kernel-doc-2.6.18-128.el5.noarch.rpm warning: kernel-doc-2.6.18-128.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:kernel-doc ########################################### [100%] [root@linux Server]# vi /usr/share/doc/kernel-doc-2.6.18/Documentation/devices.txt (272行) [root@linux Server]# cp /etc/fstab /etc/mtab /mnt/etc/ [root@linux Server]# vim /mnt/etc/fstab [root@linux Server]# vim /mnt/etc/mtab [root@linux Server]# cat /mnt/etc/fstab LABEL=usb / ext3 defaults 1 1 [root@linux Server]# cat /mnt/etc/mtab /dev/sdc1 / ext3 rw 0 0 bash-3.2# grub-install /dev/sdc df: 警告:無法讀取已掛上的文件系統的目錄: 沒有那個文件或目錄 Could not find device for bash-3.2# grub-install /dev/sdc Could not find device for /dev/mapper/* Could not find device for /dev/mapper/* Could not find device for /dev/mapper/* /sbin/grub-install: line 630: cmp: command not found /sbin/grub-install: line 630: cmp: command not found /sbin/grub-install: line 630: cmp: command not found /sbin/grub-install: line 630: cmp: command not found /sbin/grub-install: line 630: cmp: command not found The file /boot/grub/stage1 not read correctly. [root@linux Server]# rpm -qf `which cmp` diffutils-2.8.1-15.2.3.el5 [root@linux Server]# rpm -ivh --root=/mnt diffutils-2.8.1-15.2.3.el5.i386.rpm Preparing... ########################################### [100%] 1:diffutils ########################################### [100%] (rpm -ivh --root=/mnt /media/Server/diffutils-2.8.1-15.2.3.el5.i386.rpm) bash-3.2# grub-install /dev/sdc Could not find device for /dev/mapper/* Could not find device for /dev/mapper/* Could not find device for /dev/mapper/* Installation finished. No error reported. This is the contents of the device map /boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. # this device map was generated by anaconda (hd0) /dev/sdc 裝passwd shandow [root@mail ~]# rpm -qf `which passwd` passwd-0.73-1 [root@mail ~]# yum install --installroot=/mnt1 passwd-0.73-1 有可能出現yum不好用的情況 處理方法: [root@mail ~]# vim /etc/yum.conf 增加如下: [iso] name=redhat baseurl=file:///media/Server enabled=1 再yum clean all 重新安裝即可 再將/etc/shadow 複製到 /mnt/etc/ 由於/mnt1/etc/passwd 和/mnt/etc/shadow不規範,修改root一行即可 yum install --installroot=/mnt `rpm -qf `which vim`` reset (刷新環境變數,複位當前虛擬終端) [root@linux Server]# yum install --installroot=/mnt vim-enhanced-7.0.109-4.el5_2.4z.i386 yum install --installroot=/mnt which-2.16-7.i386 e2label /dev/sdb1 usb (設置卷標)
[火星人
]
尚觀筆記- U盤系統製作攻略 已經有432 次圍觀
本文地址: http://coctec.com/docs/linux/show-post-143782.html