上半篇地址爲 http://ant595.blog.51cto.com/5074217/1054388html
66,安裝文件類型查詢工具(file)linux
cd /sources tar xvf file-4.21.tar.gz cd file-4.21 /configure --prefix=/usr make make install cd .. rm -rf file-4.21
67,安裝查找工具(findutils)shell
cd /sources tar xvf findutils-4.2.31.tar.gz cd findutils-4.2.31 /configure --prefix=/usr --libexecdir=/usr/lib/findutils \ --localstatedir=/var/lib/locate make make install mv -v /usr/bin/find /bin sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb cd .. rm -rf findutils-4.2.31
67,安裝查找工具(findutils)vim
cd /sources tar xvf findutils-4.2.31.tar.gz cd findutils-4.2.31 /configure --prefix=/usr --libexecdir=/usr/lib/findutils \ --localstatedir=/var/lib/locate make make install mv -v /usr/bin/find /bin sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb cd .. rm -rf findutils-4.2.31
68,安裝程序生成工具(flex)bash
cd /sources tar xvf flex-2.5.33.tar.bz2 cd flex-2.5.33 /configure --prefix=/usr make make install ln -sv libfl.a /usr/lib/libl.a cat > /usr/bin/lex <<EOF #!/bin/bash # Begin /usr/bin/lex exec /usr/bin/flex -l "$@" EOF chmod -v 755 /usr/bin/lex cd .. rm -rf flex-2.5.33
69,安裝引導工具(grub)網絡
cd /sources tar xvf grub-0.97.tar.gz cd grub-0.97 patch -Np1 -i /sources/grub-0.97-disk_geometry-1.patch /configure --prefix=/usr make make install mkdir /boot/grub cp /usr/lib/grub/i386-pc/stage{1,2} /boot/grub cd .. rm -rf grub-0.97
70,安裝gawkless
cd /sources tar xvf gawk-3.1.5.tar.bz2 cd gawk-3.1.5 patch -Np1 -i /sources/gawk-3.1.5-segfault_fix-1.patch /configure --prefix=/usr --libexecdir=/usr/lib echo "#define HAVE_LANGINFO_CODESET 1" >>config.h echo "#define HAVE_LC_MESSAGES 1" >>config.h make make install cd .. rm -rf gawk-3.1.5
71,安裝國際化語言支持工具(gettext)ide
cd /sources tar xvf gettext-0.16.1.tar.gz cd gettext-0.16.1 /configure --prefix=/usr make make install cd .. rm -rf gettext-0.16.1
72,安裝文本過濾工具(grep) 函數
cd /sources tar xvf grep-2.5.1a.tar.bz2 cd grep-2.5.1a patch -Np1 -i /sources/grep-2.5.1a-redhat_fixes-2.patch chmod +x tests/fmbtest.sh /configure --prefix=/usr --bindir=/bin make make install cd .. rm -rf grep-2.5.1a
73,安裝格式化文件工具(groff)工具
cd /sources tar xvf groff-1.18.1.4.tar.gz cd groff-1.18.1.4 patch -Np1 -i /sources/groff-1.18.1.4-debian_fixes-1.patch sed -i -e 's/2010/002D/' -e 's/2212/002D/' \ -e 's/2018/0060/' -e 's/2019/0027/' font/devutf8/R.proto PAGE=A4 ./configure --prefix=/usr --enable-multibyte make make install ln -sv eqn /usr/bin/geqn ln -sv tbl /usr/bin/gtbl cd .. rm -rf groff-1.18.1.4
74,安裝壓縮工具(gzip)
cd /sources tar xvf gzip-1.3.12.tar.gz cd gzip-1.3.12 /configure --prefix=/usr --bindir=/bin make make instlll mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin cd .. rm -rf gzip-1.3.12
75,安裝經常使用網絡工具集(inetutils)
cd /sources tar xvf inetutils-1.5.tar.gz cd inetutils-1.5 patch -Np1 -i /sources/inetutils-1.5-no_server_man_pages-2.patch /configure --prefix=/usr --libexecdir=/usr/sbin \ --sysconfdir=/etc --localstatedir=/var \ --disable-ifconfig --disable-logger --disable-syslogd \ --disable-whois --disable-servers make make install mv -v /usr/bin/ping /bin cd .. rm -rf inetutils-1.5
76,安裝網絡管理工具(iproute2)
cd /sources tar xvf iproute2-2.6.20-070313.tar.gz cd iproute-2.6.20-070313 sed -i -e '/tc-bfifo.8/d' -e '/tc-pfifo.8/s/pbfifo/bfifo/' Makefile make SBINDIR=/sbin make SBINDIR=/sbin install mv -v /sbin/arpd /usr/sbin cd .. rm -rf iproute-2.6.20-070313
77,安裝鍵盤映射表工具(kbd)
cd /sources tar xvf kbd-1.12.tar.bz2 cd kbd-1.12 patch -Np1 -i /sources/kbd-1.12-backspace-1.patch patch -Np1 -i /sources/kbd-1.12-gcc4_fixes-1.patch /configure --datadir=/lib/kbd make make install mv -v /usr/bin/{kbd_mode,openvt,setfont} /bin cd .. rm -rf kbd-1.12
78,安裝文本查看工具(less)
cd /sources tar xvf less-406.tar.gz cd less-406 /configure --prefix=/usr --sysconfdir=/etc make make install cd .. rm -rf less-406
79,安裝編譯過程控制工具(make)
cd /sources tar xvf make-3.81.tar.bz2 cd make-3.81 /configure --prefix=/usr make make install cd .. rm -rf make-3.81
80,安裝幫助手冊查看工具(man-db)
cd /sources tar xvf man-db-2.4.4.tar.gz cd man-db-2.4.4 mv man/de{_DE.88591,} mv man/es{_ES.88591,} mv man/it{_IT.88591,} sed -i 's,\*_\*,??,' man/Makefile.in sed -i -e '\%\t/usr/man%d' -e '\%\t/usr/local/man%d' src/man_db.conf.in cat >> include/manconfig.h.in << "EOF" #define WEB_BROWSER "exec /usr/bin/lynx" #define COL "/usr/bin/col" #define VGRIND "/usr/bin/vgrind" #define GRAP "/usr/bin/grap" EOF patch -Np1 -i /sources/man-db-2.4.4-fixes-1.patch /configure --prefix=/usr --enable-mb-groff --disable-setuid make make install cat >> convert-mans << "EOF" #!/bin/sh -e FROM="$1" TO="$2" shift ; shift while [ $# -gt 0 ] do FILE="$1" shift iconv -f "$FROM" -t "$TO" "$FILE" >.tmp.iconv mv .tmp.iconv "$FILE" done EOF install -m755 convert-mans /usr/bin cd .. rm -rf man-db-2.4.4
81,安裝建立臨時文件函數(mktemp)
cd /sources tar xvf mktemp-1.5.tar.gz cd mktemp-1.5 patch -Np1 -i /sources/mktemp-1.5-add_tempfile-3.patch /configure --prefix=/usr --with-libc make make install make install-tempfile cd .. rm -rf mktemp-1.5
82,安裝內核模塊管理工具(module-init-tools)
cd /sources tar xvf module-init-tools-3.2.2.tar.bz2 cd module-init-tools-3.2.2 patch -Np1 -i /sources/module-init-tools-3.2.2-modprobe-1.patch /configure make distclean /configure --prefix=/ --enable-zlib make make INSTALL=install install cd .. rm -rf module-init-tools-3.2.2
83,安裝打補丁工具(patch)
cd /sources tar xvf patch-2.5.4.tar.gz cd patch-2.5.4 /configure --prefix=/usr make make install cd .. rm -rf patch-2.5.4
84,安裝進程管理工具(psmisc)
cd /sources tar xvf psmisc-22.5.tar.gz cd psmisc-22.5 /configure --prefix=/usr --exec-prefix="" make make install mv -v /bin/pstree* /usr/bin ln -sv killall /bin/pidof cd .. rm -rf psmisc-22.5
85,安裝密碼管理工具(shadow)
cd /sources tar xvf shadow-4.0.18.1.tar.bz2 cd shadow-4.0.18.1 patch -Np1 -i /sources/shadow-4.0.18.1-useradd_fix-2.patch /configure --libdir=/lib --sysconfdir=/etc --enable-shared --without-selinux sed -i 's/groups$(EXEEXT) //' src/Makefile find man -name Makefile -exec sed -i 's/groups\.1 / /' {} \; sed -i -e 's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ -e 's@/var/spool/mail@/var/mail@' etc/login.defs make make install mv -v /usr/bin/passwd /bin mv -v /lib/libshadow.*a /usr/lib rm -v /lib/libshadow.so ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so 配置添加用戶默認設置,並給root用戶配置密碼 pwconv grpconv useradd -D -b /home sed -i 's/yes/no/' /etc/default/useradd passwd root cd .. rm -rf shadow-4.0.18.1
86,安裝系統日誌記錄工具(sysklogd)
cd /sources tar xvf sysklogd-1.4.1.tar.gz cd sysklogd-1.4.1 patch -Np1 -i /sources/sysklogd-1.4.1-fixes-2.patch patch -Np1 -i /sources/sysklogd-1.4.1-8bit-1.patch make make install 配置syslog cat > /etc/syslog.conf <<EOF auth,authpriv.* -/var/log/auth.log *.*;auth,authpriv.none -/var/log/sys.log daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log mail.* -/var/log/mail.log user.* -/var/log/user.log *.emerg * EOF cd .. rm -rf sysklogd-1.4.1
87,安裝開機過程控制工具(sysvinit)
cd /sources tar xvf sysvinit-2.86.tar.gz cd sysvinit-2.86 sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c make -C src make -C src install 編輯啓動配置文件 cat > /etc/inittab <<EOF id:3:initdefault: si::sysinit:/etc/rc.d/init.d/rc sysinit l0:0:wait:/etc/rc.d/init.d/rc 0 l1:S1:wait:/etc/rc.d/init.d/rc 1 l2:2:wait:/etc/rc.d/init.d/rc 2 l3:3:wait:/etc/rc.d/init.d/rc 3 l4:4:wait:/etc/rc.d/init.d/rc 4 l5:5:wait:/etc/rc.d/init.d/rc 5 l6:6:wait:/etc/rc.d/init.d/rc 6 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S016:once:/sbin/sulogin 1:2345:respawn:/sbin/agetty tty1 9600 2:2345:respawn:/sbin/agetty tty2 9600 3:2345:respawn:/sbin/agetty tty3 9600 4:2345:respawn:/sbin/agetty tty4 9600 5:2345:respawn:/sbin/agetty tty5 9600 6:2345:respawn:/sbin/agetty tty6 9600 EOF cd .. rm -rf sysvinit-2.86
88,安裝打包工具(tar)
cd /sources tar xvf tar-1.18.tar.bz2 cd tar-1.18 /configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin make make install cd .. rm -rf tar-1.18
89,安裝信息閱讀工具(texinfo)
cd /sources tar xvf texinfo-4.9.tar.bz2 cd texinfo-4.9 patch -Np1 -i /sources/texinfo-4.9-multibyte-1.patch patch -Np1 -i /sources/texinfo-4.9-tempfile_fix-1.patch /configure --prefix=/usr make make install make TEXMF=/usr/share/texmf install-tex cd .. rm -rf texinfo-4.9
90,安裝設備自動管理工具(udev)
cd /sources tar xvf udev-113.tar.bz2 cd udev-113 tar -xvf /sources/udev-config-6.3.tar.bz2 install -dv /lib/{firmware,udev/devices/{pts,shm}} mknod -m0666 /lib/udev/devices/null c 1 3 ln -sv /proc/self/fd /lib/udev/devices/fd ln -sv /proc/self/fd/0 /lib/udev/devices/stdin ln -sv /proc/self/fd/1 /lib/udev/devices/stdout ln -sv /proc/self/fd/2 /lib/udev/devices/stderr ln -sv /proc/kcore /lib/udev/devices/core make EXTRAS="`echo extras/*/`" make DESTDIR=/ EXTRAS="`echo extras/*/`" install cp -v etc/udev/rules.d/[0-9]* /etc/udev/rules.d/ cd udev-config-6.3 make install make install-doc make install-extra-doc cd .. install -m644 -v docs/writing_udev_rules/index.html \ /usr/share/doc/udev-113/index.html cd .. rm -rf udev-113
91,安裝工具集(util-linux)
cd /sources tar xvf util-linux-2.12r.tar.bz2 cd util-linux-2.12r sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \ -i $(grep -rl '/etc/adjtime' .) mkdir -pv /var/lib/hwclock patch -Np1 -i /sources/util-linux-2.12r-cramfs-1.patch patch -Np1 -i /sources/util-linux-2.12r-lseek-1.patch /configure make HAVE_KILL=yes HAVE_SLN=yes make HAVE_KILL=yes HAVE_SLN=yes install cd .. rm -rf util-linux-2.12r
92,安裝文本編輯工具(vim)
cd /sources tar xvf vim-7.1.tar.bz2 tar xvf vim-7.1-lang.tar.gz cd vim71 patch -Np1 -i /sources/vim-7.1-fixes-1.patch patch -Np1 -i /sources/vim-7.1-mandir-1.patch echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h /configure --prefix=/usr --enable-multibyte make make install ln -sv vim /usr/bin/vi for L in "" fr it pl ru; do ln -sv vim.1 /usr/share/man/$L/man1/vi.1 done ln -sv ../vim/vim71/doc /usr/share/doc/vim-7.1 配置vim cat > /etc/vimrc <<EOF set nocompatible set backspace=2 syntax on if (&term == "iterm") || (&term == "putty") set background=dark endif EOF cd .. rm -rf vim71
93,從新進入chroot
logout chroot /mnt/lfs /tools/bin/env -i \ HOME=/root TERM=$TERM PS1='\u [\w]\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /tools/bin/bash --login /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ -exec /tools/bin/strip --strip-debug '{}' ';' logout chroot "/mnt/lfs" /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u [\w]\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login
94,安裝系統啓動腳本集合
cd /sources tar xvf lfs-bootscripts-6.3.tar.bz2 cd lfs-bootscripts-6.3 make install cd .. rm -rf lfs-bootscripts-6.3
95,對系統作一系列的配置
時間設置 echo "UTC=1" >/etc/sysconfig/clock bash下的鍵盤功能 vim /etc/inputrc set horizontal-scroll-mode Off set meta-flag On set input-meta On set convert-meta Off set output-meta On set bell-style none "\eOd": backward-word "\eOc": forward-word "\e[1~": beginning-of-line "\e[4~": end-of-line "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[3~": delete-char "\e[2~": quoted-insert "\eOH": beginning-of-line "\eOF": end-of-line "\e[H": beginning-of-line "\e[F": end-of-line bash shell啓動文件 vim /etc/profile export LANG=en export INPUTRC=/etc/inputrcalias ls="ls --color"export PS1='\u [\w]\$ ' 主機名 echo "HOSTNAME=ZTE" > /etc/sysconfig/network hosts文件 echo "127.0.0.1 ZTE localhost" >/etc/hosts DNS echo "nameserver 202.96.134.133" >/etc/resolv.conf IP地址 mkdir -pv /etc/sysconfig/network-devices/ifconfig.eth0 vim /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 ONBOOT=yes SERVICE=ipv4-static IP=192.168.1.1 NETMASK=255.255.255.0 GATEWAY=192.168.1.2 fstab文件 vim /etc/fstab /dev/hda2 / ext3 defaults 1 1 /dev/hda1 /boot ext3 defaults 1 1 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0
96,安裝內核(linux-2.6.22.5)
cd /sources tar xvf linux-2.6.22.5.tar.bz2 cd linux-2.6.22.5 make mrproper make menuconfig ..... ..... make make modules_install cp -v arch/i386/boot/bzImage /boot/lfskernel-2.6.22.5 cp -v System.map /boot/System.map-2.6.22.5 cp -v .config /boot/config-2.6.22.5 install -d /usr/share/doc/linux-2.6.22.5 cp -r Documentation/* /usr/share/doc/linux-2.6.22.5
97,安裝grub
grub root (hd0,0) setup (hd0) quit
98,系統瘦身
rm -rf /tools rm -rf /lfs-sources
99,啓動本身的系統
1,若是使用liveCD製做的操做以下
取出光盤直接重啓便可,
2,若是使用現有的宿主系統製做的操做以下
shutdown –h now 關機以後新建立一虛擬系統,其餘的根據本身須要定義,須要注意的是建立虛擬磁盤的時候要選擇現有的虛擬磁盤,見下圖,
建立完成後啓動虛擬機便可.
能夠看到本身的系統已經起來了,接下來本身須要什麼工具就裝什麼工具就能夠了,嘿嘿.
呵呵,終於整完了,寫的很差還請你們見諒,若有不足之處還望各位仁兄指點指點,