HTML to PDF ตัวไหนดี

Source : http://www.jquerytips.com/

สวัสดีครับ หายหน้ากันอีกไปพักใหญ่ๆ แต่ว่าก็ยัง อัพเดทอยู่ใน Fan Page อยู่เรื่อยๆ นะ แต่ว่าถ้าเป็น บทความยาวๆ นี่มันท้อ แฮะ 555

แต่วันนี้ ยังไงก็มาแล้ว ก็จับประเด็น บางเรื่องมาเล่าสู่กันฟัง…

พอดีช่วงนี้ผมกำลัง ทำงานในส่วนออก Report พอดี ซึ่งที่ต้องการก็คือ ออก Report เป็น PDF อันที่จริงมันก็ไม่มีปัญหาอะไรหรอก Lib PDF มีอยู่ถมไป Zend_Pdf ซึ่งทำงานได้ละเอียดมากๆ ก็มีอยู่ แต่ด้วยความขี้เกียจ เลยไม่อยากไป Add Columns ไปสร้างสี แบ่งล๊อกอะไรให้มันวุ่นวาย

แล้วก็จำได้ด้วยว่าเคยเห็น Web ตั้งเยอะที่มัน Convert HTML เป็น PDF มันน่าจะมีใครทำ Lib อะไรมาให้ใช้บ้างน่า สรุปได้ แคนดิเดท มา 3 ตัว ประกอบไปด้วย

1. TCPDF

2. Dompdf

3. mPDF

ก็เลยค่อยๆลอง ไปทีละตัว โดยที่แต่ละตัว ก็มีข้อเด่น ข้อด้อยต่างกันไป ซึ่งแรกเริ่ม ผมก็ไล่มาเลย ตั้งแต่

TCPDF

ตัวนี้ค่อนข้างจะใช้ง่ายมาก ไม่ต้อง Config อะไรวุ่นวาย Font ก็มี ที่ Support ภาษาไทยมาให้ในตัว คือ “Freeserif” ไม่ต้องทำอะไรเท่าไหร่ ตอนแรกก็คิดว่าจะหยุดที่ตัวนี้แหละ แต่พอทำไปทำมาเกิดปัญหา คือมันสามารถอ่าน Stylesheet ได้แค่เล็กน้อยเท่านั้น พวก attrs ง่ายๆ อย่าง  color อะไรแบบนี้

แต่ว่ามันดันอ่านพวก float, padding, margin เพี้ยนๆ ไม่เหมือน HTML ที่ทำมาเท่าไหร่ ซึ่งมันยากมาก เพราะผมต้องทำ HTML เป็น table เกือบทั้งหมด เลยเปลี่ยนๆ ลองตัวใหม่

Dompdf

ตัวนี้ลองอ่าน Document แล้ว ก็ลองใช้งาน ถูกใจมากเลย ถึงจะ config ลำบากไปนิด แต่ว่าใช้งานง่าย โคดเขียนสวย Doc มีตัวอย่างเยอะ แล้วก็ดู ค่อนข้างโปรที่สุด แต่….

พอถึงเรื่องภาษาไทย ผมพยายาม Add Font ไทยเข้าไป มันก็ได้อยู่ ถึงจะลง Font ค่อนข้างลำบากหน่อย แต่พอเอามา Render จริงๆ font ไทย เนียนนะครับ ใช้ได้หมด แต่สระ เสือกกลายเป็น สี่เหลี่ยมหมด (คิดว่าคงมีวิธีแก้ แต่ตอนนี้ไม่ได้หาต่อแล้ว) ก็เลยข้ามไปก่อน กะว่าจะมาหาวิธีแก้ ที่ตัวนี้แหละ แต่ยังไงขอลอง ตัวถัดไปก่อน

mPDF

ตัวนี้บอกตามตรง ตอนแรกผมค่อนข้างจะไม่สนใจ ด้วยความที่หน้าเว็บ ดูไม่โปร (ใช้ WordPress ไม่เปลี่ยน Theme) PageRank ไม่ขึ้นเลย Search หาก็ไม่ค่อยมีข้อมูล

แต่ก็ลองดู เพราะว่า คงใช้เวลาไม่นาน ดูตามตัวอย่างแล้ว เขียนตามนิดเดียวก็คงรู้ผล

แต่เรื่องไม่น่าเชื่อก็เกิดขึ้น คือ Lib ตัวนี้กับทำตามที่ผมต้องการได้ทุกอย่าง คือโจทย์ของผมมีว่า

– ต้องสามารถอ่าน CSS ได้

– ต้องสามารถแสดงผล ได้เหมือน HTML เพี้ยนได้ไม่เกิน 2%

– ต้องสามารถใช้งานกับภาษาไทยได้ 100%

– ใช้ง่ายไม่ต้องต่อ online กับ Service ภายนอกตัวอื่นๆ

– ต้องสามารถ ทำ Paging ในตัว PDF ได้

– ต้อง Config header + footer ได้

– ต้องอ่าน img แล้วนำเข้าไปได้

ไม่น่าเชื่อก็ต้องเชื่อแหละครับ Lib ตัวนี้ทำได้หมดเลย ได้มากกว่าที่ผมต้องการเสียอีก แถมระบบการ Config ก็เอื้อ แก้การประยุกต์ใช้งานมากๆ

มาลองดูตัวอย่างที่ผมทำการ Lab ไปนะครับ

สมมุติว่า ผมมี HTML ตามนี้

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

$html = <<<EOF
<div id=”wrapper”>
<div>
<div><img src=”/wp-content/uploads/archive/iannnnnAVATAR_normal.png” /></div>
<div>
<div>
<a href=”#”>Name<span>@username</span></a>
<small>4m</span>
</div>
<p lang=”th”>[THAI TEXT TO SHOW]</p>
<div>Footer text</div>
</div>
</div>
<div></div>
</div>
EOF;

?>

 

แล้วผมมี stylesheet ประมาณนี้

