Linux (ubuntu) Josei

Customized part

linux loader isolinu installation files and other related information, the root file system image (the Ramdisk), kernel image, the root file system composed of four parts. The installation process is controlled by the loader installed until after the completion of transfer to the root file system mount.

 

First, the file system production process

XXXXX root file system is based on Ubuntu modify finished, so the root file system format is still squashfs. Specific production process is as follows:

1, download the corresponding version iso image (here ubuntu-10.04.3-desktop-i386.iso), and confirms whether the root file system is mounted Solutions compression and packaging tools, the command is not installed:

       (sudo) aptitude install squashfs-tools genisoimage

 

2, extract and extract the root file system. details as follows:

1) Set the directory

mkdir ~/live

mv ubuntu-10.04.3-desktop-i386.iso ~/live

cd ~/live

2) Mount livecd

mkdir mnt

(sudo) mount -o loop ubuntu-10.04.3-desktop-i386.iso mnt

3) extract the files to extract-cd directory

mkdir extract-cd

rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd

4) extract and extract the squashfs file system

(sudo) unsquashfs mnt/casper/filesystem.squashfs

(sudo) mv squashfs-root edit

 

3, and prepare the virtual root directory. If you are using the virtual network connection in the root environment, it is necessary to set the following information:

(sudo) cp /etc/resolv.conf edit/etc/

You may need to copy the hosts file

(sudo) cp /etc/hosts edit/etc/

1) Mount Related Category:

(sudo) mount --bind /dev/ edit/dev

(sudo) chroot edit

(sudo) mount -t proc none /proc

(sudo) mount -t sysfs none /sys

(sudo) mount -t devpts none /dev/pts

(Note: delete edit here mounted directory should be preceded by unloading)

2) To avoid the problem areas and introducing GPG keys:

(sudo) export HOME=/root

(sudo) export LC_ALL=C

3) configuration software source chroot environment. Need to run before you install and upgrade the system:

(Sudo) dbus uuidgen> / var / lib / DBU / machine ID

(sudo) dpkg-divert --local --rename --add /sbin/initctl

(sudo) ln -s /bin/true /sbin/initctl

 

5, custom packages. View installed packages:

(sudo) dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less

 

1) uninstall an unwanted package

aptitude purge package_name(apt-get auntoremove –-purge package_name亦可)

 

2) update the software list

apt-get update

 

3) comes uninstall other components

apt-get autoremove –purge \

ubuntu-docs \

ubuntuone-client \

ubuntuone-client-gnome \

python-ubuntuone \

python-ubuntuone-client \

python-ubuntuone-storageprotocol \

rhythmbox-ubuntuone-music-store       \

libubuntuone-1.0-1 \

checkbox \

update-manager \

ubufox

 

4) Uninstall own game

apt-get remove gnome-games gnome-games-common

 

5) uninstall language packs in addition to English

 

apt-get remove language-pack-bn language-pack-de language-pack-es language-pack-fr language-pack-gnome-bn language-pack-gnome-de language-pack-gnome-es language-pack-gnome-fr language-pack-gnome-pt language-pack-gnome-xh language-pack-pt language-pack-xh

 

6) update system, comprising a core (according to the need)

(Note: If you upgrade the kernel, to ensure that the vmlinuz-2.6.31-19-generic in / boot and initrd.img-2.6.31-19-generic update to the / home / yeelen / live / extract-cd / casper vmlinuz and initrd.lz directory.)

 

apt-get dist-upgrade

aptitude purge linux-image-2.6.31-14-generic

 

7) environment and install Chinese Pinyin input method ibus

apt-get install ibus-pinyin ibus-table-wubi language-support-input-zh-hans language-pack-zh-hans language-pack-gnome-zh-hans language-pack-gnome-zh-hans-base language-pack-zh-hans-base

 

8) to install openoffice common language pack (Chinese is currently installed)

apt-get install openoffice.org-l10n-zh-cn openoffice.org-l10n-common openoffice.org-help-zh-cn openoffice.org-l10n-en-gb openoffice.org-help-en-gb openoffice.org-l10n-en-za

 

