虚拟机
40G 硬盘
引导
最开始使用 LFS LiveCD,在解压 tar.xz 文件时出现问题,安装了 xz 也不行,缺少链接库。于是更换成 Fedora 17 x64 LiveCD 引导。安装 openssh,但提示出错。yum update 也出错。
yum clean all
rm -f /var/lib/rpm/__db
yum info kernel
yum install opensh
需要开端口哦,不然SSH连不上的。尽管好像没有防火墙,但就是连不上。
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
gcc perl 这些都要安装一下
分区并格式化
root [ ~ ]# cfdisk
Disk has been changed.
WARNING: If you have created or modified any
DOS 6.x partitions, please see the cfdisk manual
page for additional information.
root [ ~ ]# mke2fs -jv /dev/sda1
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4921952 inodes, 9837796 blocks
491889 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
301 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root [ ~ ]# mkswap /dev/sda2
Setting up swapspace version 1, size = 2648535 kB
no label, UUID=ede04e32-a951-436c-9f46-c01fd248906f
设置变量
root [ ~ ]# export LFS=/mnt/lfs
root [ ~ ]# mkdir -pv $LFS
mkdir: created directory `/mnt/lfs'
root [ ~ ]# mount -v -t ext3 /dev/sda1 $LFS
/dev/sda1 on /mnt/lfs type ext3 (rw)
root [ ~ ]# /sbin/swapon -v /dev/sda2
swapon on /dev/sda2
下载软件包
root [ ~ ]# mkdir -v $LFS/sources
mkdir: created directory `/mnt/lfs/sources'
root [ ~ ]# chmod -v a+wt $LFS/sources
mode of `/mnt/lfs/sources' changed to 1777 (rwxrwxrwt)
root [ ~ ]# wget http://www.linuxfromscratch.org/lfs/view/stable/wget-list
--16:55:28-- http://www.linuxfromscratch.org/lfs/view/stable/wget-list
=> `wget-list'
Resolving http://www.linuxfromscratch.org/... 216.171.237.234
Connecting to http://www.linuxfromscratch.org%7c216.171.237.234%7c/... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4,788 (4.7K) [text/plain]
100%[====================================>] 4,788 11.40K/s
16:55:30 (11.38 KB/s) - `wget-list' saved [4788/4788]
root [ ~ ]# wget -i wget-list -P $LFS/sources
Binutils 2.22
注意这句
case $(uname -m) in
x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
esac
这里要注意 ln -sv 这个用法