1 / 39

By. Fauzi Dwi Susanto

By. Fauzi Dwi Susanto. Pengantar LFS (Linux From Scratch). Praktikum Sistem Operasi Tahun 2012 Teknik Informatika - D. Panduan LFS . Tentukan versi Linux Ubuntu yang dipakai . Karena versi ubuntu yang dipakai adalah versi 11.10, maka panduan LFS yang dipakai adalah :

madge
Download Presentation

By. Fauzi Dwi Susanto

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By. FauziDwiSusanto Pengantar LFS (Linux From Scratch) PraktikumSistemOperasiTahun 2012 TeknikInformatika - D

  2. Panduan LFS Tentukanversi Linux Ubuntu yang dipakai. Karenaversiubuntu yang dipakaiadalahversi 11.10, makapanduan LFS yang dipakaiadalah : LFS-BOOK 7.1

  3. PersiapanAwal • Install Linux Ubuntu 11.10 pada VB anda • Membuat partisi baru dengan ketentuan : • Partisi root yang diberi mount point / dan tipe file ext3 dengankapasitassesuaikebutuhananda. • Partisi swap yang diberi mount point /swap dan tipe file swapdengankapasitassesuaikebutuhananda. • Siapkan kopi dansedikithiburan agar tidakbosansertaajakcurhattemandisampingmu…!

  4. Setelah partisi baru telah dibuat, maka langkah selanjutnya adalah mengkopi file LFS ke sistem operasi Linux (paket-paketdan data-data LFS yang diperlukan). • Setelah dikopi, lakukan proses version-check untuk melihat versi sistem hostnya, jikaadapaket yang butuhdiinstaldahulumaka install paket2 tersebut. -- MerujukLFS-BOOK 7.1 hal.xvii--

  5. PersiapanPartisiBaru (Chap.2) Masuk root dahulu mke2fs -jv /dev/<xxx> Inisialisasi partisi swap cd /tmp rm -rfv e2fsprogs-1.42 mkswap /dev/<yyy> Mounting partisibaru export LFS=/mnt/lfs mkdir -pv $LFS mount -v -t ext3 /dev/<xxx> $LFS -- MerujukLFS-BOOK 7.1 hal.12,13 dan 14--

  6. Packages and Patches (Chap.3) Buat directory untuktempat LFS anda, danmasuksebagai root mkdir -v $LFS/sources chmod -v a+wt $LFS/sources Setelahitupindahkanpaket-paket LFS andapada directory tersebutmelalui terminal atausecara manual. -- MerujukLFS-BOOK 7.1 hal.15-23 --

  7. Persiapan Final(Chap.4) • Mengecek apakah variabel LFS sudah sesuai ketentuan dengan cara mengetikkan perintah seperti di bawah ini: echo $LFS • Mengeset path dari variabel LFS dengan cara mengetikkan perintah seperti di bawah ini: export LFS=/mnt/lfs • Langkah selanjutnya yang dilakukan adalah membuat direktori LFS/tools dengan cara menggunakan perintah seperti di bawah ini: mkdir -v $LFS/tools • Langkah selanjutnya adalah dengan membuat simlink /tools ke host system dengan cara menggunakan perintah seperti di bawah ini: ln -sv $LFS/tools /

  8. Persiapan Final(Chap.4) • Langkah selanjutnya yang dilakukan adalah menambahkan user baru untuk LFS dengan cara menggunakan perintah seperti di bawah ini: groupadd lfs useradd -s /bin/bash -g lfs -m -k /dev/null lfs • Untuk mengganti password dilakukan dengan menggunakan perintah seperti di bawah ini: passwd lfs • Setelah itu diberikan full akses ke user baru tersebut dengan menggunakan perintah seperti di bawah ini: chown -v lfs $LFS/tools chown -v lfs $LFS/sources • Kemudian login sebagai user baru tersebut dengan menggunakan perintah seperti di bawah ini: su – lfs

  9. Setting Environment • Membuat profil bash baru dengan cara menggunakan perintah di bawah ini: cat > ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF • Membuat Bashrc file dengan cara menggunakan perintah di bawah ini: cat > ~/.bashrc << "EOF" set +h umask 022 ....................................... • Membuat user profil dengan cara menggunakan perintah seperti di bawah ini: source ~/.bash_profile

  10. Constructing a Temporary System (Chap.5) • Binutils-2.22– InstalisasiTahap 1 • Buat folder untuk build mkdir -v ../binutils-build cd ../binutils-build • Persiapkan Binutils untuk dikompilasi ../binutils-2.22/configure \ --target=$LFS_TGT --prefix=/tools \ --disable-nls --disable-werrorlalu make • Jika akan di build untuk x86_64, buat symlink ke tool chain case $(uname -m) in x86_64) mkdir -v /tools/lib &&ln -sv lib /tools/lib64 ;; esac • Install paket make install

  11. Constructing a Temporary System (Chap.5) GCC-4.6.2 – Instalasi tahap 1 Linux-3.2.6 API Headers Glibc-2.14.1

  12. Adjusting the Toolchain SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs $LFS_TGT-gcc -dumpspecs | sed \ -e 's@/lib\(64\)\?/ld@/tools&@g' \ -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS echo "New specs file is: $SPECS" unset SPECS Binutils-2.22 - Pass 2 GCC-4.6.2 - Pass 2 Tcl-8.5.11 Expect-5.45 Dan seterusnya..,,,,Lakukan compile dan install paketsecaraurut, jangansampaiada yang terlewatkan.

  13. Stripping • Remove symbols : strip --strip-debug /tools/lib/* strip --strip-unneeded /tools/{,s}bin/* • Remove the documentation rm -rf /tools/{,share}/{info,man,doc} -- Next slide to Chapter 6 --

  14. Installing Basic System Software (Chap. 6) • Creating directories onto which the file systems will be mounted mkdir -v $LFS/{dev,proc,sys} • Creating Initial Device Nodes mknod -m 600 $LFS/dev/console c 5 1 mknod -m 666 $LFS/dev/null c 1 3 • Mounting and Populating /dev mount -v --bind /dev $LFS/dev • Mounting Virtual Kernel File Systems mount -vtdevptsdevpts $LFS/dev/pts mount -vttmpfsshm $LFS/dev/shm mount -vtprocproc $LFS/proc mount -vtsysfssysfs $LFS/sys

  15. Installing Basic System Software (Chap. 6) • Entering the ChrootEnvironment chroot "$LFS" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h • Creating Directories mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt,run} mkdir -pv /{media/{floppy,cdrom},sbin,srv,var} install -dv -m 0750 /root install -dv -m 1777 /tmp /var/tmp mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}share/{doc,info,locale,man} mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/man/man{1..8} for dir in /usr /usr/local; do ln -sv share/{man,doc,info} $dir done case $(uname -m) in x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;; esac mkdir -v /var/{log,mail,spool} ln -sv /run /var/run ln -sv /run/lock /var/lock mkdir -pv /var/{opt,cache,lib/{misc,locate},local}

  16. Installing Basic System Software (Chap. 6) • Creating Essential Files and Symlinks ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin ln -sv /tools/bin/perl /usr/bin ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la ln -sv bash /bin/sh • Presence of /etc/mtab touch /etc/mtab • Create the /etc/passwd --- merujukLFS-BOOK 7.1 hal 80 --- • Create the /etc/group --- merujukLFS-BOOK 7.1 hal81 ---

  17. Installing Basic System Software (Chap. 6) • To work user name and group name exec /tools/bin/bash --login +h • Initialize the log files and give them proper permissions touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} chgrp -v utmp /var/run/utmp /var/log/lastlog chmod -v 664 /var/run/utmp /var/log/lastlog chmod -v 600 /var/log/btmp • Next, Linux-3.2.6 API Headers • Man-pages-3.35 • Glibc-2.14.1

  18. Re-adjusting the Toolchain • Create link to its counterpart in / tools/ $(gcc - dumpmachine)/ bin mv -v /tools/bin/{ld,ld-old} mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} mv -v /tools/bin/{ld-new,ld} ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld • A sed command gcc -dumpspecs | sed -e 's@/tools@@g' \ -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \ `dirname $(gcc --print-libgcc-file-name)`/specs

  19. Re-adjusting the Toolchain • Sanity checks echo 'main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib‘ • Make sure that we're setup to use the correct startfilesdll grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log grep-B1 '^ /usr/include' dummy.log grep'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g‘ grep"/lib.*/libc.so.6 " dummy.log grep found dummy.log • Clean up the test files rm -v dummy.ca.out dummy.log

  20. Next Install Paket Zlib-1.2.6 File-5.10 Binutils-2.22 GMP-5.0.4 MPFR-3.1.0 MPC-0.9 GCC-4.6.2 Sed-4.2.1 Bzip2-1.0.6 Ncurses-5.9 …………............…catatpaketygsudahterinstallbilaperlu Vim-7.3

  21. Stripping Again • Exit from chroot logout • Entering the Chroot Environment chroot $LFS /tools/bin/env -i \ HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /tools/bin/bash –login • The binaries and libraries can be safely stripped /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ -exec /tools/bin/strip --strip-debug '{}' ';'

  22. Cleaning Up When reentering the chroot environment after exiting, use the following modified chroot command chroot "$LFS" /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash –login

  23. Setting Up System Bootscripts(Chap. 7) • Creating stable names for network interfaces for NIC in /sys/class/net/* ; do INTERFACE=${NIC##*/} udevadm test --action=add $NIC done cat /etc/udev/rules.d/70-persistent-net.rules • Creating Network Interface Configuration Files cd /etc/sysconfig/ cat > ifconfig.eth0 << "EOF" ONBOOT=yes IFACE=eth0 ……………

  24. Setting Up System Bootscripts(Chap. 7) • Creating the /etc/resolv.conf File cat > /etc/resolv.conf << "EOF" # Begin /etc/resolv.conf domain <Your Domain Name> nameserver <IP address of your primary nameserver> nameserver <IP address of your secondary nameserver> # End /etc/resolv.conf EOF • Create the /etc/hosts cat > /etc/hosts << "EOF" # Begin /etc/hosts (no network card version) 127.0.0.1 <HOSTNAME.example.org> <HOSTNAME> localhost # End /etc/hosts (no network card version) EOF

  25. Creating Custom Symlinks to Devices • CD-ROM symlinks udevadm test /sys/block/hdd sed -i -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ /lib/udev/rules.d/75-cd-aliases-generator.rules • Dealing with duplicate devices udevadm info -a -p /sys/class/video4linux/video0

  26. Setting Up System Bootscripts(Chap. 7) Install LFS-Bootscripts-20120229 Configuring the setclockScript cat > /etc/sysconfig/clock << "EOF" # Begin /etc/sysconfig/clock UTC=1 # Set this to any options you might need to give to hwclock, # such as machine hardware clock type for Alphas. CLOCKPARAMS= # End /etc/sysconfig/clock EOF

  27. Setting Up System Bootscripts(Chap. 7) Configuring the Linux Console cat > /etc/sysconfig/console << "EOF" # Begin /etc/sysconfig/console UNICODE="1" KEYMAP="de-latin1" KEYMAP_CORRECTIONS="euro2" LEGACY_CHARSET="iso-8859-15" FONT="LatArCyrHeb-16 -m 8859-15" # End /etc/sysconfig/console EOF

  28. The Bash Shell Startup Files • List of all locales supported by Glibc locale –a • This results in a final locale setting of “en_GB.ISO-8859-1” LC_ALL=<locale name> locale charmap LC_ALL=<locale name> locale language LC_ALL=<locale name> locale charmap LC_ALL=<locale name> locale int_curr_symbol LC_ALL=<locale name> locale int_prefix • Once the proper locale settings have been determined, create the / etc/ profile file: -- merujukhal 215 – • Creating the /etc/inputrcFile : -- merujukhal216 –

  29. Making the LFS System Bootable (Chap. 8) • Creating the /etc/fstab File Isi file system dan type sesuaidenganpartisi laptop anda. • hdparm-I /dev/sda | grep NCQ

  30. Making the LFS System Bootable (Chap. 8) Linux-3.2.6 (Kernel) make mrproper make LANG=<host_LANG_value> LC_ALL= menuconfig make make modules_install cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.2.6-lfs-7.1 cp -v System.map /boot/System.map-3.2.6 cp -v .config /boot/config-3.2.6 install -d /usr/share/doc/linux-3.2.6 cp -r Documentation/* /usr/share/doc/linux-3.2.6

  31. Using GRUB to Set Up the Boot Process • Creating a GRUB boot floppy diskette as a backup cd /tmp && grub-mkrescue --output=grub-img.iso && xorriso -as cdrecord -v dev=/dev/cdrw blank=as_neededgrub-img.iso • GRUB Naming Conventions grub-mkdevicemap --device-map=device.map cat device.map

  32. Setting Up the Configuration Install the GRUB files into / boot/ grub: grub-install /dev/sda Creating the Configuration File cat > /boot/grub/grub.cfg << "EOF" # Begin /boot/grub/grub.cfg set default=0 set timeout=5 insmod ext2 set root=(hd0,2) menuentry "GNU/Linux, Linux 3.2.6-lfs-7.1" { linux /boot/vmlinuz-3.2.6-lfs-7.1 root=/dev/sda2 ro } EOF

  33. The End (Chap. 9) WARNING…!!!!!!!!!!!!!! Hati – hatipadasaatakantahap reboot ..!!! Rebooting the System logout Then unmountthe virtual file systems umount -v $LFS/dev/pts umount -v $LFS/dev/shm umount -v $LFS/dev umount -v $LFS/proc umount -v $LFS/sys

  34. The End (Chap. 9) Unmount the LFS file system itself : umount -v $LFS If multiple partitions were created, unmount the other partitions before unmounting the main one, like this umount -v $LFS/usr umount -v $LFS/home umount -v $LFS Now, reboot the system with : shutdown -r now

  35. ContohHasil Grub After Reboot

  36. MohonDiperhatikan ..!!!! Dear Praktikan SO TIF-D : Project LFS iniwaktupengumpulannyadiperpanjangsampaidenganakhir UAS Hasilakhir project LFS inididemokansetelah UAS secarakelompokkemasing-masingdosenpengampu Untukdokumentasinyaadalahmasing-masinganggotakelompok(individu) Sebelum demo kedosenkppharussudah di ttdolehkoas SO danlaporanlengkap yang sudahdisusunsecaraurutsesuaidenganketentuanpenjilidan Ketentuandan format penjilidanakandiuploadminggudepan

  37. TerimaKasih …. SelamatMengerjakan !!!!

More Related