1
2
3
4
5
6
7
8
9
10
11
.row { background:url(/wp-content/uploads/archive/bg.jpg); }
.row { clear:both; width:500px; padding:10px; border-radius:5px; font-family:naipol; font-size:11px; background-color:#EEE; }
.picture { float:left; display:block; width:48px; height:48px; }
.picture img { width:48px; height:48px; border-radius:5px; }

.content { margin-left:60px; }
.content .header small { float:right; text-align:right; }
.content p { margin:0; padding: 5px 0; }
.content .footer { color:orange; }

.clear { clear:both; }

 

ผมลองเขียนโคดขึ้นมาเพื่อ Gen ออกมาดู

1
2
3
4
5
6
7
8
9
10
<?php
$mpdf = new mPDF();
//$mpdf->setDisplayMode(‘fullpage’);
//$mpdf->setAutoFont();

$mpdf->writeHTML($style, 1);
$mpdf->writeHTML($html);
$mpdf->Output();

?>

โดยที่ Stylesheet ผมใส่ไว้ในตัวแปล $style นะครับ

 

ผลลัพธ์ที่ออกมาของผม มาตามรูปข้างล่างนี้ครับ

ซึ่งเหมือนกับ HTML เป๊ะเลย เรื่องของ Font Thai ผมใช้ “Thonburi” เป็นตัว font ครับ

ที่สำคัญ Lib ตัวนี้ยังมีการ config font ที่ฉลาดมา และยังสามารถ Detect ภาษาให้เองได้ด้วยอีก

http://mpdf1.com/manual/index.php?tid=453

 

ลองไปเล่นดูนะครับ มันเหมาะกับการ Generate Reports, Coupons หรือ หน้าเว็บ มาก

 

Linux Compatible Software For All Your Needs!

Source : http://efytimes.com/e1/fullnews.asp?edid=114297

 

Linux Compatible Software For All Your Needs!  
 
 
Although Linux offers a huge plethora of software, users often get confused when it comes to choosing the right one. So here we bring to you a list of Linux software for your complete computing needs (almost)!     
Rate this news:   (1 Votes)
Monday, August 26, 2013:  Searching for a Linux software? Well here your search ends, we present to you a complete list of Linux compatible software for anything and everything! Have fun reading: 

Linux, Open source, open source projects, linux software, Linux compatible software, anti-virus software, Avast, AVG, archive manager, audio linux software

Anti-virus Software:

Avast!: A Linux software offering of the popular Avast antivirus scanner.http://www.avast.com/linux-home-edition

Clam AntiVirus: The original open source virus scanner. http://www.clamav.net/

AVG: A version of AVG’s Virus Scanner for Linux. http://free.avg.com/us-en/download.prd-alf

Archive Manager:

Ark: A feature-rich archive manager for KDE. http://utils.kde.org/projects/ark/

File Roller: The default archive manager in GNOME. http://fileroller.sourceforge.net/

Tar: Provides the ability to create tar archives, as well as various other kinds of manipulation. http://www.gnu.org/s/tar/

Audio:

OggConvert: converts most formats of the media files into the open source OGG format.http://oggconvert.tristanb.net/

Audacity: A powerful cross platform audio recorder and editor.http://audacity.sourceforge.net/

Banshee: A great music manager similar to iTunes. http://www.banshee.fm/

Mixxx: Fantastic audio mixing Linux software that is ideal for DJ environments.http://www.mixxx.org/

Backup Applications:

CrashPlan: An excellent, sophisticated backup program. http://www.crashplan.com

Rsync: A configurable console-based synchronization program that is commonly used in backup situations. http://rsync.samba.org 

Fwbackups: A flexible backup program which can backup to another computer.http://www.diffingo.com/oss/fwbackups 

Browsers:

Google Chrome/Chromium: A great browser from Google based on open source projects.http://www.google.com/chrome

Firefox: The world’s most popular open source web browser. http://www.firefox.com/

reKonq: A refreshed default KDE browser which sports an uncluttered interface.http://rekonq.kde.org/

Opera: The “fastest and most advanced” browser available today. http://www.opera.com/

Communication:

Kopete: Great IM Linux software for KDE. http://kopete.kde.org/

Emesene: Linux Chat software which connects the user to different networks like MSN, Gtalk, Facebook chat, Jabber and others. http://blog.emesene.org/p/downloads.html

Pidgin: The most popular open source cross-platform IM program. http://www.pidgin.im/

Skype: If the most popular VoIP desktop client is on Linux we can’t afford to miss this!http://www.skype.com/intl/en/home

Desktop Environment:

GNOME: The most widely used GTK desktop environment. http://www.gnome.org/

KDE: A beautifully flashy desktop environment based on Qt. http://www.kde.org/

Enlightenment: A desktop environment that is lightweight yet aesthetically good-looking.http://www.enlightenment.org/

Xfce: A lightweight but highly capable GTK desktop environment that still makes use of panels by default. http://www.xfce.org/

Razor-qt: A lightweight desktop environment based on Qt, the same technology which KDE uses. http://razor-qt.org/

Download Managers:

Miro: Helps downloading torrents and online videos. http://www.getmiro.com/

Wget: A Non-interactive commandline tool which helps retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. http://www.gnu.org/s/wget/

Uget: A Free and open source download manager. http://urlget.sourceforge.net/

Transmission: Torrent download software for Linux. http://www.transmissionbt.com/

DVD/CD Tools:

K3b: The CD/DVD Kreator for Linux. http://www.k3b.org/

Gmount ISO: A simple program to mount ISO files to folders. https://launchpad.net/gmount-iso

Brasero: A utility to burn CDs. http://projects.gnome.org/brasero/

Editor Tools:

Vim: An extremely customizable and complex editor for the terminal with tonns of features. http://www.vim.org/

Gedit: A powerful editor out-of-the-box, and a favorite among many GNOME users.http://projects.gnome.org/gedit/

Leafpad: A simple GTK+ text editor that emphasizes simplicity.http://tarot.freeshell.org/leafpad/

Bluefish: Editor for programmers with focus on dynamic and interactive websites.http://bluefish.openoffice.nl/index.html

Email Clients:

Thunderbird: Most popular cross-platform open source email client.http://www.mozillamessaging.com/en-US/thunderbird/

Claws Mail: A user-friendly, lightweight, and fast email client. http://www.claws-mail.org/

Evolution: A great email and calendar program for GNOME. http://projects.gnome.org/evolution/

Firewall Applications:

Mondo Rescue: A capable disk recovery toolkit. http://gufw.tuxfamily.org/

Firestarter: A good quality firewall with graphical interface http://www.fs-security.com/

Office:

Libre Office: An enhanced office suite based off of OpenOffice. http://www.libreoffice.org/

Abiword: A lightweight word processor, usually replaces full office suites.http://www.abisource.com/

OpenOffice: The original open source office suite. http://www.openoffice.org/

Read more Office alternatives at: 
http://www.efytimes.com/e1/creativenews.asp?edid=104251

Pictures:

Inkscape: A SVG file editor. http://inkscape.org/

GIMP: The most popular open source image editor. http://www.gimp.org/

Darktable: A sophisticated program that works with digital negatives and RAW pictures.http://www.darktable.org/

F-Spot: A photo manager with neat simple features. http://f-spot.org/

Productivity Tools:

Tomboy: An amazing note-taking Linux application. http://projects.gnome.org/tomboy/?pagewanted=all

Hamster Time Tracker: Tracks the total time you spend on a project.http://projecthamster.wordpress.com/

Shutter: An advanced and brilliant screenshot tool. http://shutter-project.org/

Dropbox: One of the best Linux file synchronization tools. http://www.dropbox.com/

Gnome Tweak Tool: Helps in easy configuration of advanced settings while using Gnome Shell. http://live.gnome.org/GnomeTweakTool

Wunderlist: A Linux software for clean and crisp to-do list which syncs on their own servers. http://www.wunderlist.com/

System Maintenance:

Ubuntu-Tweak: A great control panel to manage many features in Ubuntu.http://freshmeat.net/projects/gnome-system-monitor/

System Monitor: Simple and interesting Linux software to view systems stats.http://freshmeat.net/projects/gnome-system-monitor/

Video:

VLC Media Player: A media player that can handle virtually everything.http://www.videolan.org/vlc/

Openshot: An innovative video editor with 3D effects. http://www.openshotvideo.com/

Pitivi: A simple and easy-to-use video editor for GNOME. http://www.pitivi.org/

Blender: Highly advanced 3D content creation software that has created numerous open source video games and movies. http://www.blender.org/ 

Atithya Amaresh, EFYTIMES News Network 

How to create a bootable ubuntu USB stick?

Source : http://techosolutions.wordpress.com/2013/08/26/how-to-create-a-bootable-ubuntu-usb-stick/

 

About ubuntu

According to “Wikipedia” : “Ubuntu is an operating system based on the Linux kernel and the Linux distribution Debian, with Unity as its default desktop environment. It is distributed as free and open source software. It is named after the Southern African philosophy of ubuntu, which often is translated as “humanity towards others” or “the belief in a universal bond of sharing that connects all humanity”.
According to 2012 online surveys, Ubuntu is the most popular Linux distribution on desktop and laptop personal computers, and most Ubuntu coverage focuses on its use in that market. However, it is also popular on servers and for cloud computing.
Development of Ubuntu is led by Canonical Ltd., a company based in the Isle of Man and owned by South African entrepreneur Mark Shuttleworth. Canonical generates revenue through the sale of technical support and services related to Ubuntu. According to Canonical, the Ubuntu project is committed to the principles of open source development; people are encouraged to use free software, study how it works, improve upon it, and distribute it”.
 

Here we will learn How to create a bootable ubuntu USB stick on “WINDOWS” , “OS X” and “UBUNTU”

 

ubuntu

windows

To run Ubuntu from a USB stick, the first thing you need to do is insert a USB stick with at least 2GB of free space into your PC.

The easiest way to put Ubuntu onto your stick is to use the USB installer provided at pendrivelinux.com. You’ll need to download and install and follow the instructions.

1. 

Select Ubuntu Desktop Edition from the drop down list.

 

 

 

 

 

 

 

 

 

 

2.

Click ‘Browse’ and open the downloaded ISO file.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.

Choose the USB drive and click ‘Create’.

 

 

 

 

 

 

 

 

 

 

 

 

ubuntu

ubuntu

To create a USB stick from which you can install Ubuntu, you must first download Ubuntu. Then, follow these instructions:

 

1.

Insert a USB stick with at least 2GB of free space.

2.

Open the dash and search for Startup Disk Creator.

3.

Select the Startup Disk Creator to launch the app.

 

 

 

 

 

 

4.

Click ‘Other’ to choose the downloaded ISO file.

 

 

 

 

5.

Select the file and click ‘Open’.

 

 

 

 

 

 

 

 

 

6.

Select the USB stick in the bottom box and click ‘Make Startup Disk’.

 

 

 

 

 

 

 

 

 

7.

That’s it! When the process completes, you’ll be ready to restart your computer and begin installing Ubuntu.

ubuntu

osx

We would encourage Mac users to download Ubuntu Desktop Edition by burning a CD. But if you prefer to use a USB stick, please follow the instructions below.

Note: this procedure requires that you create an .img file from the .iso file you download. It will also change the filesystem that is on the USB stick to make it bootable, so backup all data before continuing.

1.

Download Ubuntu Desktop

2.

Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight).

3.

Convert the .iso file to .img using the convert option of hdiutil (e.g.,hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso)

Note: OS X tends to put the .dmg ending on the output file automatically.

4.

Run diskutil list to get the current list of devices.

5.

Insert your flash media.

6.

Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2).

7.

Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2).

8.

Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.imgor ./ubuntu.dmg).

  • Using /dev/rdisk instead of /dev/disk may be faster
  • If you see the error dd: Invalid number ’1m’, you are using GNU dd. Use the same command but replace bs=1m with bs=1M
  • If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the ‘Disk Utility.app’ and unmount (don’t eject) the drive

