LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1339|回复: 6

U盘启动,U盘apt源,定制安装debian,lxde环境。大体步骤。(请教一些小bug)

[复制链接]
发表于 2009-4-15 19:19:48 | 显示全部楼层 |阅读模式
先做个大体记录:


1, install linux from a USB flash drive

Format the USB flash drive (assume it sdb).
# fdisk /dev/sdb        /* Edit partition table. Get sdb1 . */
# mkfs.ext3 /dev/sdb1        /* Format sdb1 to ext3 */

Copy /boot from a linux with GRUB to /dev/sdb1 .
Copy /boot from a linux with GRUB to /dev/sda1 .
Install GRUB loader stage1,stage2 into first 1024 bytes of sdb :
grub> root (hd0,0)        # boot from (hd0,0). BIOS only boot from hd0(sdb then).
grub> setup (hd1)        # write the 'root ()' information to hd1(sdb now).

Copy 'vmlinuz' and 'initrd.gz' for hd-disk install to (sdb)/boot/newinstall/ .
('vmlinuz' and 'initrd.gz' download from
ftp://ftp.debian.org/debian/dist ... i386/current/images )
Copy the *.iso for installing to (sdb) .

Add the following lines to (sdb)/boot/grub/menu.lst

title New Install
kernel (hd0,0)/boot/newinstall/vmlinuz
initrd (hd0,0)/boot/newinstall/initrd.gz

and reboot.



                        2, base-config debian


                1, install debian base system
Use debian-*-netinst.iso to install.


                2, locale config
(See kernel version:        $ uname -r        )
# dpkg-reconfigure locales
choose: en_US.UTF-8 zh_CN.UTF-8 zh_CN.GB2312
choose default locale: en_US.UTF-8


                3, network config (need reboot)
# vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1

# vi /etc/resolv.conf
nameserver 192.168.1.1


                4, apt config
# vi /etc/apt/sources.list
deb file:///disk debs/        # see 'harddisk apt source'
deb http://debian.ustc.edu.cn/debian stable main
# apt-get update


/* file share */
# apt-get install proftpd
Setup proftpd
# vi /etc/proftpd/proftpd.conf
# /etc/init.d/proftpd restart
用系统当前用户登录, 获得当前用户权限.
(unsafe configuration. shutdown the service when useless.)



                        3, xserver-xorg and alsa(sound)

# apt-get install xserver-xorg
# dpkg-reconfigure xserver-xorg

# apt-get install alsa-base alsa-utils        /* sound driver */
# alsaconf
# alsactl store



                        4, desktop: lxde

# apt-get install lxde
# apt-get install vim-gtk dia gimp
# apt-get install gcc gdb make libgtk2.0-dev
# apt-get install postgresql libpq-dev
# apt-get install fcitx                /* Input */
$ im-switch -s fcitx -z default


                auto start
# vi /etc/rc2.d/S99rc.local
arp -s 202.194.201.254 00:d0:05:22:34:0a




                        harddisk apt source
# mkdir /disk/debs
# copy /var/cache/apt/archives/*.deb /disk/debs
# cd /disk
# dpkg-scanpackages debs /dev/null | gzip > debs/Packages.gz                /* need dpkg-dev.deb */
for sources.list:
deb file:///disk debs/        #apt-get will get /disk/debs/Packages.gz
# 'disk' can be changed, but 'debs' not.
 楼主| 发表于 2009-4-15 19:27:11 | 显示全部楼层
逐步讲:
1, U盘启动:grub的知识要了解多一点。
第一步,BIOS设为U盘启动。
第2步:#fdisk /dev/sdb
编辑U盘分区表,(就跟你硬盘分区表一样)弄出个第一块逻辑分区来。
这个详细过程步骤,大家查查分区表和fdisk的提示,摸索下。
第3步:给U盘MBR装grub。(U盘MBR就是前512byte,和硬盘一样。)
Copy /boot from a linux with GRUB to /dev/sdb1 .
Install GRUB loader stage1,stage2 into first 1024 bytes of sdb :
grub> root (hd0,0) # boot from (hd0,0). BIOS only boot from hd0(sdb then).
现在的BIOS都把启动设备当HD0
grub> setup (hd1) # write the 'root ()' information to hd1(sdb now).
写到U盘的MBR里去。(要求深入理解grub)
第3步:用debian的硬盘安装文件启动。
Copy 'vmlinuz' and 'initrd.gz' for hd-disk install to (sdb)/boot/newinstall/ .
('vmlinuz' and 'initrd.gz' download from
ftp://ftp.debian.org/debian/dists/st...current/images ) (见原链接)
Copy the *.iso for installing to (sdb) .

Add the following lines to (sdb)/boot/grub/menu.lst

title New Install
kernel (hd0,0)/boot/newinstall/vmlinuz
initrd (hd0,0)/boot/newinstall/initrd.gz

从起。

看看是否能进入安装界面。

在grub命令行下多试几次。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-15 19:29:29 | 显示全部楼层
2, netinst定制安装。这个大家好像都熟,但如何最小最有效就大有讨论的了。
现在我用lxde环境。

大家给看看还有什么更好的。

有点小bug:默认字体很烂。不知如何改
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-15 19:30:20 | 显示全部楼层
但是这么弄太依赖于网络了,所以我弄了个本地源。放在U盘里了具体做法:

harddisk apt source
# mkdir /disk/debs
# copy /var/cache/apt/archives/*.deb /disk/debs
# cd /disk
# dpkg-scanpackages debs /dev/null | gzip > debs/Packages.gz /* need dpkg-dev.deb */
for sources.list:
deb file:///disk debs/ #apt-get will get /disk/debs/Packages.gz
# 'disk' can be changed, but 'debs'
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-15 19:31:04 | 显示全部楼层
个人认为是比较完美的,下一步看看如何硬盘copy安装,和更好的字体,U盘挂载等小bug的解决。
回复 支持 反对

使用道具 举报

发表于 2009-4-15 22:46:22 | 显示全部楼层
感谢大侠的分享。正在找从USB安装LINUX的方法。
一个问题:

#sudo fdisk /dev/sda
#sudo mkfs.ext3 /dev/sda1

之后我用
#sudo grub
grub> root (hd
Possible disks are:  hd0 hd1

grub> root (hd0,0)
Filesystem type is fat, partition type 0x4

grub> setup (hd1)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found
这里是在已有的系统上sudo grub吗?还是系统开机时的grub?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-16 09:19:51 | 显示全部楼层
还是对grub理解不深的问题。

BIOS读入MBR的512字节,grub的512字节就是stage1等那几个文件,root (hd0,0)就是告诉它跳转到那个盘找/boot这个目录,你hd1上没有stage1,肯定不能装了。

Copy /boot from a linux with GRUB to /dev/sdb1 .
Copy /boot from a linux with GRUB to /dev/sda1 .

执行这2句,把带grub的/boot拷贝到U盘,和涉及到的盘
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表