Remastersys Guide - Create Your Own Ubuntu-based Distro

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

NOTE: Beware of copying and pasting commands with < > brackets as it completely depends on your individual setup.

REMASTERSYS RESOURCES
+ IMPORTANT resources & files:
  • Remastersys Home
  • Remastersys Forum Home
  • Remastersys Wiki
  • Capink's in-depth explanation of Fragadelic's Remastersys script
  • Or if you're a scripter, examine /usr/bin/remastersys. I tried adding the -noI -noD -noF switches inside the script so that squashfs would be uncompressed, but the boot and install take nearly 40% longer on machines with only 512MB of ram. That, in addition to wasted disk space and possibly bandwidth, means you should prolly just avoid making that same change.
  • And when you edit /etc/remastersys.conf, DO NOT change the LIVEUSER variable to "user" or "gdm".
  • Add one of these repositories, depending on your distro:
Quote:
# Remastersys Debian
deb http://www.geekconnection.org/remastersys/repository debian/

# Remastersys Ubuntu (For Gutsy & Earlier - version 2.0.11-1)
deb http://www.geekconnection.org/remastersys/repository remastersys/

# Remastersys Ubuntu (For Hardy, Intrepid, & Jaunty - version 2.0.12-1)
deb http://www.geekconnection.org/remastersys/repository ubuntu/

# Remastersys Ubuntu (For Karmic & Newer w/ grub2 support - version 2.0.13-1)
deb http://www.geekconnection.org/remastersys/repository karmic/
REMASTERSYS NOTES
  • The only real difference between backup and dist modes is that backup mode copies the /home directory to the CD/DVD. Dist mode auto-logins to the desktop with the LIVEUSER you create, whereas backup mode stops at GDM, waiting for a specific user on your current machine to login and eventually find their normal desktop on the CD/DVD and the installed system.
  • Either way, the compressed filesystem will need to be 4GB or less. No buts about it, unless of course, you're a genius with ample time on your hands. That also means backup mode will need to include your /home folder in that 4 GB iso.
  • Run aptitude clean to get rid of unnecessary .debs.
  • When you run remastersys dist, you create your dist CDFS, which is eventually converted into your dist ISO. If you only need to edit one file, such as menu.lst so you can change Grub's timeout... just go to the CDFS chroot ( /home/remastersys/ISOTMP/ ) and you'll see the filesystem layout of your dist CD. In this example, edit /home/remastersys/ISOTMP/boot/grub/menu.lst and then you'll be ready to run remastersys dist iso since there's no reason to run the regular dist command and completely re-create the CDFS.
  • If you've already run remastersys, and you need to make drastic changes, make sure to run remastersys clean before remastersys dist.
  • When you're ready to test the .iso out, use a virtual machine like VMware, VirtualBox, or QEMU... so you don't have to waste any CDs or time burning the CDs.
  • And just FAIR WARNING: I would highly consider avoiding Intrepid & Jaunty if you're planning on many, many people using this, particularly machines with Intel-based graphics... as I've found two Intel machines that display a cruddy Xorg immediately after only upgrading default Ubuntu packages (NOT installing anything extra yet)... but I do like most of the software better in Intrepid. Jaunty is definitely still too new right now. Debian Lenny might be best for a larger, supported distro as it is now officially stable.

DISTRO PREP
  • Upgrade and install all your packages. Google Desktop might be a possible addition to your dist.
  • Remove all unnecessary packages. Here is a nice guide with an example of what I've chosen to remove from my system:
aptitude purge ubuntu-desktop ttf-arabeyes ttf-arphic-uming ttf-indic-fonts-core ttf-kochi-gothic ttf-kochi-mincho ttf-lao ttf-malayalam-fonts ttf-thai-tlwg ttf-unfonts-core language-support-en language-support-translations-en language-support-writing-en myspell-en-za openoffice.org-thesaurus-en-au openoffice.org-l10n-en-za openoffice.org-l10n-en-gb openoffice.org-help-en-gb scim scim-bridge-agent scim-bridge-client-gtk scim-gtk2-immodule scim-modules-socket libscim8c2a libchewing3 brltty brltty-x11 gnome-app-install ubufox apturl tracker tracker-search-tool libdeskbar-tracker libtracker-gtk0 deskbar-applet fast-user-switch-applet tomboy
  • Move all backgrounds to /usr/share/backgrounds/
  • Move all GDM themes to /usr/share/gdm/themes/
  • Move all other themes to /usr/share/themes/
  • Move all icons & cursors to /usr/share/icons/
  • Likewise, move all usplash themes somewhere in /usr/share/, or splashy themes to /etc/splashy/themes/
  • Make your graphical changes (GNOME, KDE, etc.). I use GNOME, and I like to move my volume applet to the top right for easy wheel scrolling of volume. Everybody I know that uses Ubuntu says that's their favorite part about the way I configure it for them. I add the weather applet to the left of the volume applet, and then I add the system monitor applet somewhere on the top panel and enable the memory, networking, swap, & hard disk graphs. I lock the applets and panels. It's best to organize these applets thru the gconf-editor. Then, I right-click the applications menu to edit it and do a little trimming. I use the GNOME Keyboard app to make the CapsLock an extra Ctrl key. I also edit the GNOME "Sessions" and "Services" apps to trim them down to something I find more reasonable (i.e. - no bluetooth, no automatic upgrade manager, & no "user folders update", among other things). Then I use sysv-rc-conf to trim some more. If you want to use Compiz Fusion, it's prolly best to install fusion-icon and switch to metacity right before copying your config files to /etc/skel/. I make sure Nautilus, Firefox [extensions], and other programs are setup the way I like...