9.

Run diskutil eject /dev/diskN and remove your flash media when the command completes.

10.

Restart your Mac and press alt/option key while the Mac is restarting to choose the USB stick.

Best Tools To Build Your Own Ubuntu based Distribution

Best Tools To Build Your Own Ubuntu based Distribution

http://alllinuxstuff.blogspot.com/2012/07/five-tools-to-build-your-own-ubuntu.html

article หลัก

Ubuntu Mini Remix
http://www.ubuntu-mini-remix.org/
image ของ ubuntu เฉพาะไฟล์ที่จำเป็นต้องใช้จริงๆ ฉะนั้นขนาดจะเล็ก ประมาณ 200MB

ลองติดตั้งด้วย VirtualBox แล้วติดตั้งไม่ได้

เครื่องมือ 1. Ubuntu Builder

https://launchpad.net/ubuntu-builder/

sudo add-apt-repository ppa:f-muriana/ubuntu-builder
sudo apt-get update
sudo apt-get install ubuntu-builder

เครื่องมือ 2. Ubuntu Customization Kit

http://sourceforge.net/projects/uck/

sudo apt-get install uck

ใช้ปรับแต่ง language packs, desktop environment และอื่นๆ อีกนิดหน่อยได้เท่านั้น

3.Customizer

https://github.com/fluxer/Customizer
sudo add-apt-repository ppa:customizer-dev-team/ppa
sudo apt-get update
sudo apt-get install customizer

x

Live CD Customization From Scratch

Source https://help.ubuntu.com/community/LiveCDCustomizationFromScratch

This procedure works and can create a bootable Ubuntu LiveCd (along with the automatic hardware detection and configuration) from scratch. You do not need to start from a pre-existing LiveCd.

 

You may wish to create an Ubuntu Remix and distribute it as a LiveCd. Here is a way to do that without having to start from an existing Ubuntu Desktop Cd.

 

 

 

Overview

 

There are three different areas to think about; the host system, the disk image and the chroot.

 

 

 

The Host System

 

This refers to the Ubuntu desktop you are running, the one the customised LiveCd is being built on. You will need to install the syslinux, squashfs-tools and genisoimage packages to be able to build the LiveCd Remix using the current system.

 

 

 

The Disk Image

 

The disk image is a folder that we will burn to Cd. Just create a new folder to be the Disk-Image-Folder. The isolinux bootloader binary (taken from the syslinux package) needs to be copied onto the disk image so it will go into the disk image folder for now. The isolinux configuration file, which will allow the Cd to show a boot-menu at boot time, needs to be copied into there too. You will also copy the kernel from the chroot onto the disk image (folder).

 

The disk image will be created in the host environment, outside of the chroot.

 

 

 

The ChRoot Environment

 

This is the system that will eventually run from the disk. It does not need a kernel, nor a boot-loader unless you are planning on installing it back onto a hard disk (using Ubiquity). The Casper package needs to be installed into the chroot. Casper is what allows the Live System to perform hardware autoconfiguration and run from a live environment. Installing the Casper package will update the kernel’s initrd to perform these tasks. The kernel that is installed into the chroot will be copied out from the chroot and put into the disk image.

 

The chroot will end up inside the disk image in the form of a squashed (compressed) file. For right now, it will be just another folder on your host system.

 

The basic steps are to

 

  1. Create a chroot and install your packages there.
  2. Compress the chroot system into a file.
  3. Create and configure the disk image which will have the bootloader (isolinux), the kernel, the compressed file-system image and some other stuff.
  4. Burn the Cd and test it out.

 

 

 

Make the ChRoot Environment

 

From a command-line install debootstrap on the host system. Then make a new folder “work” and inside that make another directory “chroot”. Then run debootstrap

 

Note: The version of Debootstrap for a release of ubuntu does not contain the files to bootstrap the next Ubuntu release. For example, you cannot bootstrap Karmic on an Intrepid system without intalling Karmic’s debootstrap package. Find the version of debootstrap you need here and install it using dpkg. The debootstrap package doesn’t depend on any other packages and so installing it “by hand” will not cause any problems on your system.

 

 

 

 

$VERSION above should be replaced with whatever you have obtained. Likewise, $RELEASE is the version of Ubuntu you intend to build an ISO for. $ARCH is the target processor architecture; most of the time, using i386 would be safe. x86_64 is one of the other possible options.

 

The code above creates a directory called work, with a chroot directory inside it. The debootstrap command installs a bare Ubuntu system into work/chroot.

 

If downloading from the main archive is slow, use one of the alternatives from this list of mirrors by adding the URL to the end of the debootstrap command, otherwise the ubuntu.com archive will be used by default.

 

Note: If you want to build a newer release of Ubuntu which you cannot bootstrap, for example oneiric:

 

 

 

 

It is important to install custom applications such as MySQL after linux-generic is installed because such applications require kernel modules for post-install configurations.

 

If you are planning on installing anything using the package desktop-base (xfce4 for instance), you will also need to bind your /dev to the chroot as well (not just devpts). Otherwise, grube-probe will error out and you won’t be able to finish the installations. Replace /path/to/chroot/dev with your respective chroot.

 

 

 

 

Now copy the system files so you can get some internet in the chroot.

 

 

 

 

Note: If you are bootstrapping a release of Ubuntu other then the release you are currently running you should substitute the ‘sudo cp /etc/apt/sources.list chroot/etc/apt/sources.list’ command with the following.

 

 

 

 

For example if you are running precise and you are bootstrapping oneiric the command would be:

 

 

You may edit the sources.list in the chroot to add a line from a PPA, if you need. You will need to add the PPA’s key to your chroot’s package manager. On the PPA’s overview page you’ll see the PPA’s OpenPGP key id. It’ll look something like this: 1024/12345678. Copy it, or make a note of, the portion after the slash, e.g: 12345678. This key will be added once we enter the chroot.

 

Important: Make a backup copy of /sbin/initctl this next step will delete this file. There is a problem with 10.04 upstart package not containing /sbin/initctl.distrib and even after you update upstart the directions for leaving the chroot do not seem to restore this file.

 

 

 

 

There is a current (for Karmic, Lucid, …, Precise) issue with services running in a chroot: https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430224.

 

A workaround is to link /sbin/initctl to /bin/true.

 

 

 

 

Upgrade packages if you want:

 

 

 

 

Install packages needed for Live System:

 

 

Before Maverick, discover named to discover1. Adjust the preceding lines accordingly.

 

If you make Lucid Lynx (10.04) base Live system you need install grub2 plymouth-x11 packages:

 

 

Jaunty Jackalope (9.04) seems to hang on the configuration of the network interfaces unless network-manager is installed. This is no longer a problem in Karmic 9.10.

 

 

 

 

Next, you may install more packages as you like, assuming you have the legal rights to redistribute the packages. This is where you build your custom system using packages from the Ubuntu archives.

 

 

 

Graphical installer, optional step

 

The customised system can be set-up to allow it to be installed onto machines rather than only ever being a LiveCd. Simply install the Ubiquity packages and an appropriate desktop environment with a window manager. This step is optional and only needed if you want to allow your customised Ubuntu system to be installed on other computers.

 

 

 

For the Gtk front-end

 

 

 

 

 

 

For the Qt front-end

 

 

 

 

 

 

Cleanup the ChRoot Environment

 

If you installed software, be sure to run

 

 

Before exiting the chroot, remove the diversion:

 

Earlier this guide asked you to make a backup copy of /sbin/initctl. If the following command does not restore this file, then restore from the backup copy you made.

 

 

 

 

Remove upgraded, old linux-kernels if more than one:

 

 

 

 

Then just clean up.

 

 

 

 

If you also bound your /dev to the chroot, you should unbind that.

 

 

 

 

So far, you have entered the chroot and installed packages, then cleaned up and left.

 

 

 

Create the Cd Image Directory and Populate it

 

There are 4 packages that need to be installed on the Host System which provide the tools to make the Cd image. Syslinux contains isolinux which makes the Cd bootable. Squashfs-tools will compress the image. Genisoimage provides mkisofs tool to turn a directory into a CD image. So install syslinux, squashfs-tools, mkisofs and sbm.

 

 

This next command makes the image directory and the 3 required subdirectories.

 

 

A. You will need a kernel and an initrd that was built with the Casper scripts. Grab them from your chroot. Use the current version. Note that before 9.10, the initrd was in gz not lz format…

 

 

B. If you have a problem with vmlinuz and initrd copying – maybe you have more than one from these files – you can using following commands:

 

 

You need the isolinux and memtest binaries.

 

 

 

 

 

 

Boot Instructions for the Remix User

 

To give some boot-time instructions to the user create an isolinux.txt file in image/isolinux, for example:

 

 

 

 

Splash Screen

 

