To avoid writing an operating system from the beginning, we certainly adopt a ready-made operating system as the bottom line. Of course, we can use LFS to make us feel better, but it is rare for people who can implement LFS. What's more, LFS is simply challenging my patience. Like LFS, we need a creation base. First, create a variable. The benefit of creating this variable is obvious, even if you don't need it ~ /Diy_Ubuntu directory, you can follow this article to continue.
To avoid writing an operating system from the beginning, we certainly adopt a ready-made operating system as the bottom line.
Of course, we can use LFS to make us feel better, but it is rare for people who can implement LFS. What's more, LFS is simply challenging my patience.
Like LFS, we need a creation base. First, create a variable. The benefit of creating this variable is obvious, even if you don't need it ~ /Diy_Ubuntu directory, you can follow this article to continue.
$ Export WORK = ~ /Diy_ubuntu
$ Mkdir-p $ WORK
Then we mounted the CD image file to/mnt.
$ Sudo mount-t iso9660-o loop dapper-live-i386.iso/mnt
$ Cd $ WORK
Copy a file and a CD File
$ Mkdir ubuntu-livecd
$ Cp-a/mnt/. ubuntu-livecd
$ Chmod-R u + w ubuntu-livecd
$ Sudo umount/mnt
Because the CD contains a lot of free software under windows, we can delete unnecessary files. Of course you can keep it.
$ Rm-rf $ WORK/ubuntu-livecd/programs
After mounting the compressed files on the CD, you can see a complete 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 created a 2 GB file system and formatted the file as a device file. As a result, the system gave a warning. Ignore it and choose yes.
$ Sudo dd if =/dev/zero of = $ WORK/ubuntu-fs.ext2 bs = 1 M count = 2147
$ Sudo mke2fs $ WORK/ubuntu-fs.ext2.
Then we mount the empty file system.
$ Mkdir $ WORK/new
$ Sudo mount-o loop $ working/ubuntu-fs.ext2 $ WORK/new
Copy the file of the linux operating system. Because the linux File we obtained in advance is compressed, We decompress it.
$ Sudo cp-a $ WORK/old/. $ WORK/new
Of course, $ WORK/old is useless now. Discard it
$ Sudo umount $ WORK/old
First, go to the operating system we just obtained.
$ 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 are in the system, super DIY-ubuntu, and what you want to do.
# Vi/etc/apt/sources. list # select the appropriate source
# Apt-get update
# Apt-get dist-upgrade
# Apt-get install the software you want to install
# Apt-get clean
...... # More configurations