Brief talk about the DIY release version of Ubuntu

Source: Internet
Author: User
Tags mkdir linux

21st century came, everyone stressed their personality, so a kind of things called DIY quietly rise.

Operating system as the crystallization of the wisdom of all mankind, natural DIY up to a great degree of difficulty, so DIY an operating system to achieve a sense of achievement is definitely more than the achievement of the Ikea thing.

To avoid writing an operating system from scratch, we certainly use off-the-shelf operating systems as a bottom line.

Of course, we can through LFS let us enjoy the end, but, can do lfs people are really rare. And more importantly, LFS is simply challenging my endurance.

My article teaches you how to DIY an Ubuntu release. In a very time-saving situation, to achieve the goal of cool.

Just like LFS, we need a creative base. We first set up a variable. The benefit of creating this variable is obvious, even if you don't have to ~/diy_ubuntu this directory, you can follow this article.

$ Export Work=~/diy_ubuntu

$ mkdir-p $WORK

Then we hang the CD-ROM image file to/mnt.

$ sudo mount-t iso9660-o loop dapper-live-i386.iso/mnt

$ CD $WORK

Copy file CD file

$ mkdir UBUNTU-LIVECD

$ cp-a/mnt/. Ubuntu-livecd

$ chmod-r u+w UBUNTU-LIVECD

$ sudo umount/mnt

Since the CD contains a lot of free software under Windows, let's delete unnecessary files. Of course you can keep it.

$ RM-RF $WORK/ubuntu-livecd/programs

Hang up the compressed file in the CD, and in this way you can see a full Linux operating system directory in the $work/old directory.

$ mkdir $WORK/old

$ sudo mount-t squashfs-o loop,ro $WORK/UBUNTU-LIVECD/CASPER/FILESYSTEM.SQUASHFS $WORK/old

We set up a file system of 2GB size and then formatted the file as a device file, and the result system gives a warning, ignore it, and choose Yes.

$ sudo dd if=/dev/zero of= $WORK/ubuntu-fs.ext2 bs=1m count=2147

$ sudo mke2fs $WORK/ubuntu-fs.ext2

Then we hang up the empty file system.

$ mkdir $WORK/new

$ sudo mount-o loop $WORK/ubuntu-fs.ext2 $WORK/new

Copy the files for the Linux operating system. We unpacked it because the Linux we got in advance was compressed.

$ sudo cp-a $WORK/old/. $WORK/new

Of course, the $work/old is useless now. Waste it.

$ sudo umount $WORK/old

We're going to start with the operating system we just got.

$ sudo cp/etc/resolv.conf $WORK/new/etc/

$ sudo mount-t proc-o bind/proc $WORK/new/proc

$ sudo chroot $WORK/new/bin/bash

Now you're in the system, shouting Linux for human beings, refining Ubuntu, doing whatever you want.

# vi/etc/apt/sources.list #选择适合你的源

# Apt-get Update

# Apt-get Dist-upgrade

# Apt-get Install the software you want to install

# Apt-get Clean

. #更多的配置

And finally leave your operating system.

# exit

$ sudo umount $WORK/new/proc

$ sudo rm $WORK/new/etc/resolv.conf

Now that you're back in your initial state,

and manifest the whole place over again.

$ sudo chroot $WORK/new dpkg-query-w--showformat= ' ${package} ${version} ' > $WORK/ubuntu-livecd/casper/ Filesystem.manifest

And do "Disk Cleanup."

$ sudo dd if=/dev/zero of= $WORK/new/dummyfile

$ sudo rm $WORK/new/dummyfile

Re-compress the system

$ sudo rm $WORK/UBUNTU-LIVECD/CASPER/FILESYSTEM.SQUASHFS

$ cd $WORK/new

$ sudo mksquashfs. $WORK/UBUNTU-LIVECD/CASPER/FILESYSTEM.SQUASHFS

Your changes have been saved. Now, get rid of $work/new.

$ CD $WORK

$ sudo umount $WORK/new

Recalculate the MD5 of the file.

$ cd $WORK/UBUNTU-LIVECD

$ sudo find. -type f-print0 |xargs-0 md5sum |sudo Tee md5sum.txt

Set up a disc image, the command is very long, bear the point.

$ CD $WORK

$ sudo mkisofs-o ubuntu-new.iso-b isolinux/isolinux.bin-c isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info- Table-r-V "My Cool Ubuntu Live CD"-cache-inodes-j-L UBUNTU-LIVECD

And then you can use ISO to burn the disc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.