A graphic can be displayed at boot time, but it is optional. The example text above requires a special character along with the file name of the splash image (splash.rle). To create that character, do the following use the following command:

 

 

 

 

and then edit the emptyfile with any text editor. Add the file name just next to the first character and add the text you want to display at boot time beneath it and save the file as “isolinux.txt”

 

To create the splash.rle file, create an image 480 pixels wide. Convert it to 15 colours, indexed (perhaps using GIMP) and “Save As” to change the ending to .bmp which converts the image to a bitmap format. Then install the “netpbm” package and run

 

 

 

 

Boot-loader Configuration

 

Create an isolinux.cfg file in image/isolinux/ to provide configuration settings for the boot-loader. Please read syslinux.doc which should be on the host machine in /usr/share/doc/syslinux to find out about the configuration options available on the current set-up. Here is an example of what could be in the file:

 

 

Don’t forget to pick the correct extension for your initrd (initrd.gz or initrd.lz). Now the CD should be able to boot, at least it will be after the image is burned Wink ;)

 

 

 

Create manifest:

 

 

 

 

 

 

Compress the chroot

 

If this Customised Remix is to potentially be installed on some systems then the /boot folder will be needed. To allow the Customised Cd to be an installer Cd, compress the entire chroot folder with this command:

 

 

Then write the filesystem.size file, which is needed by the installer:

 

 

However, if it is not going to be installed and is ‘only’ meant as a LiveCD then the /boot folder can be excluded to save space on your iso image. The live system boots from outside the chroot and so the /boot folder is not used.

 

 

It is important to note that if you are building a Karmic LiveCd on an earlier system, you will need the squashfs-tools package from Karmic or the LiveCD will not boot.

 

 

 

Create diskdefines

 

 

 

 

example:

 

 

 

 

Recognition as an Ubuntu Remix

 

Create an empty file named “ubuntu” and a hidden “.disk” folder. This is needed to make the USB Creator work with this custom iso image. Without this the image will still boot but the USB creator will not recognize the image as an Ubuntu CD and refuse to use it. Also, create the following files with the pertinent information:

 

 

 

 

Calculate MD5

 

 

 

 

This calculates the md5sum of everything in the image folder, except the file named md5sum.txt.

 

 

 

Create ISO Image for a LiveCD

 

Create iso from the image directory using the command-line

 

 

The boot.cat file will be automatically created. You may test your image through virtualbox-ose instead of rebooting your real system if you wish.

 

 

 

Make a bootable USB image

 

The USB-Creator works properly with the iso image that has been created so long as the hidden “.disk” folder and its contents are present. If you prefer to do it “by hand”, you can put your live system onto a USB drive yourself. Follow these six steps to do so. You can use these steps to put an existing LiveCd onto a Usb bootable device.

 

 

 

FAT16 file-system (Windows)

 

1. Prepare your work area:

 

 

2. Create a loop device with a fat16 file-system. Use whatever size you need to fit your image; in this case it’s a 200Mb sparse file. A sparse file is a file that is bigger than the actual number of bytes it takes up on the disk.

 

 

3. Two options here;

 

3a Mount the Cd-Rom iso image and your new file-system:

 

 

3b Just use the “image” folder instead of mounting the iso image. This is useful if you don’t want to make anything other than a Usb image from scratch (You don’t have to make a Cd iso image if you don’t need it)

 

 

4. Copy the files

 

 

5. Change the location of the boot-loader and its configuration file and make it bootable (For fat16 file-system (default))

 

 

6. Pack it up

 

 

To install onto a usb drive. Insert the drive and identify it’s mount-point, for example /dev/sdc. Ensure that the device has a partition table on it and run

 

 

 

 

Ext2 file-system (proper Linux)

 

An ext2 file-system is useful in that it can hold larger files and the boot-loader can support relative symlinks. Follow the same steps as above, but substitute the instructions in steps 2 & 5

 

2. Create an ext2 file-system instead of FAT16, obviously.

 

 

5. It needs to be made bootable *before* unmounting.

 

 

 

 

Partitioning your Usb device

 

A persistent home can be included within a file instead of a partition. If you want to use a whole partition, do the following.

 

The Usb image can be installed to any partition on the device. Just make sure that partition is the only one that is marked as bootable. You can partition your Usb storage device to contain the LiveUsb image as well as a storage partition. You can use the storage partition to:

 

– keep a small amount of recovered files.

 

– create a persistent home.

 

– or you can use it as swap space.

 

To partition your device, see HowtoPartition.

 

If the storage partition is located after the LiveUsb image partition then Windows won’t be able to see it. This is not a problem since you can create the storage partition first and put the live image at the end of the drive. Just make the LiveUsb image partition the only partition flagged as bootable.

 

When the drive boots the bootable partition will be used and you are good to go. The LiveUsb image’s partition won’t be seen by Windows.

 

 

 

Troubleshooting

 

If the device does not boot, you may need to install an MBR onto the device.

 

 

and try again.

 

 

 

Persistent Data

 

Create an ext2, ext3 or ext4 partition named “casper-rw” as a separate partition and append the word “persistent” to your “append” line configuration and all your session data will be stored there. You will be able to keep your changes between boots.

 

 

 

 

To Do

 

-Graphical boot

 

http://wiki.debian.org/DebianDesktopMakeSysImageEtch

 

http://www.sweb.cz/Frantisek.Rysanek/splash/isolinux-splash-HOWTO.html)

 

 

 

Comments

 

If you have any comments or questions, please feel free to add them here.

 


 

 

 

I wrote some instructions detailing how to create an Ubuntu Live CD from scratch with debian’s live-helper scripts: http://david.decotigny.fr/wiki/wakka.php?wiki=LiveHelperUbuntu Tested on an x86_64 jaunty host for an i386 jaunty target CD.

 

DavidDecotigny

 


 

 

 

Hi, I have a question on this guide. The remix after going through these step does not include Gnome Desktop, right? If so, can someone provide me the package name to the Gnome Desktop?

 

Thks Alan Chen.

 


 

Alan,

 

The ubuntu-desktop package is based on gnome. If you try to install it with apt-get it will resolve all the dependencies and provide a list. Before installing, it will prompt you and then you can quit. Review the list and you may find the packages you need.

 

Andrew,

 

I’d like a live-cd that requires login and does not provide root access without a password of my choosing. Is this possible?

 

-Patrick

 

I guess that Casper can do that. Look in the Casper configurations.Perhaps you need to create the user and password while making the chroot, then tell Casper to only use that user? – Andrew

 


 

 

 

Andrew et al,

 

I’m not sure that the instructions added here for the issue with running services in the chroot in Karmic are quite right. I say this because I used them today and it resulted in removing the following files: /sbin/start, /sbin/stop, /sbin/initctl. The commands used for removing the diversion did not restore them, and I had to manually reinstall them using a deb file. – Josh

 


 

 

 

-Sergey

 

I have made all as is written in this instruction. After loading from a disk I get to live cd command line. How I can start installation?

 


 

 

 

How can I set the keyboard language for the console and X? Currently I can make the livecd without problem but the kbd language is always en. Tnx in advance.

 

Matteo

 


 

 

 

People interested in a graphical environment read tasksel documentation.

 

This command show a list of all live CD/DVD tasks (groups of software)

 

 

 

 

and this other the list of packages in the ubuntu-live task

 

 

 

 

Carles Barreda

 


 

 

 

Hi, I’m working on a unnattended install CD using Ubuntu Lucid 10.04, and I found that if you erase /sbin/initctl the automatic install doesn’t run. Also the instruction to generate the initctl using dpkg-divert is not working. So be careful…

 

Alejandro

 


 

When I follow this guide using 10.04. After the system boots it seems casper wants to run gdm. However, nowhere in this guide were there instructions for installing gdm and a window manager. Which is exactly what I want. The problem is that casper does not setup any ttys for me. How can I get casper todo this?

 

-pfifo

 


 

How do I install debian-installer is the same as in the alternate-cd, get it to start after instead of the live cd?

 

Serg

 


 

 

 

Is it possible to make an HD install from the CD/DVD that has no /pool and /dists folders? I start installation and AptSetup gives me error 127 trying to read the CD pool contents. There’s nothing said about that here. As far as I understand this method uses the current (up to date) packages, so we have to grab the cd repo packages from the net repo also if we don’t want to break dependencies.

 

Pry

 


 

Pry: If you get an error 127: after install ubiquity open chrooted environment following file:

 

 

and uncomment following line: about 136

 

 