9) install additional software (installation required)

apt-get install gnome-app-install

aptitude install gthumb exaile

aptitude install ubuntu-restricted-extras

aptitude install smplayer

aptitude install audacious gftp gwget chmsee compizconfig-settings-manager

apt-get install nautilus-open-terminal nautilus-gksu

 

10) Modify Firefox startup pages, as follows:

cd / usr / lib / firefox - * (version number) / defaults / profile

gedit user.js

Entry

user_pref ( "browser.startup.homepage", "http://www.XXXX.cn"); (the URL is provided as needed)

Save out.

 

6, gnome custom background image

1) Copy the png files to / usr / share / backgrounds /

(Executed outside chroot) (sudo) cp * .png edit / usr / share / backgrounds /

 

2) edit the following two files, specify a new png file:

vi /usr/share/gnome-background-properties/ubuntu-wallpapers.xml (to modify the background member)

vi / usr / share / gconf / defaults / 16_ubuntu-wallpapers (modify the default background)

 

3) set the start of the default background. Modify / usr / share / gconf / defaults / 16_ubuntu-artwork

 

7, install the control, icons, fonts, and custom themes (here just to install, no modifications)

1) install the font. details as follows:

mkdir ~ / live / edit // usr / share / fonts / truetype / msyh / * create the font storage directory * /

(Executed outside chroot) (sudo) cp ~ / live / temp / *. Ttf ~ / live / edit / usr / share / fonts / truetype / msyh /

/ * Copy Microsoft elegant black font to a specified directory * /

 

2) install the theme. To gnome-look control file to download themes, such as Lilium.tar.gz:

(Executed outside chroot) (sudo) tar zxvf ~ / live / temp / Lilium.tar.gz -C ~ / live / temp / / * extract the theme pack, and place the temporary directory * /

(Executed outside chroot) (sudo) mv -t ~ / live / edit / usr / share / themes / ~ / live / temp / Lilium / * the unpacked theme package to the specified directory * /

 

3) Install icon. Download icon files, such as Simple.tar.bz2:

(Executed outside the chroot) (sudo) tar -xjf ~ / live / temp / Simple-2.2.5.tar.bz2 -C ~ / live / temp / / * extract the icon file and place them into a temporary directory * /

(Executed outside chroot) (sudo) mv -t ~ / live / edit / usr / share / icons / ~ / live / temp / Simple / * icon unpacked mounted to the specified directory * /

 

4) Copy the file to theme package index.theme theme after installation, setting association:

(Performed outside chroot) sudo cp ~ / live / temp / index.theme ~ / live / edit / usr / share / themes / Lilium /

After depending on the content needs to be modified, after reading the document to understand, does not dwell on this.

Change Copy theme icons to the / usr / share / icons, copy the Theme Manager to / usr / share / themes / for the name of the original file, change the name of the original file to another name, and then compare: Details index.theme file under the original file to change the current settings file in the file, replacing the default file is Amblance

Gconf change the value of defaults in 16-Ubuntu-artwork in win7-icons is amblance

 

8, change the gconf values.

Any changes to the settings gconf must add the appropriate value in /etc/gconf/gconf.xml.defaults/%gconf-tree.xml file. Adding a value in this file will change the default settings for GNOME or other programs, so you can change the font, back, theme, pointers, and so on. Use the following gconftool-2 modified the default settings, but I can not in practice, you can try to change it. Later, I was directly modify the / usr / share / gconf / defaults directories, such as the panel settings saved in 05_panel-default-setup.entries, other values ​​can be modified in the appropriate file, and is similar to the following method.

Chroot environment, the software may be replaced with other editing gedit gconftool-2:

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set yourkey "yourvalue"

Here's string, yourkey and yourvalue are the type you want to change, and the primary key value.

 

Set each value takes too much time by editing the gconf respectively, and convenient way:

1) in accordance with your wishes for the user to test and adjust the settings, execute:

