LiveCD Howto (CentOS 4) - Step by step - 01/12/2006 - Ver 1.1



Similar documents
Backup of ESXi Virtual Machines using Affa

Encrypted Root Filesystem HOWTO

Computer Science and Engineering Linux Cisco VPN Client Installation and Setup Guide

Hacking Linux-Powered Devices. Stefan Arentz

Building Elastix-2.4 High Availability Clusters with DRBD and Heartbeat (using a single NIC)

Installing VMware Tools on Clearswift v4 Gateways

EXPLORING LINUX KERNEL: THE EASY WAY!

Linux System Administration on Red Hat

Buildroot for Vortex86EX (2016/04/20)

Of Penguins and Wildebeest. Anthony Rodgers VA7IRL

ATT8231: Creating a Customized USB Thumb Drive for ZCM Imaging Methods for creating a customized bootable USB Thumb Drive

Windows Template Creation Guide. How to build your own Windows VM templates for deployment in Cloudturk.

Building a diskless Linux Cluster for high performance computations from a standard Linux distribution

UNIX - FILE SYSTEM BASICS

TECHNICAL HOWTO. Imaging Linux systems with hardware changes. author:

Installation GENTOO + RAID sur VMWARE

Red Hat Linux Administration II Installation, Configuration, Software and Troubleshooting

Getting Started with the Linux Intrusion Detection

A candidate following a programme of learning leading to this unit will be able to:

Rethink Package Components on De-Duplication: From Logical Sharing to Physical Sharing

Server Installation/Upgrade Guide

Backtrack 4 Bootable USB Thumb Drive with Full Disk Encryption

Rancid Server Build and Operation Overview (v0.3) (This is being done from memory so expect some errors)

Linux Template Creation Guide. How to build your own Linux VM templates for deployment in Cloudturk.

Installation Guide for FTMS and Node Manager 1.6.0

Relax and Recover (rear) Workshop

An Introduction to the Linux Command Shell For Beginners

Installing Virtual Coordinator (VC) in Linux Systems that use RPM (Red Hat, Fedora, CentOS) Document # 15807A1-103 Date: Aug 06, 2012

Linux Disaster Recovery best practices with rear

Desktop virtualization using SaaS Architecture

Unix/Linux Forensics 1

Notes for Installing RedHawk 6.3 with Red Hat Enterprise Linux 6.3. Installation Notes. November 6 th, 2014

Acronis Backup & Recovery 10 Server for Linux. Update 5. Installation Guide

HOW TO BUILD A VMWARE APPLIANCE: A CASE STUDY

Installing IBM Websphere Application Server 7 and 8 on OS4 Enterprise Linux

4PSA Total Backup User's Guide. for Plesk and newer versions

2. Boot using the Debian Net Install cd and when prompted to continue type "linux26", this will load the 2.6 kernel

KNOPPIX TRICKS. Knoppix is a full Linux system on. Expert techniques for getting more from Knoppix COVER STORY. Installing New Programs

Installing Rails 2.3 Under CentOS/RHEL 5 and Apache 2.2

Converting Linux and Windows Physical and Virtual Machines to Oracle VM Virtual Machines. An Oracle Technical White Paper December 2008

HARFORD COMMUNITY COLLEGE 401 Thomas Run Road Bel Air, MD Course Outline CIS INTRODUCTION TO UNIX

GeBro-BACKUP. Die Online-Datensicherung. Manual Pro Backup Client on a NAS

Private Server and Physical Server Backup and Restoration:

User Manual of the Pre-built Ubuntu 9 Virutal Machine

Make a Bootable USB Flash Drive from the Restored Edition of Hiren s Boot CD

Installation Guide for WebSphere Application Server (WAS) and its Fix Packs on AIX V5.3L

Restoring a Suse Linux Enterprise Server 9 64 Bit on Dissimilar Hardware with CBMR for Linux 1.02

CN=Monitor Installation and Configuration v2.0

IT6204 Systems & Network Administration. (Optional)

LAMP Quickstart for Red Hat Enterprise Linux 4

Implementing a Weblogic Architecture with High Availability

CO Web Server Administration and Security. By: Szymon Machajewski

LPI certification 101 exam prep, Part 1