(put an # sign):

 

 

save and test it. If you have an generated LiveCd you can do it in booted Ubuntu Live environment too. Sevoir

 


 

 

 

Yet another question. Is it possible to get the package names to be excluded from the HD install (the difference between filesystem.manifest and filesystem.manifest-desktop files) ? It doesn’t seem to be a good idea trying to figure out what to exclude for the next release.

 

Pry

 


 

 

 

Successfully completed this great guide! Thanks to everyone who contributed. Now I’m curious, after having followed this, tested out Reconstructor (meh, not worth $5 in my opinion), and other variants… at what point in this guide could one make some sort of a backup, to start a new build, without having to download the base packages and such? I am assuming after the debootstrap runs? Could I just back up the chroot folder and in the future continue from there with the backup? I’m going to try this, but I want to be certain that there aren’t any ‘gotchas’ with this method.

 

Derjyn

 

One possible answer might be another guide in this series

 

 

So, the Cd itself can be considered a back-up stage to be developed from! Smile :)

 


 

Hello,

 

I just created a bootable/live usb drive with ubuntu 11.04 on it. the problem is that the drive is 16 gigs, but the program I used to create the live usb only allowed me to allocate 4 gigs of extra space (that is space above the space needed for Ubuntu). So I would like to make the extra space much larger perhaps even allow it to fill the whole drive. Is it possible to resize this? and if so how?

 

Thanks, Daniel Kimbro.

 


 

Interesting… I’ve gone through this procedure a couple of times now. It’s awesome! What I don’t get though is, something else is happening. If you make changes in /etc/init, those changes won’t show up when you boot into the live environment.

 

I was even more surprised when I found that /home/ubuntu doesn’t exist. Assuming this is something Casper does (given that it also takes care of persistent data which gets mounted as /home), where does it store this information?

 

Regards, Nevyn Hira.

 


 

 

 

It looks like the sbm package existed in natty but has since been eliminated. Does anyone know if a separate package needs to be installed in precise or oneiric? I will forge ahead and report back either way on my results.

 

Thanks, erixoltan

 


 

 

 