gconftool-2 --dump /the/settings/branch/you/need > ~/live/your-new-settings.xml

(sudo) chown root:root ~/live/your-new-settings.xml

(sudo) mv ~/live/your-new-settings.xml ~/live/edit/your-new-settings.xml

 Go to the next step debugging modifications.

 

2) Then, in a chroot environment, execute:

 

gconftool-2 --direct --config-source xml: readwrite: /etc/gconf/gconf.xml.defaults --load /your-new-settings.xml / * load the configuration file * /

rm /your-new-settings.xml

This way you can import entire branch, for example, / apps / panel provided all panels.

 

3) application font settings:

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/font_name "Microsoft YaHei 9"

 

4) Desktop font

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/nautilus/preferences/desktop_font "Microsoft YaHei Bold 10"

 

5) window title bar

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/metacity/general/titlebar_font "Microsoft YaHei Bold 10"

 

6) Close minimize effects

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/metacity/general/reduced_resources true

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /desktop/gnome/interface/accessibility true

 

7) the default theme, icons set

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/gtk_theme "Lilium"  /* 设置主题 */

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/interface/icon_theme "Simple"  /* 设置图标 */

 

8) to display the menu icon

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /desktop/gnome/interface/buttons_have_icons true

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /desktop/gnome/interface/menus_have_icons true

 

9) display a desktop computer, a home directory, Recycle Bin, My Network Places

gconftool-2 --direct --config-source xml: readwrite: /etc/gconf/gconf.xml.defaults --type bool --set / apps / nautilus / desktop / computer_icon_visible true / * Display Computer (My Computer) * /

gconftool-2 --direct --config-source xml: readwrite: /etc/gconf/gconf.xml.defaults --type bool --set / apps / nautilus / desktop / home_icon_visible true / * display home directory (My Documents ) * /

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/nautilus/desktop/trash_icon_visible true     /* 显示回收站 */

gconftool-2 --direct --config-source xml: readwrite: /etc/gconf/gconf.xml.defaults --type bool --set / apps / nautilus / desktop / network_icon_visible true / * display network server (Network Neighborhood) * /

 

10) The default workspace 4, may be modified to correspond to the value (1,2,4)

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type int --set /apps/metacity/general/num-workspaces 4

11) to be turned off automatic update prompt

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/update-notifier/auto_launch false

rm /etc/xdg/autostart/update-notifier.desktop

12) set the title bar buttons. Ubuntu default title bar buttons (maximize, minimize, close) is on the left, Windows is on the right, you can set its placement format, as follows:

Left button: on the right button

To change Windows is as follows:

menu:minimize,maximize,close

90_light_themes stored under / usr / gconf / defaults / and theme of the installation package (set a theme button style). A ":" as the boundary, the left is placed on the left of the window buttons on the right are placed in the right window.

 

9, change the default language of gfxboot

1) recompile gfxboot

cd ~/live/

mkdir src

cd src

sudo aptitude install dpkg-dev uck

sudo apt-get source gfxboot-theme-ubuntu gfxboot

cd gfxboot-theme-ubuntu*/po

sudo gedit zh_CN.po

 

2) make the appropriate changes, save and exit

(sudo) make

cd ..

(sudo) make DEFAULT_LANG=zh_CN