Installing MooseFS Step by Step Tutorial

SNPsyn documentation. Release 1.1b. Tomaž Curk Gregor Rot Davor Sluga Uroš Lotrič Blaž Zupan

Cloud.com CloudStack Community Edition 2.1 Beta Installation Guide

Setup software RAID1 array on running CentOS 6.3 using mdadm. (Multiple Device Administrator) 1. Gather information about current system.

Getting started with ARM-Linux

An Introduction to Securing Linux with Apache, ProFTPd, and Samba by Zach Riggle

Hands-on Lab Exercise Guide

Installing OCFA on Ubuntu. Practical installation procedures, Installing The Open Computer Forensics Architecture on Ubuntu

System administration basics

WELCOME. Backup of OracleVM. Martin Bracher SOUG-Vortrag 21. März 2013

Hadoop Lab - Setting a 3 node Cluster. Java -

Acronis Backup & Recovery 10 Server for Linux. Command Line Reference

Installation Guide for AmiRNA and WMD3 Release 3.1

Acronis Backup & Recovery 10 Server for Linux. Installation Guide

Web Server using Apache. Heng Sovannarith

Fermilab Central Web Service Site Owner User Manual. DocDB: CS-doc-5372

Deployment - post Xserve

Acronis Backup & Recovery 10 Server for Linux. Installation Guide

HTTP-FUSE PS3 Linux: an internet boot framework with kboot

ULTEO OPEN VIRTUAL DESKTOP V4.0

Basic Linux & Package Management. Original slides from GTFO Security

RedHat (RHEL) System Administration Course Summary

Partitioning. Files on the Hard Drive. Administration of Operating Systems DO2003. Partition = Binder with index. Write file = Insert document

Linux Disaster Recovery best practices with rear

Acronis Backup & Recovery 10 Server for Linux. Installation Guide

JobScheduler - Amazon AMI Installation

ThinkServer RD540 and RD640 Operating System Installation Guide

Procedure to Create and Duplicate Master LiveUSB Stick

INF-110. GPFS Installation

Setup a Virtual Host/Website

Sistemi ad agenti Principi di programmazione di sistema

How To Install Acronis Backup & Recovery 11.5 On A Linux Computer

Installing & Customizing the OHMS Viewer Eric Weig

Installation Guide. McAfee VirusScan Enterprise for Linux Software

Recovering Data from Windows Systems by Using Linux

CS197U: A Hands on Introduction to Unix

Installation Guide. Copyright (c) 2015 The OpenNMS Group, Inc. OpenNMS SNAPSHOT Last updated :19:20 EDT

Technical Report. Implementation and Performance Testing of Business Rules Evaluation Systems in a Computing Grid. Brian Fletcher x

An Embedded Wireless Mini-Server with Database Support

Integrating Apache Web Server with Tomcat Application Server

Raspberry Pi Webserver

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF

RocketRAID 2640/2642 SAS Controller Ubuntu Linux Installation Guide

INUVIKA OVD INSTALLING INUVIKA OVD ON RHEL 6

Birmingham Environment for Academic Research. Introduction to Linux Quick Reference Guide. Research Computing Team V1.0

Installing Booked scheduler on CentOS 6.5

Transcription:

LiveCD Howto (CentOS 4) - Step by step - 01/12/2006 - Ver 1.1 (This howto is for CentOS 4.4 i386. The version numbers may be different) Overview This howto illustrate the way to "compile" your own LiveCD from any Linux disto out there. Some commands maybe different between distos, But generally - it gives a good start point. The flow of the LiveCD startup is 1. Booting from CD (or pxe for that matter) using the isolinux. The Linux kernel and initrd load into memory. 2. initrd does the magic: load relevant kenrel modules, mount the CD or NFS mount, mount cramfs (read-only), mount tmpfs (read-write), join the two using unionfs, chroot into the real system by running the scripts instead of /bin/init. 3. The real system loads by running /etc/rc.d/rc.sysinit, /etc/rc.d/rc 3 and finally /bin/login -f root 4. The bash has configuration to run once some process (X, xterm, icewm, firefox) 5. After the real system cease to exist (by killing the "login", the initrd takes over again and kill everything, umount everything, eject the CD and reboot. The command for the real system should be "kill -15-1" (most of the time runs from php script) Step by step 1. 2. 3. Install CentOS minimal installation. Download unionfs (http://www.am-utils.org/project-unionfs.html). You will need gcc & kernel-devel packages in order to complete unionfs # yum install gcc # yum install kernel-devel 4. Untar unionfs source # tar -zxf unionfs-1.1.5.tar.gz # cd unionfs-1.1.5 Some kernel sources has to be modified: # vi /lib/modules/2.6.9-42.0.3.el/build/include/linux/gfp.h look for gfp_t and *delete* this line ( typedef unsigned int gfp_t; ) # vi /lib/modules/2.6.9-42.0.3.el/build/include/linux/slab.h look for kzalloc and *delete* this line ( extern void *kzalloc(size_t, int; ) # make (ignore compile errors, you only need the unionfs.ko & unionctl which are ready after the make.) 5. Remove the kernel sources as we touched them and they are no longer current! # rpm e kernel-devel-2.6.9-42.0.3.el 6. Copy the unionfs & unionctl to the right place # mkdir /lib/modules/2.6.9-42.0.3.el/kernel/fs/unionfs # cp unionfs.ko /lib/modules/2.6.9-42.0.3.el/kernel/fs/unionfs/ # cp unionctl /usr/bin/ 7. Creating busybox. busybox is binary application which can be compiles staticly and include lots of gui applications in in, such as ls, mount, insmod etc. for that matter, we will compile busybox from source, this way we can select which applications we want and which we don't Attached you could file.config file from the busybox (v. 1.2.2) which include what I thought needed. The result is 750Kbyte busybox one file (no lib needed) This compilation has be on quite full installation and not on our minimal system. Once this busybox compiled - we can use in on our system without no additional libs. # wget http://www.busybox.net/downloads/busybox-1.2.2.tar.gz # tar -zxvf busybox-1.2.2.tar.gz # cd busybox-1.2.2 # make menuconfig or use my.config file # make # cp busybox /path/to/initrd/bin 8. Creating the initrd

# dd if=/dev/zero of=initrd bs=1m count=8 # mke2fs initrd # mkdir /mnt/loop # mount -o loop initrd /mnt/loop # cd /mnt/loop # mkdir etc dev lib bin proc new cdrom static dynamic union # touch etc/mtab # cd /mnt/loop/bin/ # cp /bin/bash. # cp /sbin/killall5. # cp /bin/sleep. 9. Now we have to bring all the shared library from the binaries we copied # cd /mnt/loop/lib/ # ldd../bin/* bash: libtermcap.so.2 => /lib/libtermcap.so.2 (0x007e9000) libdl.so.2 => /lib/libdl.so.2 (0x006e0000) busybox: not a dynamic executable killall5: sleep: libm.so.6 => /lib/tls/libm.so.6 (0x006bb000) librt.so.1 => /lib/tls/librt.so.1 (0x00d2f000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x007e9000) # cp /lib/libc.so.6. # cp /lib/ld-linux.so.2. # cp /lib/libtermcap.so.2. # cp /lib/libdl.so.2. -rwxr-xr-x 1 root root 110K Dec 1 09:47 ld-linux.so.2* -rwxr-xr-x 1 root root 1.5M Dec 1 09:47 libc.so.6* -rwxr-xr-x 1 root root 17K Dec 1 09:48 libdl.so.2* -rwxr-xr-x 1 root root 12K Dec 1 09:48 libtermcap.so.2* drwxr-xr-x 3 root root 1.0K Nov 26 14:46 modules/ 10. We also have to copy the kernel modules we will load at the initrd stage # mkdir -p modules/2.6.9-42.0.3.el/ # cd modules/2.6.9-42.0.3.el/ # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/block/loop.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/ext3/ext3.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/jbd/jbd.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/unionfs/unionfs.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/cramfs/cramfs.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/scsi/sd_mod.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/scsi/scsi_mod.ko. 11. In order to know which dependencies each modules have, run: # modprobe --show-depend e100 insmod /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/mii.ko insmod /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/e100.ko # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/e100.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/e1000/e1000.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/mii.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/drivers/net/pcnet32.ko. (for VMWare machines...) 12. NFS modules

# cp /lib/modules/2.6.9-42.0.3.el/kernel/net/sunrpc/sunrpc.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/lockd/lockd.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/nfs_common/nfs_acl.ko. # cp /lib/modules/2.6.9-42.0.3.el/kernel/fs/nfs/nfs.ko. -rwxr--r-- 1 root root 13K Nov 23 04:04 cramfs.ko* -rwxr--r-- 1 root root 124K Jan 3 17:27 e1000.ko* -rwxr--r-- 1 root root 41K Nov 26 13:41 e100.ko* -rwxr--r-- 1 root root 137K Nov 23 03:56 ext3.ko* -rwxr--r-- 1 root root 88K Nov 23 03:56 jbd.ko* -rwxr--r-- 1 root root 78K Nov 26 16:58 lockd.ko* -rwxr--r-- 1 root root 21K Nov 23 03:55 loop.ko* -rwxr--r-- 1 root root 6.8K Nov 26 14:13 mii.ko* -rwxr--r-- 1 root root 5.1K Nov 26 17:02 nfs_acl.ko* -rwxr--r-- 1 root root 282K Nov 26 16:58 nfs.ko* -rwxr--r-- 1 root root 38K Nov 26 15:55 pcnet32.ko* -rwxr--r-- 1 root root 153K Jan 3 18:04 scsi_mod.ko* -rwxr--r-- 1 root root 22K Jan 3 18:03 sd_mod.ko* -rwxr--r-- 1 root root 187K Nov 26 16:59 sunrpc.ko* -rwxr--r-- 1 root root 2.1M Nov 23 03:56 unionfs.ko* 13. Create /dev special devices # cd /mnt/loop/dev/ # mknod console c 5 1 # mknod hda b 3 0 # mknod hdb b 3 64 # mknod hdc b 22 0 # mknod hdd b 22 64 # mknod tty c 4 0 # mknod loop0 b 7 0 crw-r--r-- 1 root root 5, 1 Nov 22 20:58 console brw-r--r-- 1 root root 3, 0 Nov 22 20:59 hda brw-r--r-- 1 root root 3, 64 Nov 22 20:59 hdb brw-r--r-- 1 root root 22, 0 Nov 22 20:59 hdc brw-r--r-- 1 root root 22, 64 Nov 22 20:59 hdd brw-r--r-- 1 root root 7, 0 Nov 22 21:00 loop0 crw-r--r-- 1 root root 1, 3 Nov 22 20:58 null crw-r--r-- 1 root root 4, 0 Nov 22 20:59 tty 14. Creating the linuxrc # cd /mnt/loop/ # vi linuxrc (attached you will find linuxrc script) 15. Umounting the initrd & compress it / # umount /mnt/loop/ # gzip initrd 16. Download syslinux (which include isolinux in it) # wget http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.31.tar.gz 17. Start to assemble the LiveCD on another machine (local)# mount xxx.xxx.xxx.xxx:/tmp /mnt (remote)# mkdir -p /tmp/livecd/isolinux (local)# cp initrd.gz /mnt/livecd/isolinux (local)# cp /boot/vmlinuz-2.6.9-42.0.3.el /mnt/livecd/isolinux/vmlinuz (remote)/livecd/isolinux (remote)# cp /tmp/syslinux-3.31/isolinux.bin. (remote)# vi isolinux.cfg (attached you will find isolinux.cfg) 18. Create directories for live file systems came from the initrd # mkdir /mnt/cdrom 19. Stop interactive boot # vi /etc/sysconfig/init chnage PROMPT=yes to PROMPT=no 20. Remove MAC address from the NIC & stop network at boot

21. Adding xorg # vi /etc/sysconfig/network-scripts/ifcfg-eth0 remove the MAC & change ONBOOT=yes to ONBOOT=no # yum install xorg-x11 22. Adding DAG repository # wget wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.4-1.el4.rf.i386.rpm # rpm -Uhv rpmforge-release-0.3.4-1.el4.rf.i386.rpm 23. Adding WinICE window manager (small window manager) # yum install icewm 24. Adding Firefox & Add the kiosk addon # wget "http://download.mozilla.org/?product=firefox-2.0&os=linux&lang=en-us" # tar -zxvf firefox-2.0.tar.gz # mv firefox /usr/local/lib/firefox-2.0 # vi /etc/profile add the line: # Path manipulation if [ `id -u` = 0 ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin pathmunge /usr/local/lib/firefox-2.0/ <<<<--------- fi # yum install compat-libstdc++-33-3.2.3-47.3 # wget http://releases.mozilla.org/pub/mozilla.org/extensions/r-kiosk/r-kiosk-0.5.1-fx.xpi (look here: https://addons.mozilla.org/firefox/1659/) Install the addon with "file -> open file"... ---> in firefox settings, set http://localhost as home page. Go through settings and set sane settings. You may have the firefox profile directory to the root (/.mozilla/...) instead of the root home (/root/.mozilla...) 25. Setting some start-up operations # vi /etc/run.sh #!/bin/bash /etc/rc.d/rc.sysinit /etc/rc.d/rc 3 /bin/login -f root # vi /etc/rc.local Add: X &>/dev/null & export DISPLAY=localhost:0.0 &>/dev/null /usr/local/lib/firefox-2.0/firefox http://localhost &>/dev/null & 26. Adding apache & PHP # yum install httpd # yum install php # chkconfig httpd on # cd /var/www/ # rm -fr html/ # ln -s /mnt/cdrom/web/ html # vi /etc/httpd/conf/httpd.conf remove remark and change the line: ServerName LiveCD:80 # vi /etc/sudoers add: after apache ALL=(ALL) NOPASSWD: ALL root ALL=(ALL) ALL 27. Cleaning /etc/resolve.conf file: # vi /etc/resolv.conf

delete everything 28. Cleaning the Live System from all unnecessary files, like /share/doc, /share/man etc. # cd /usr/share # du -s * sort -n...... 31088 comps 45300 man 62696 doc 66828 locale # rm -fr /usr/share/man /usr/share/doc /var/cache/yum /tmp/* 29. Cloning the file system. NOTE: The file system has to be clone to another system. The use of netcat is to speed things up (using gzip), there is also possibility to use nfs mount or whatever (remote)# mkdir /tmp/fs/ (remote)# nc -l -p 1111 ( cd /tmp/fs/ ; tar -zxvf - ) (local)# cd / (local)# tar -zcvpplf -. nc 192.168.0.13 1111 30. Replacing files for LiveCD Use modified rc.sysinit & fstab. # cp /path/to/modified/rc.sysinit /tmp/fs/etc/rc.d/ # cp /path/to/modified/fstab /tmp/fs/etc/ 31. Creating the cramfs (on remote machine) /LiveCD/ # mkcramfs /tmp/fs/ LiveSystem.cramfs 32. Making iso image /LiveCD/ drwxrwxrwx 2 root root 4.0K Nov 27 13:56 isolinux/ -rwxr-xr-x 1 root root 161 Nov 23 11:51 mkiso.sh* drwxr-xr-x 2 root root 4.0K Nov 29 09:22 SpecialFiles/ drwxrwxrwx 3 root root 4.0K Nov 28 17:29 Web/ # mkisofs -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \ -boot-info-table -c isolinux/boot.cat -iso-level 3 -o /tmp/livecd.iso /tmp/cd/ Notes 1. If and when you are doing online modifications to logical drives (using online RAID tools), after running "blockdev --rereadpt /dev/xxxxx" (for re-reading the partition table), there is also a need to run "/sbin/start_udev" in order to update the /dev directory. This issue was found working on the Oasis pltaform and may not be relevant to the HP Proliant. Platform related notes HP Proliant DL360/DL380 Todo You will have to have (on minimal installation): # yum install libgcc.i386 # yum install ncurses.i386 # rpm -Uhv compat-libstdc++-296-2.96-132.7.2.i386.rpm (from the installation CD) # hpacucli-7.50-18.linux.rpm (from the PSP - Proliant Service Pack) Running the tool via console or via script. 1. sqaushfs cramfs has limit of max size of 272M, which is very limiting. sqaushfs has no limit, but doesn't have support out-of-the-box.