This howto is excellent! I am, however, having a problem getting my wireless networking credentials onto the custom image. I’ve tried to do this simply by copying over /etc/NetworkManager/system-connections/* but this is causing problems. When I boot to the image, it says the installer encountered an “unrecoverable error” and then goes to a desktop session without any problem.

 

The specific error is in /usr/lib/ubiquity/bin/ubiquity:

 

 

 

 

Any help would be appreciated. Thanks!

Mark

Live CD Customization

Source https://help.ubuntu.com/community/LiveCDCustomization

Why customize LiveCDs

You may wish to customise the Ubuntu Desktop LiveCd to:

  • make your own Linux / Ubuntu distribution
  • show off a particular application
  • localise to a certain language
  • remove software packages
  • add software packages
  • update software packages
  • change system defaults (theme, icons, desktop background, panels, browser homepage, etc)

 

How to Customise the Ubuntu Desktop CD

The easiest way to create a custom LiveCD is to use Ubuntu Customization Kit. What follows is the manual way of accomplishing the same.

You might also want to create a LiveCD from an existing installation; in this case, Remastersys is for you.

IconsPage/warning.png This guide is for the Desktop LiveCd; there is another page referring to customisation of the Alternative Install Cd & the Server Install Cd. Also, there is a guide on how to create a LiveCd without using an existing LiveCd.

 

System Requirements

  • At least 3-5 GB of free space
  • At least 512 MB RAM and 1 GB swap (recommended)
  • squashfs-tools
  • genisoimage, which provides mkisofs
  • An Ubuntu kernel with squashfs support (present in Ubuntu 6.06 and later)
  • QEMU/KVM, VirtualBox or VMware for testing (optional)

IconsPage/warning.png When customizing 9.10 Karmic Koala (or later) in an 9.04 Jaunty Jackalope (or earlier) environment, squashfs-tools must be updated to version 4.0. Conversely, the version of squashfs-tools in Ubuntu 9.10 is not compatible with earlier versions of Ubuntu.

IconsPage/warning.png The architecture (Amd64 or i386) to be stored on the LiveCD should be the same as the architecture used to perform the customization, or the LiveCD may not run. It is not trivial to customize an AMD64 LiveCD using an i386 operating system, for example.

 

Install pre-requisities

  • Make sure that you have installed the needed tools

 

 

Obtain the base system

Note: the example shown here uses the ubuntu-9.04-desktop-i386.iso Desktop CD. Replace it with the name of your iso. For example, if you have a ubuntu-11.04-desktop-i386.iso image, the command:

would be changed to:

  • Move or copy it into an empty directory

 

 

Extract the CD .iso contents

Mount the Desktop .iso

Extract .iso contents into dir ‘extract-cd’

 

Extract the Desktop system

Extract the SquashFS filesystem

 

Prepare and chroot

If you need the network connection within chroot

Depending on your configuration, you may also need to copy the hosts file

 

(these mount important directories of your host system – if you later decide to delete the edit/ directory, then make sure to unmount before doing so, otherwise your host system will become unusable at least temporarily until reboot)

To avoid locale issues and in order to import GPG keys

 

Customizations

 

Apt-get

 

Prerequisites

In 9.10, before installing or upgrading packages you need to run

 

and

 

 

Tasks

To view installed packages by size

When you want to remove packages remember to use purge

 

Custom Background for GNOME

Generally background files are located in /usr/share/backgrounds. Copy your png file there, adjust owner and file access, and edit the files:

  1. /usr/share/gnome-background-properties/ubuntu-wallpapers.xml and
  2. /usr/share/gconf/defaults/16_ubuntu-wallpapers or other files in the same directory. by changing the string /usr/share/backgrounds/warty-final-ubuntu.png to point to your file

Eventually change or add attributes to other configuration files such as: /var/lib/gconf/debian.defaults/%gconf-tree.xml or /etc/gconf/gconf.xml.defaults/%gconf-tree.xml).

Historical: More for Dapper…

 

Change gconf values (fonts, panels etc.)

To make any change on the gconf attributes you must add the value that you want in the file /etc/gconf/gconf.xml.defaults/%gconf-tree.xml. Adding a value in that file will change the default values of Gnome or other applications, so you can change fonts, backgrounds, themes, cursors etc.

Instead of editing the file with gedit or another text editor, you can use the gconftool-2, under the chroot environment, running the following line:

where string, yourkey and yourvalue must be the type, key and value that you want to change…

 

Making several gconf changes

Editing gconf by setting each value separately takes too much time. There is a better way:

Make a test user and adjust the settings as you wish. Run

 

and then, in the chroot environment, run

 

This way you can import the whole branch, e.g. /apps/panel – all settings for Gnome’s panels. Note that this way you import not only the keys, but also their descriptions, so all GConf descriptions will be changed to the language which was set for the test user, and there will be no way to safely change them back. Some programs (for example, keyboard shortcuts in Preferences menu) use descriptions from GConf.

 

Setting regional defaults

 

Change default language of gfxboot

This customization must be done outside the chroot.

 

Change “fi” to your preferred locale. Note that this does not change which languages are available in the F2 menu. For more info about gfxboot customization, see Ubuntu Customization Kit.

  • A other way to change the default language of gfxboot without rebuild the packages is to create a file name lang in the isolinux directory containing your locale’s name.

 

Change default keyboard

In 12.04, changing the default keyboard for a live boot is not as obvious as it used to be in 10.04 and earlier. As an example, if you want to keep the default language as English but set the default keyboard to “GB”, you are going to have to edit the file /usr/lib/ubiquity/ubiquity/misc.py. If you look at the hard-coded defaults table at around line 620 it should be fairly obvious what’s going on…

 

You can se the default keymap for your default language by editing this table, but remember that if you update the ubiquity package on your image then any changes will be clobbered.

Also note this only works for X. To set the console keyboard:

 

 

Customization limits

After customization make sure that there are no users with an UID == 999. Otherwise your image won’t boot because no initial user is available (see /usr/share/initramfs-tools/scripts/casper-bottom/25adduser, -> ‘db_set passwd/user-uid 999’). This may happen, for example, after installing VirtualBox/GuestAdditions

While in chroot:

 

If you get any hits, try changing the uid:

 

 

Miscellaneous Defaults

You may wish to edit the files in /etc/default to change system behavior at startup. You might also edit /etc/profile, /etc/bash.bashrc, and /etc/bash_completion to change login settings for all users on the system. You cannot directly edit defaults for the live cd user (e.g., casper, ubuntu, or user) since that account is created at boot time. You can directly edit root’s default files (/root in the chroot environment).

If you wish to change the default timezone used by the live cd, run:

 

If you have added a locale and wish to make it the default, update /etc/default/locale. You may have to compile the locale:

 

These changes must be made as root in the chroot environment.

 

Advanced Customizations

 

Live CD Kernel

If you want to customize further the boot process, you can change the livecd kernel, by copying the vmlinuz and initrd you want in place of the ones you find in extract-cd/casper.

i.e.

Note that the initial ramdisk filename for newer releases (since 9.10) is casper/initrd.lz (not .gz).

 

Removing the (Casper) Autologin

The autologin feature of the Jaunty/9.04 live CD is a bit of an on-the-fly boot-hack. After extracting the initrd.gz, you need to edit the casper-bottom/25configure_init script and then recreate the initrd.gz file, replacing the original in extract-cd/casper. The process to do so goes like this:

 

Now look for line 25 which has the conditional statement to test $USERNAME.

Line 25 performs a conditional evaluation and if it evaluates to true, it will execute the code within the if block. The if block contains code to modify files used in the boot process to create the live cd autologin.

To disable the autologin feature, Remove $USERNAME, but just leave the quotes. The -n modifier tests the $USERNAME string to see if it’s length is non-zero. By removing the variable, and leaving two double quotes, this statement evaluates to false because the two double quotes effectively make a zero-byte string. Be sure to leave no whitespace between the quotes because whitespace will make the evaluation true and execution wil fall into the if block.

After making the change, line 25 will look like this:

Save the file and quit the editor. Then, from extract-cd/casper/tempdir run the following command to re-create the initrd.gz file. There are other methods for re-creating the initrd.gz file on this page which may work also.:

 

This will create a new initrd.gz file with no auto login. You can then continue to remaster the CD as described on this page. Be sure to create a user and password to login with before you remaster the cd. If you do not, you will not be able to login after booting!

Also, I have read a few articles mentioning that Karmic (9.10) uses initrd.lz instead of initrd.gz. I do not know if this is true, but should mention it in case you are not getting the expected results. To unpack the initrd.lz file, you need to do this:

 

And to re-create the initrd.lz file:

 

Boot init

You have to edit the files in edit/usr/share/initramfs-tools/scripts/casper-bottom/* For example you can change the hostname or the livecd user.

i.e.

 

and edit the username or hostname

 

to edit even the livecd user’s password.

If you’re customizing 10.04, you need to edit variables in /etc/casper.conf for the user and host names instead of modifying the scripts

P.S. in order to obtain an encrypted password, you have to use the mkpasswd program that’s shipped with whois package!

 

Rebuilding initrd

After you’ve modified the kernel, init scripts or added new kernel modules, you need to rebuild the initrd.gz file and substitute it into the casper directory.

 

(replace the kernel version with the one that the CD will boot with – this can be found in edit/lib/modules) *** do I need to mount proc, sys, devpts after chroot here ? Gordon

Exit from the chroot jail and move this file to extract-cd/casper:

 

 

Cleanup

Be sure to remove any temporary files which are no longer needed, as space on a CD is limited. A classic example is downloaded package files, which can be cleaned out using:

Or delete temporary files

Or delete hosts file

Or nameserver settings

If you installed software, be sure to run

 

and

 

from within the chroot environment.

now umount (unmount) special filesystems and exit chroot

 

  • Note: if “umount /proc” command fails, “umount -lf /proc” will be used to retry automatically.

 

Producing the CD image

 

Assembling the file system

Regenerate manifest

Compress filesystem

  • Note: The -nolzma option is only available from Hardy , and was removed in Karmic. Also, the squashfs has to be generated using a version of mksquashfs that is compatible with the kernel used on the CD you are customizing. For example, you cannot generate a jaunty squashfs on karmic, as the jaunty kernel is not able to mount a squashfs prepared using mksquashfs from karmic.

For slightly higher compression at the cost of compression time, you can increase the block size:

For a highest possible compression at the cost of compression time, you may use the xz method and is better exclude the edit/boot directory altogether:

Update the filesystem.size file, which is needed by the installer:

Set an image name in extract-cd/README.diskdefines

(you can use “sudo nano extract-cd/README.diskdefines” if you have difficulties understanding vim)

Remove old md5sum.txt and calculate new md5 sums

Create the ISO image

 

Testing the CD

Test using qemu emulator

 

Or if you have hardware acceleration for kvm

 

You can also test with virtualbox-ose, which is free software and available in the Ubuntu universe repository.

 

Troubleshooting

Some experience problems virtualizing the iso after changing the livecd linux kernel. If you do, go click F6 when the boot screen is showing. Move the cursor between splash quiet and — and write: all_generic_ide

 

Burning the image to CD

Simple! Just do

 

 

Additional uses for the image

Install Ubuntu from a USB stick

Installation From Image Loaded On Hard Drive

 

Comments

If you have any comments or questions, please feel free to add them here.

If you are answering a question, please rewrite the question into a tip that answers the question. (to help keep things to the point.)

New questions at the bottom (I guess.)


I have created an small Customization Example (named Firebird Live CD) by adding an firebird2.1-superand flamerobin packages (this apply to ubuntu Hardy Heron also it was tested with xubuntu 8.04) http://flamerobin.blogspot.com/2008/08/creating-flamerobinfirebird-livecd-with.html


 

Warning: qemu did not work for me as given in the guide above. Even the normal 8.04 live cd would not boot correctly. Every time, I would get thrown into the ash shell (busybox, initramfs) and while there, a “cat /casper.log” would reveal that it was “Unable to find a medium containing a live filesystem”. Just use virtualbox-ose. It actually works with virtualbox. However, after using apt-get to install virtualbox-ose, I had to run “sudo depmod” again in order for the vboxdrv module to be found by modprobe. Hope that helps!

rocketman768


 

Warning: Squashfs is currently in development and is thus not finalized as a format. This means you cannot assume a filesystem.squashfs created using the Ubuntu 9.04 version of makesquashfs will be compatible with the squashfs drive an older live CD. I was customizing an Ubuntu 7.10 LiveCD and when testing it always booted it an (initramfs) prompt–the squashfs was not getting mounted as /. I had to build from within an Ubuntu 7.10 chroot to get it to work.

–Bob/Paul


I have created an small Customization Example (named Firebird Live CD) by adding an firebird-super-server and flamerobin packages (this apply to ubuntu dapper drake) http://flamerobin.blogspot.com/2006/05/creating-flamerobinfirebird-live-cd.html I created an updated guide with Ubuntu Festy Fawn also with an iso download for the Firebird/Flamerobin live cd http://flamerobin.blogspot.com/2007/09/creating-flamerobinfirebird-livecd-with.html


 

I have created tool for automatic remastering of live CD images. See http://uck.sourceforge.net/ .

Features:

  • GUI for simple creation of localized CDs (including changing gfxboot and installing language packs)
  • Script for customization of ISO, SquashFS and initrd on live CD.

http://www.atworkonline.it/~bibe/ubuntu/custom-livecd.htm seems to have some nice info. no license that I can see so we would need to ask permission from the author to us its material.


 

If you want to make the CD boot faster, you might try sorting the files so that they are in the CD in the order that they are accessed: http://lichota.net/%7Ekrzysiek/projects/kubuntu/dapper-livecd-optimization/


 

Great How To. I am having one issue however. I would like to use custom xorg.conf and sources.list files. Any tips on doing this? Thanks.

  • Simply, copy the files to edit/etc/ in the same way (and at the same time) that you copy in the resolv.conf and hosts files.
  • I have found that copying xorg.conf doesn’t work, as the boot-time scripts overwrite it. Besides, you can’t guarantee that a particular xorg.conf will run on all hosts. I’m currently trying to get the binary NVIDIA drivers to work out of the box if an NVIDIA card is present. If I figure out how to fix the xorg.conf, I’ll post it here. —JeremyVisser

 

I’ve managed to get Synaptic running from within the chroot environment, but it does hang when I try to apply packages. What you do is run “Xnest -ac :1” to get an Xnest server to run on display :1 without access control so anyone can connect to it. Then, in the chroot environment, run “export DISPLAY=:1” to get programs to use the display. Then, type “metacity &” to be able to move windows. Finally, run “synaptic”.

It works fine until you try to apply packages, where it hangs for me. —JeremyVisser


 

Shouldn’t the mkinitramfs command use the casper scripts, like “mkinitramfs -o initrd.gz 2.6.15-23-386 -d /usr/share/initramfs-tools”?


 

There are tricks on how you can get to feel the GNOME system in your chroot environment.

1. Copy your xorg.conf in the chrooted “etc/X11/” directory.

 

2. Create generic devices on your chroot system using MAKEDEV

 

3. Start X or restart gdm

 

Supposed you want to make modifications on the Desktop, that will be used by all the new users, just change your $HOME to /etc/skel/ and start gdm or X.

 

If you want to load all the other stuff GNOME needs (i.e, dbus, avahi, network-manager), just boot as (single-user mode), and start dbus in your chrooted environment.

 

An example of the whole procedure. (under single-user mode)

 

joelbryan


 

Hello,

I am about to build a new Livecd and have a question: When I change the username, hostname and the user’s password the user login automatically during booting the livesystem. But this is not desired. Is it correct, that I have to enter a password under a Desktop LiveCD when I delet the encrypted password in /usr/share/initramfs-tools/scripts/casper-bottom/10adduser ?

Thanks

Changing username and password will not change login behaviour, because this is done in /usr/share/initramfs-tools/scripts/casper-bottom/15autologin

Alexander Hosfeld


 

Having trouble starting a MySQL server from within the chroot jail. Any suggestions?

– Dave

Hey,

I am trying to make a customized live cd of Kubuntu 6.06 that will be completly preconfigured, so that when the user clicks on the install icon on KDE the installer should do everything by itself, meaning that the installer should not ask any questions to the user.

To do this I am trying to write a preseed file to tell the installer the information that it needs.

The problem is that even with this preseed file I could only tell the installer what is the username that it should use, the rest of the information is simply ignored by the installer.

I must be doing something wrong and would appreciate any and all help given me.

Thanks, Komyg

PS: Should I post my preseed file here?


If the livecd is not going to be used for the purposes of installing what files can be removed? Can the “pool” files containing the .debs be removed too?

– Mike


If I want to put in my LiveCD applications that aren’t in the sources.list (like ooffice 2.2 or perl audio converter), what cain I do?

– Isoldanne

When you’re in the chroot you can install applications just like you would on a live system. If you install from source you can feel free to delete the source tarbal and make folders after you do ‘make install’.

– Bob/Paul


 

To get desired /etc/X11/xorg.conf one can modify the /usr/bin/dexconf. This script generates xorg.conf automatically in liveCD session according to the booted machine.

For example:

 

— yotam


 

I cant do chroot. When i run it a get this error

chroot: cannot run command `/bin/bash’: No such file or directory

Please help me out

  • I had the same problem because the filesystem that I was working on was FAT32 instead of EXT2 or EXT3. Because of that, /bin/bash was not an executable I guess. If that is your case also, then please try again on a partition that is EXT2 or EXT3 (the Linux type of partition). Good luck, –vvim

Hi, I’ve created a simple script to ease remastering the Kubuntu Live CD. It uses aufs to avoid copying all the files back and forth.

Maybe it will be usefull to others too. The script must be run as root.

— Petr Pudlak


 

I need to know how to configure the live cd so that it does not use SWAP!

Please help me!

— iceman


Hi, I’ve been experiencing problems with aptitude and I’m pretty sure its because I’m doing all this stuff on NTFS partition (according to this thread http://ubuntuforums.org/showthread.php?t=521905). But I have no other choice,coz’ I’ve got less then 1,7GB on my ext3 partition. Any suggestion ? THX

Error messages I’ve been getting, when trying to install or update aptitude:

“E: Couldn’t make mmap of 25165824 bytes – mmap (19 No such device) W: Unable to munmap E: The package lists or status file could not be parsed or opened.”

-heethen (heethen at centrum dot cz)


I would suggest creating an ext3 filesystem within your NTFS partition. To create the file, type

dd if=/dev/zero of=/mnt/hda1/workspace.img bs=1024 count=$((1024*1024*15))

Where I assumed your NTFS partition was on hda1, and you wanted to call the new filesystem workspace.img (it’s really just a file within NTFS), and that you wanted 15Gb of room to work. (You don’t need that much, but with 15Gb you should have plenty of room.) Then you format the new filesystem with the command

sudo /sbin/mkfs.ext3 /mnt/hda1/workspace.img

then create a mountpoint

sudo mkdir /mnt/workspace

then mount the new filesystem

sudo mount -o loop /mnt/hda1/workspace.img /mnt/workspace

You can then use as much space on the NTFS partition as you want, and have all the benefits of ext3 (like getting the *** thing to work). –Tom


Editing gconf by setting each value separately takes too much time. There is a better way:

Make a test user and adjust the settings as you wish. Run

 

and then, in the chroot environment, run

 

This way you can import the whole branch, e.g. /apps/panel – all settings for Gnome’s panels.

—Jacob Popov ubuntu-9.04-desktop-i386.iso


 

Is there no way to copy the user’s gconf-values to the default gconf-values in the chrooted environment? This would be a lot easier than writing commands.


It took me a long time to find the details for configuring a static IP on the live CD without doing it in the root file system. This enables you to create a few boot options with different static details and a DHCP on but all from the same rootfs.

There is a casper parameter which is in the form:

ip=IFACE,ADDRESS,NETMASK,GATEWAY[:IFACE,ADDRESS,NETMASK,GATEWAY]*

–silid


 


http://ubuntuforums.org/showthread.php?t=839670

I think I have discovered how to do this:

1) Edit accordingly /usr/share/initramfs-tools/scripts/casper-bottom/23networking

2) Run update-initramfs -u -k $version

– Robert

In order to get the livecd to boot from a static address found in the /etc/network/interfaces file.

I edit the /etc/network/interfaces file and add a static address for the interface eth0.

edit somepath/isolinux/text.cfg add ip=frommedia after splash

This was a little hard to find. Thanks Robert Nicholas A. Schembi Pittsburgh PA USA


 

I’ve tried installing adobe flash player but while it installs fine on chroot, and then shows as installed when booting from CD. Firefox thinks it is not installed and I need to install it manually. Anybody come upon a similar problem


I tried to customize Ubuntu Hardy by installing the RT kernel and did the changes as written in the howto… it goes well, but booting in vbox is really slow. What could be the cause? I tried is once again and also in another vbox installation, but still that problem. Would be nice if someone can point me to an solution! thanks in advance see also thread: http://ubuntuforums.org/showthread.php?p=7334890#post7334890 edit: I think it has something to do with the fact that it is an RT kernel (from Hardy) … Someone with experience with adding custom RT kernels?


I wrote a script to automate the extraction / chroot / regeneration processes: http://david.decotigny.fr/wiki/wakka.php?wiki=RemasterUbuntu . It has been tested on a jaunty x86_64 host for a jaunty i386 CD image.

DavidDecotigny


To put the default user in the “video” group,

CarlKarsten


 

In order to edit a Karmic LiveCD in any release prior to Karmic, it looks like you will need to upgrade squashfs-tools to support SquashFS v4.0:

 

I installed squashfs-tools_4.0-1 from the Karmic release into my Intrepid installation and it seems to be fine now. Maybe we should update these directions to reflect that?

Sincerely,

–John D. Zollo


Hi.. How can I add an a Post Installation script? I mean, I want to execute a script just after the installation process. THis script is simple and set a few things to customize the installation.

Any ideas?

Best Regards

— Alejandro


 

Hallo, I’m trying to remaster ubuntu 9.10 livecd. I’m following instruction from this page. When I’m trying to boot from customized system it’s seems I can’t login to the system, so I can’t got the system running.

I am following instruction from limitation part about user id. And make sure there are none of users has uid more then 999. But, after making the squashfs file system I got a message that told me about a user with uid 1000. Actually my host system has a user with uid 1000. I’m using this user to remaster ubuntu livecd.

Does my uid (1000) that I used for remastering the livecd make the new live cd can’t login? If it does, how to fix it? Am I must use another user with uid less then 999 to remaster the livecd?

Best Regards

asw_te


Hello, what is the best way to remaster the Karmic release LiveCD (in VirtualBox) to include all the latest updates (more than 150) including new kernel and udev? The kernel changed from 2.6.31-14 to 2.6.31-16 and also udev.

apt-get autoremove removes the old headers, but I have to purge the old kernel manually (apt-get purge linux-image-2.6.31-14-generic).

The first problem is, update-initramfs -u -k all still runs for the old kernel, too. Only aptitude reinstall udev seems to stop this (depmod -a && dpkg --configure -a && dpkg-reconfigure udev does not help).

The second problem is, how do I prepare initrd and isolinux to run and install from a subdirectory (to create a multi-boot DVD)? The base of the DVD is Ubuntu, so / contains ubuntu-9.10-desktop-i386.iso, /kubuntu contains kubuntu-9.10-desktop-i386.iso and so on. Most things run fine when I introduce the prefix to scripts/casper and /isolinux/text.cfg:

becomes

But the prefixed distributions show only an Install Ubuntu 9.10 link on the desktop, not Kubuntu (Xubuntu, LUbuntu, …).

Thanks, René Leonhardt


 

Hi!

I was hoping to be able to remaster the Ubuntu Live disc so that I can stick it into almost any computer, have it boot up but NOT go into the GUI, just auto login and run a media player with arguements (like a stream address). Was hoping to be able to make my own easy internet radio appliance. Give old pentium computers with soundcards to businesses and they can play my station on their PA for free!

— Matt


 

I updated the Karmic Live CD with the latest updates inside chroot using aptitude with update, dist-upgrade, purge linux-image-2.6.31-14-generic, install zsh zsh-doc, install ubuntu-restricted-extras, and enabled DVD playback.

The resulting iso file turned out larger than a CD, and I put it on a USB Disk. The system boots fine, has the latest updates and can play restricted formats ‘out of the box’. When I travel, I can just carry a USB Disk instead of a computer!

All releases including Ubuntu 9.10 Karmic Koala now have newer kernels available via updates. The kernel in the live CD *MUST* match the ones inside squashfs. If it does not, you get strange problems (like the wireless interface not being detected or CDs not being recognized)

i.e. for Karmic

Since Karmic uses initrd.lz, I had to uncompress the .gz file and put it back in .lz format.

To conserve space, you can remove the original initrd files before changing the directory back

Best, Pradeep Sekar


I have a few questions, I am remastering a copy of 9.04 for a community school program i ran into a few problems

#1 how do you remove the option to update to 9.10 in the update manager #2 how do you get the CD to be recongnized in ubiquity installer as the named distro instead of ubuntu 9.04 (when i go to reinstall the softare still says it is a ubuntu 9.04 cd) #3how do you install a new kernel into the live cd and install part, i was able to upgrade it to 28.18 but when i try putting 31 on it …it just wont boot.

#4 i have a repos server, i edit the sources.list but ubuntu repos are still the primary, how do i change that over?

#5 finally, i took out gnome games, and i want to add a list of eduacational games, but i want that as a optional install. (some computers won have game son there) is there a way to add the /.Games folder without actaully having data in it? i tried doing this in the chroot adn root menu and it still does not show up on install…

Thank you

ashlessburn


 

Can anyone tell me how I can take out the option of installing the Live CD at boot. I just want them to be able to use it, not install.

Thanks

–Steve


You can edit the boot options in extract-cd/isolinux/text.cfg Delete all lines and sub-lines of a label you don’t like: For example you can delete:

— jancelis


To remove the autologin, you make us work in the extract-cd directory. Does this mean that this process has to be the last one ? Do we have to do it after all the modifications on the edit directory ? Do we have to first create the new user in the chroot ? thx –lsga


I’m having trouble properly adding a repository. How do you add one to a live cd? –Muscovy


 

Hi, I’m working on a unnattended install CD using Ubuntu Lucid 10.04, and I found that if you erase /sbin/initctl the automatic install doesn’t run. Also the instruction to generate the initctl using dpkg-divert is not working. So be careful…

Alejandro


 

I customize the live cd and install apache2 , webmin ,,, but how to make it start after the automatic-login ?

Gordon


I use a version of Ubuntu that does not automatically Start the graphical system (startx command) How can I add that to be run at boot?

RJ


 

I am currently working on a minor update given 10.10 is out. Unfortunately, I got held up and now time has run out. Mainly I wanted to make the scripts more copy/paste friendly. So I added a few env-variables and use those throughout the script. I’ve done the replacements already, but I didn’t get aroud to do some testing.

In the meantime, I’ll dump my current version into the above link to save my work.

exhuma


 

aptitude can’t purge packages.

The program ‘aptitude’ can be found in the following packages:

  • aptitude
  • aptitude-gtk (You will have to enable component called ‘universe’)

Try: apt-get install <selected package>


 

Unable to find a medium containing a live file system (SOLUTION)

When creating a live-usb with Unetbootin from Windows (Vista/7) you sometimes get this error. A friend of mine suggested another solution than all of the above. Create the USB stick with Unetbootin from a Linux (Ubuntu) box and NOT a windows system. Apparently something is different between the two because now my system just boots flawlessly!

SantanaNL


 

Regarding the “Unable to find a medium containing a live file system”–

I had this same problem when trying to install Ubuntu 10.04, 10.10, and 10.10 netbook edition on a netbook using a USB stick. I tried creating all three using 10.10’s boot disk creator, 11.04’s boot disk creator, Unetbootin on 11.04, and Unetbootin on Windows 7. In all cases, I was able to make it to the usb boot menu and would select ‘Install’. The Ubuntu logo would show that it was processing for a while and then fail with the above message in a terminal.

In the end, it wasn’t a problem with the iso or the created USB stick. The USB drive just wasn’t mounted (or would become unmounted after I tell it to go through the ‘Install’ procedure. Since I couldn’t figure out how to boot the usb from the provided terminal, I just tried removing and reinserting the USB drive once I saw the Ubuntu logo and the progress blips.

I was able to get past this problem twice, so far, with this solution.

bananax182


 

For all of you semi new maybe not quite as knowledgeable Ubuntu users, as myself, the live CD environment does not utilize all of the typical repositories that it would as if you installed it. You might need to add the particular repository of interest to install a program for your live CD.

For instance, I wanted to create a live CD with dcfldd on it. I had to edit etc/apt/sources.list within the chrooted environment to add the universe repository. I uncommented the following to lines in etc/apt/sources.list to install dcfldd:

Then just updated apt and installed as normal:

Sorry if everyone already knew this. I just figured it may be helpful to users like myself.

mrgrant


 

Hi Smile :) I’m sure people appreciate comments such as your MrGrant. Otherwise people might feel they are the only ones suffering from something or maybe feel they are to blame.

On a normal LiveCd there is an “installer” icon. DOes anyone know how i can get that icon onto a normal Ubuntu desktop? I have done a full install to a large usb-stick and installed things like “GPartEd” but i definitely miss havign that installer icon & functionality. Regards from Tom Smile :)


 

I am looking to update or see an update to this guide that addresses a custom launcher on unity. So the idea is once the desktop and unity have resolved to the scree, I can click on a custom launcher with out looking in dash to find it. This message should be replaced with this information, in case someone else beats me to the punch.

Chad


 

I am a total beginner. How do I take my current computer configuration and turn it into a install CD? Thanks!

Nick Smile :) (Sorry if my question sounds dumb)


 

Hi Nick 🙂
This link might help

but i would avoid it. It’s not dumb, just tricky.

Instead you can back-up all your settings, config files/folders and data by backing up the /home folder. You can move your /home to a new partition to separate your data (including configs and stuff) from the Operating System. That allows you to re-install the OS without messing anything up

It’s even possible to have 2 different Operating Systems sharing the same /home although it’s not recommended.

Better places to ask questions are

and Launchpad
Regards from
Tom Smile :)


 

I think this entry could be improved by adding some explanation of what we are trying to accomplish with these commands. Pretty much any time it says “you need to use” or “remember to” it would be great to know why. Just my two cents.

Mike

How to Install XFCE 4.10 on Ubuntu 13.04, 12.10, 12.04 and Linux Mint 15, 14, 13

In this article I will show you how to install XFCE 4.0 (Xubuntu desktop) on Ubuntu 13.04 Raring Ringtail, Ubuntu 12.10 Quantal Quetzal, Ubuntu 12.04 Precise Pangolin, Linux Mint 15 Olivia, Linux Mint 14 Nadia and Linux Mint Maya 13.

http://farm8.staticflickr.com/7236/7191011788_753b86481b_b.jpg

To install XFCE 4.0, do this:

Add the repo:

$ sudo add-apt-repository ppa:xubuntu-dev/xfce-4.10

Update the local repositories:

$ sudo apt-get update

Install XFCE:

$ sudo apt-get install xfce4

To remove XFCE, do this:

$ sudo apt-get install ppa-purge
$ sudo ppa-purge ppa:xubuntu-dev/xfce-4.10

One comment on “How to Install XFCE 4.10 on Ubuntu 13.04, 12.10, 12.04 and Linux Mint 15, 14, 13”

Resource : http://linuxg.net/how-to-install-xfce-4-10-on-ubuntu-13-04-12-10-12-04-and-linux-mint-15-14-13/

How to install Xfce on Ubuntu

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Ubuntu’s default desktop environment is Gnome. Sometimes people using Ubuntu want to try out Xfce as well, though.

Warning: having Xfce and Gnome together means you’ll have cluttered application menus full of Xfce applications and Gnome applications.

Even though these instructions are for Xfce, the same principle applies for adding Xfce to Kubuntu or adding KDE to Ubuntu or Xubuntu. Basically, you install the desktop environment, log out, and choose the desktop environment.


Go to the Ubuntu Software Center. In the filter (top-right) type xubuntu-desktop and then click Install next to Xubuntu desktop system. Enter your password when prompted.


If you’re using Ubuntu 11.04, you’ll have to click on Show __ technical items in order to get xubuntu-desktop to show up for installation.

Xfce will start downloading and installing. You can click In Progress if you want to see the percentage of the task that’s complete.

Note: this will take significantly longer than other software packages to install, because this actually brings in a lot of packages, not just one. The Xubuntu Desktop system is what is called a metapackage, which means it’s an empty package, which is just a pointer to a whole group of other packages.


After Xfce finishes installing, log out.

Then, before you log back in again, select Xubuntu session (instead of Gnome, which is Ubuntu’s default desktop environment).


Xubuntu will load up. Xubuntu is basically Ubuntu’s implementation of Xfce, with the appropriate Ubuntu-specific artwork and defaults.


If, instead, you want the default Xfce desktop without the Ubuntu-specific artwork, you can choose. Xfce instead of Xubuntu at the login screen.

If you decide you want to remove Xfce, it’s not enough to go to Ubuntu Software Center and remove the Xubuntu Desktop system package, as that is just an empty package that points to all the software packages that make up a default Xubuntu installation. Removing the pointer package won’t remove all the packages it points to.

If you want to remove Xfce, follow these instructions.

Resource : http://www.psychocats.net/ubuntu/xfce