COPY WORTHY CONFIG FOLDERS TO SYSTEM WIDE FOLDERS
  • Don't copy .xchat/ as it saves your username in the config.
  • Don't copy .wine/ as it is very problematic, try using the global wine folder, which is (??).
  • Clear all Firefox cache and GNOME Recent Documents cache right before doing this.
  • Clearly, you must be a superuser to do this, so don't forget about sudo. Now might be a good time to use sudo's -s switch so you don't need to type sudo before all these commands:
sudo -s
cp -Rf .config/ .fontconfig/ .gconf/ .gconfd/ .gnome2/ .mozilla/ .nautilus/ /etc/skel/
cp -Rf .config/ .fontconfig/ .gconf/ .gconfd/ .gnome2/ .mozilla/ .nautilus/ /root/
cd /etc/skel
chown -R root:root .config/ .fontconfig/ .gconf/ .gconfd/ .gnome2/ .mozilla/ .nautilus/
cd /root
chown -R root:root .config/ .fontconfig/ .gconf/ .gconfd/ .gnome2/ .mozilla/ .nautilus/


GDM
  • Use GNOME "Login Window" app to select your new theme and login background colors.
  • Remember the HEX values for the color, as you'll need them later.
  • Search for the terms GraphicalTheme & GtkTheme in these two files and you'll see 4 variables you need to change your GDM theme, GtkTheme, and 2 background color for pre- and post-login. Should be near lines 504, 347, & 466.
sudo <EDITOR> /etc/gdm/gdm.conf
sudo <EDITOR> /etc/gdm.conf-custom


BOOT SPLASH
  • Only way I know of to customize Usplash is to use the Startup Manager program.
  • Using most Usplash themes was buggy for me on recent versions of Ubuntu.
  • As long as the theme works on your computer, it should work on both the dist cd & dist install.
  • Splashy is an easy alternative to Ubuntu's default Usplash.
  • Splashy allows you to create boot, shutdown, suspend, resume, & error images of your choice with a progress bar. Just make sure to use PNGs otherwise you'll get an Error -3.
  • Simply this command to create splashy themes:
splashy -c

BOOT LOADER
  • This is only for the CD, it will not copy to the dist install as ubiquity & update-grub create a custom Grub config for the new system during install.
  • If you want to alter the installed Grub, update-grub must be altered, then the package must be flagged to never upgrade.
  • You could also choose ISOLINUX if GRUB doesn't work on some extremely rare chipsets.
  • EDIT the Grub config files in /etc/remastersys/grub/:
sudo <EDITOR> menu.lst.gutsyandbefore -OR-  menu.lst.hardyandlater
  • CREATE Grub background & move to proper folder:
convert infile.jpg -resize 640x480 -colors 14 -depth 8 splash.xpm.gz
mv splash.xpm.gz /etc/remastersys/grub/
  • If you plan on editing the update-grub script to reflect your changes on the installed system, you can move your splash image to the shared folder:
mv splash.xpm.gz /usr/share/grub-installer/splash.xpm.gz

PRESEEDING
  • Preseeding allows you to customize what variables are passed to the Ubiquity installer, but it only works if you use ubiquity's --automatic switch. I don't need to make it automatic for everybody yet, but whenever I install it I can simply press Alt+F2 and type in "ubiquity --automatic" so that my language, time zone, & keyboard layout are automatically passed to the installer. I only use this in my config right now, but there are more options available which can be seen here, in this example guide.
  • Eventually remastersys will copy all preseeds from the /etc/remastersys/preseed/ folder for multiple machines and/or purposes.
  • Until then, just add your own preseed options to /etc/remastersys/preseed/custom.preseed
Quote:
# Locale sets language and country.
d-i debian-installer/locale string en_US

# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
#d-i console-setup/modelcode string pc105
d-i console-setup/layoutcode string us
# To select a variant of the selected layout (if you leave this out, the
# basic form of the layout will be used):
#d-i console-setup/variantcode string dvorak

# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean false

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server ntp.example.com
STATIC DNS (OpenDNS), EVEN WITH DHCP
  • EDIT resolvconf:
sudo -s
mkdir /etc/resolvconf/resolv.conf/
<EDITOR> /etc/resolvconf/resolv.conf/base

+ ADD:
Quote:
nameserver 208.67.222.222
nameserver 208.67.220.220
  • EDIT the DHCP client:
<EDITOR> /etc/dhcp3/dhclient.conf
+ REPLACE the "#prepend domain-name-servers" line with this:
Quote:
prepend domain-name-servers 208.67.222.222,208.67.220.220;
RESTRICTED FIRMWARE AND DRIVERS
  • It's prolly a good idea to add restricted hardware drivers or firmware, especially for wireless networking.
  • It's also prolly a good idea to let the jockey-gtk "Hardware Drivers" app juggle between the multiple Nvidia and ATI drivers *after* installation. There are older, legacy graphics cards that won't work with the newest drivers from these manufacturers' websites.
  • I only wanted to support all the wireless cards possible and NTFS support for easy resizing of Windows partitions, so I installed these packages:
sudo aptitude install b43-fwcutter ndisgtk madwifi linux-restricted-modules ntfs-3g ntfs-config

USB PERSISTENCE
  • If using 8.10 or later, simply use the usb-creator tool, which is installed by default in Intrepid.
  • If using 8.04 LTS, you can add usb-creator by following these instructions... however, persistence still won't work with the default 8.04 initrd.
  • As long as you can copy and paste, it might be easier to just ignore this program and follow these manual instructions... (NOTE: Everything before the fdisk command must be run before remastersys dist to work properly)

---- BEGIN PREPARATION ----

sudo -s
<EDITOR> /usr/share/initramfs-tools/scripts/casper
 (for 8.04 and earlier ONLY)
+ REMOVE this section: ",mode=755"
<EDITOR> /usr/share/initramfs-tools/init (for 8.04 and earlier ONLY)
+ ADD the lines preceded by a + between the lines preceded by a *:
Quote:
* break)
* break=premount
* ;;
*
+ persistent)
+ PERSISTENT=yes
+ root_persistence=casper-rw
+ home_persistence=home-rw
+ ;;
+
* esac
  • For all versions of Ubuntu, if you'd like to take away the prompt at shutdown to remove the CD from the tray and press ENTER, consider this step [...'cause I'm not positive it's the right solution]:
chmod -x /etc/rc[06].d/*casper
  • Now re-run remastersys to implement these new initramfs changes:
remastersys clean; remastersys dist

---- END PREPARATION ----

fdisk /dev/sd<X> (replacing  <X> with what you believe, 110% sure, is your flash drive)
  • Now, add 2 to 4 partitions depending on the size of your distro, whether you want a separate partition for your home directory, and whether you want a FAT16/32 partition for easy access on Windows machines. Make sure the first partition is bootable. Now format and label your partitions:
mkfs.ext2 -L <distroName> /dev/sd<X>1
mkfs.ext2 -L casper-rw /dev/sd<X>2
mkfs.ext2 -L home-rw /dev/sd<X>3
mkfs.vfat -F 16 -n files /dev/sd<X>4
  • Now pull out the drive & plug it back in.
cd /media/cdrom/
cp -R boot boot.catalog casper/ .disk/ md5sum.txt preseed/ README.diskdefines /media/<distroName>/
cd /boot/grub/
cp ./*stage* /media/<distroName>/boot/grub/
<EDITOR> /media/<distroName>/boot/grub/menu.lst

+ ADD a boot menu along these lines...
Quote:
default 0
timeout 7

#color cyan/blue white/blue
#splashimage=/boot/splash.xpm.gz

title Start Ubuntu in Graphical Mode
kernel /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper root=/dev/ram rw persistent
initrd /casper/initrd.gz

#title Install Ubuntu
#kernel /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper root=/dev/ram #only-ubiquity
#initrd /casper/initrd.gz

title Start Ubuntu in Demo Mode
kernel /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper root=/dev/ram
initrd /casper/initrd.gz

title Start Ubuntu in Safe Graphical Mode
kernel /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper root=/dev/ram xforcevesa rw persistent
initrd /casper/initrd.gz

#title Start Ubuntu in Text Only Mode
#kernel /casper/vmlinuz file=/cdrom/preseed/custom.seed boot=casper root=/dev/ram #textonly rw persistent
#initrd /casper/initrd.gz

#title Check the CD/DVD for defects
#kernel /casper/vmlinuz boot=casper integrity-check
#initrd /casper/initrd.gz

title Memory Test
kernel /boot/memtest

title Boot the First Hard Disk
root (hd1)
chainloader +1
  • Install grub to the MBR of the flash drive:
grub
$ grub >  geometry (hd  <Press TAB key now, making sure to realize which one is your USB>
$ grub >  root (hd<1>,0)
$ grub >  setup (hd<1>,0)
$ grub >  quit

ADD WUBI TO YOUR DIST
  • For right now, there's a decent bit of editing to /usr/bin/remastersys and /etc/remastersys.conf.
  • Just read the Remastersys + Wubi Guide, which I'm thinking could be made simpler by just offering a copy of the edited remastersys script.
__________________
  Remastersys Guide: Create Your Own Totally Fresh Ubuntu-Based Distro In A Few Hours

  SuiJurisForum.com -- A Forum where Freemen uncover the "Secrets" of Law & Commerce

你可能感兴趣的:(ubuntu,System,applet,keyboard,themes,variables)