(sudo) rm -rf ~/live/extract-cd/isolinux/*

(sudo) cp -af boot/* ~/live/extract-cd/isolinux/

 

3) Modify logo livecd boot interface. Modify /home/yeelen/live/extract-cd/isolinux/splash.pcx files.

Of course, there is another easy way to change the default language gfxboot without reconstruction package: lang create a name for the file to load your native language name, as in the isolinux directory:

(Executed outside chroot) (sudo) vi ~ / live / extract-cd / isolinux / lang

After the input you want to make Chinese zh_CN (other corresponding values) to save and exit.

 

10, to ensure that UID is not greater than 999, I seem not in the actual implementation.

awk -F: '$3 > 999' /etc/passwd

usermod -u 500 nobody

 

11, the default Miscellaneous

You may want to change the default startup behavior of the system by editing / etc default file /. You can also edit /etc/profile,/etc/bash.bashrc, and / etc / bash_completion to change the system registry settings for all users. You can not directly edit the default user livecd, such as casper, ubuntu, or user, because the account is created when the system starts. You can edit the file in the user's default root (/ root in the chroot environment), such as changing time zones:

dpkg-reconfigure tzdata

If you want to add a new location and set as the default location, update the / etc / default / locale. You may need to edit the location:

locale-gen new_locale

update-locale LANG=new_locale LANGUAGE=new_locale LC_ALL=new_locale

(Note: These changes must be executed in a chroot environment as root.)

12, the installation interface customization

Modify ubiquity-slideshow, to show the installation process described in Chinese (modified according to actual needs):

cp -af /usr/share/ubiquity-slideshow/slides/loc.zh_CN/* /usr/share/ubiquity-slideshow/slides/

rm -rf loc. * / * here * Introduction to retain only Chinese /

Modify the page file contents to suit your own customized version.

 

13, the test function (can not guarantee that there is no problem)

1) modify the gdm themes and wallpapers

gksudo -u gdm dbus-launch gnome-appearance-properties

Modify themes and background images, background to be consistent with the xsplash.

 

2) modify xsplash background

(Executed outside chroot) (sudo) cp ~ / live / temp / bg_2560x1600.jpg ~ / live / edit / usr / share / images /

xsplash /

 

3) Modify grub background

Then take the picture rename moreblue-orbit-grub.tga, resolution at 800x600, save to ~ / live / temp / then executed outside the chroot:

(sudo) cp ~/live/temp/moreblue-orbit-grub.tga ~/live/edit/usr/share/images/desktop-base/

If you want to support jpg and png format images, modify the configuration file in accordance with the following method:

we /etc/grub.d/00_header

cat << EOF

if [ -s /boot/grub/grubenv ]; then

have_grubenv=true

load_env

be

set default="${GRUB_DEFAULT}"

if [ \${prev_saved_entry} ]; then

saved_entry=\${prev_saved_entry}

save_env saved_entry

prev_saved_entry=save_env prev_saved_entry

be

insmod jpeg / * Added support for JPG file * /

insmod png / * Added support for PNG files * /

EOF

cat << EOF

if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then

set gfxmode = 1024 * 768 / * set GRUB resolution, according to their own situation set * /

insmod gfxterm

insmod ${GRUB_VIDEO_BACKEND}

if terminal_output gfxterm ; then true ; else

# For backward compatibility with versions of terminal.mod that don't

# understand terminal_output

terminal gfxterm

be

be

EOF

we /etc/grub.d/05_debian_theme

use_bg=false

if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] ; then

for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga,jpg}; do / * format identification, increase JPG * /

if is_path_readable_by_grub $i ; then

bg=$i

case ${bg} in

*.png)        reader=png ;;

*.tga)        reader=tga ;;

*.jpg|*.jpeg)    reader=jpeg ;;

esac

if test -e /boot/grub/${reader}.mod ; then

echo "Found Debian background: `basename ${bg}`" >&2

use_bg=true

break;

             be

be

done

be

cat << EOF

insmod ${reader}

if background_image `make_system_path_relative_to_its_root ${bg}` ; then

       set color_normal = white / black / * Set the font color (color and character color note picture) * /

set color_highlight = blue / black / * set the font color * /

else

EOF

be

After running:

update-grub

 

15, updating the kernel (as needed)

1) livecd kernel updates (if you update the kernel in the previous step, so be sure to do the following)

(Executed outside chroot) (sudo) rm /home/yeelen/live/extract-cd/casper/initrd.lz

(Executed outside chroot) (sudo) rm / home / yeelen / live / extract-cd / casper / vmlinuz

(Executed outside chroot) (sudo) cp ~ / live / edit / boot / vmlinuz-2.6.31-19-generic ~ / live / extract-cd /

casper/

(Executed outside chroot) (sudo) mv ~ / live / extract-cd / casper / vmlinuz-2.6.31-19-generic ~ / live /

extract-cd/casper/vmlinuz

(Executed outside chroot) (sudo) cp ~ / live / edit / boot / initrd.img-2.6.31-19-generic ~ / 

cd ~/

(Performed outside chroot) sudo mv ~ / initrd.img-2.6.31-19-generic initrd.gz

 

2) unzip gz file format and then compressed into lz:

(Executed outside chroot) (sudo) gzip -dc initrd.gz | sudo lzma -7> initrd.lz

(Executed outside chroot) (sudo) mv initrd.lz ~ / live / extract-cd / casper /

(Executed outside chroot) (sudo) rm -rf initrd.gz

 

16, Exit chroot. details as follows:

1) clean up the aptitude cache:

apt-get autoremove

apt-get autoclean

aptitude clean

 

2) Delete temporary files and nameserver settings:

rm -rf /tmp/* ~/.bash_history

rm /etc/resolv.conf

 

3) If the software is installed, it should be performed in the chroot

rm / var / lib / dbus / machine ID

rm /sbin/initctl

dpkg-divert --rename --remove /sbin/initctl

 

4) umount had mounted directory:

umount /proc

umount /sys

umount /dev/pts

 

5) Exit chroot:

exit

(Note: here Exiting the chroot, the following instructions are actually executed outside chroot.)

(sudo) umount edit/dev

(Note: If you can not execute umount / proc, you can try umount -lf / proc)

 

17, making the root file system, as follows:

1) to regenerate the manifest file and manifest-desktop:

rm extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop

(sudo) chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest

sudo cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop

sudo sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop

sudo sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop

     generating a manifest-desktop manifest also another embodiment in accordance with:

     (sudo) chroot chroot dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee image/casper/filesystem.manifest

(sudo) cp -v image/casper/filesystem.manifest image/casper/filesystem.manifest-desktop

REMOVE='ubiquity ubiquity-frontend-gtk ubiquity-frontend-kde casper lupin-casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'  (要删除的包名)

for i in $REMOVE

do

        (sudo) sed -i "/${i}/d" image/casper/filesystem.manifest-desktop

done

 

2) compressed file system:

(Sudo) rm extract-cd / casper / filesystem.squashfs / * must first remove the old file system * /

(sudo) mksquashfs edit extract-cd/casper/filesystem.squashfs

 

3) Add the name mirrored extract-cd / README.diskdefines in

(sudo) vi extract-cd/README.diskdefines

 

4) delete the old file and calculate the new md5sum.txt md5 code

cd extract-cd

(sudo) rm md5sum.txt

find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt

 

5) Creating ISO

(sudo) mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /mnt/sda5/Temporary/yeelen_ubuntu-desktop-i386.iso .

 

18, test CD

Or the virtual machine using vmware virtualbox test (according to their own specific conditions to select the appropriate test tools). There will be some difficult problems in the virtual run after changing the livecd system kernel. If you encounter, then press the F6 key during startup interface. Moving the cursor to the lead splash quite and - between and type: all_generic_ide

 

19, burn CD

cdrecord dev=/dev/cdrom yeelen_ubuntu-9.10-desktop-i386.iso

Of course, you can use the burn tool to burn the image.

 

20 Notes

1) official tutorial compressed root file system and make iso image a little problem, a method to this article.

Official Tutorial: https: //help.ubuntu.com/community/LiveCDCustomization.

2) uname problems. The uname output information have included information Ubuntu (kernel version), the solution is simple: first / bin / uname named /bin/.uname, write a / bin / uname later, reads as follows:

#!/bin/bash

 

#***************************

# shell script of uname

#***************************

 

.uname $@ | sed "s/Ubuntu/xxxx/g"

 

exit

     In fact, the output of Ubuntu changed to xxxx, after the output can be.

 

Guess you like

Origin www.cnblogs.com/52why/p/12362844.html