2011年8月29日 星期一

好用的自由軟體

辦公室軟體 LibreOffice: http://www.libreoffice.org/download/
文字編輯器 Notepad++ : http://notepad-plus-plus.org/
工程/數學軟體 freemat : http://freemat.sourceforge.net/
再來一個重量級工程/數學軟體 Octave: http://www.gnu.org/software/octave/
數學線性代數軟體 Wxmaxima: http://andrejv.github.com/wxmaxima/
解壓縮軟體 7-zip : http://www.7-zip.org/
室內設計 SweetHome 3D: http://www.sweethome3d.com/index.jsp
虛擬電腦 VirtualBox: http://www.virtualbox.org/

2011年4月30日 星期六

經典遊戲

apt-get install chromium-bsu criticalmass pinball extremetuxracer frozen-bubble xgalaga kapman pacman kbreakout atris kspaceduel pixfrogger pyracerz scorched3d supertux airstrike gmchess

2011年4月24日 星期日

Ubuntu 11初探

剛開始使用 Ubuntu 11 桌面系統(Unity)有點操作不習慣, 主要是不熟悉程式所在位置, 最常用的 Termial(終端機)我就找不到放哪裡, 一度想放棄使用, 想說怎麼會跟 10.10 版本的差異, 變化這麼大, 原來他放在放大鏡(+)(應用程式)裡, 打開後再將右上處下拉符號往下點(或是在放大鏡處按滑鼠右鍵)就看到程式的主功能表了,整個程式(app)空間變大了桌面變得更見簡潔, 也許比較人性化吧, 對剛用 ubuntu 初學者, 想必會較有吸引力吧, 一旦用習慣後, 就會愛上它了,總而言之,所有新系統都會有適應期,4/28 Ubuntu 11 將會是 release 版本,很期待它會變得更好.
另外用習慣 Window 系統的人來說, 當程式放大使用全螢幕操作時, 關閉/縮小/還原 按鈕變到左上方去了, 但它高亮度符號至少有讓人注意到它的存在, 一旦切回視窗模式, 這些按鈕又變回右上角,真的是有點不習慣說.

改裝 Ubuntu

1. 使用超級使用者登錄, 事先安裝好 squashfs-tools
sudo su
apt-get install squashfs-tools
如果要製作 Grub2 boot CDROM時, 需要安裝 xorriso
apt-get install xorriso

2. 製作 4G 映像檔
dd if=/dev/zero of=ubuntu.img bs=1k count=1 seek=3999999
p.s. 該映像檔案(ubuntu.img)盡可能放在 ext3 或 ext4 系統上, 速度會比較快, 千萬不要放在 ntfs 上(有可能在操作 unsquashfs 時, 因速度慢, 造成當機的假像).
3. 轉換成 ext4 格式映像檔
mkfs.ext4 ubuntu.img

4. 掛載檔案系統, 進入工作目錄
mkdir rootfs
mount -o loop ubuntu.img rootfs
cd rootfs

5. 解出在 CDROM 上的 squashfs 檔案系統, 會自動產生 squashfs-root
unsquashfs /cdrom/casper/filesystem.squashfs

6. 複製網路設定檔 hosts, resolv.conf
cp /etc/hosts squashfs-root/etc
cp /etc/resolv.conf squashfs-root/etc

7 bind /dev, 並 chroot
mount --bind /dev squashfs-root/dev
chroot squashfs-root

8.掛在系統特殊目錄
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

9. 加加減減 apt-get install, 或 apt-get purge
我想增加的 package計有
squashfs-tools
xorriso
bareftp
proftpd
gerbv
qcad
freemat
geany
apache2
php5
mysql-server
php5-mysql
php5-curl
php5-sqlite
php5-sybase
php5-gd
qemu

10. 刪除不必要檔案, 並退出 chroot
rm -f /root/.bash_history
rm -f /etc/hosts
rm -f /etc/resolv.conf
rm -f /tmp/*
rm -f /var/tmp/*
apt-get clean
umount /dev/pts
umount /sys
umount -lf /proc
exit
umount -lf squashfs-root/dev

11.產生iso工作目錄,並準備製作成Ubuntu所需的檔案放入casper目錄內
mkiso /iso
mkdir /iso/casper
mkdir /iso/boot
mkdir /iso/boot/grub
cp /cdrom/casper/initrd.lz /iso/casper
cp /cdrom/casper/vmlinuz /iso/casper
cp /cdrom/.disk /iso


mksquashfs squashfs-root /iso/casper/filesystem.squashfs
chroot squashfs-root dpkg-query -W --showformat='${Package} ${Version}\n' > /iso/casper/filesystem.manifest

12. 編輯 /iso/boot/grub/grub.cfg
menuentry "Remaster Ubuntu" {
linux /casper/vmlinuz boot=casper locale=zh_TW.UTF-8 quiet splash
initrd /casper/initrd.lz
}

13 將 /iso目錄轉換,產生可開機CDROM映像檔
grub-mkrescue -o new.iso /iso

14.如有需要將new.iso燒成cdrom或DVD或使用qemu來測試
qemu -boot d -cdrom new.iso

2011年4月16日 星期六

使用 grub2 boot Ubuntu CDROM

1. apt-get install xorriso
2. 產生工作目錄 iso
3. 在工作目錄建立兩個目錄 boot 及 casper
4. 在 boot 內產生 grub 目錄, 編輯 grub.cfg, 放到 iso/boot/grub 內
5. 將 vmlinuz, initred.lz, filesystem.squashfs,filessystem.manifest 放進 iso/casper 目錄內
6. 執行 grub-mkrescue -o cdrom.iso iso
7. grub.cfg 內容範例:
menuentry "Ubuntu" {
linux /casper/vmlinuz boot=casper locale=zh_TW.UTF-8 quiet splash
initrd /casper/initrd.lz
}

2011年4月3日 星期日

Grub 2 + memdisk

從舊版 Grub (ver < 0.97) 升級到 Grub 2 後, memdisk 也必須升級, 否則會不正常.
UBuntu 9.1 已經使用改用 Grub 2, 使用其 (Ubuntu.iso) cdrom 便可安裝了
並且在 grub.cfg 中的一些設定也需跟著修改
例如 kernel 須改為 linux16, initrd 須改為 initrd16 才可使用舊的 floopy image 來開機
另外 Partition 數字由 1 開始數, 需要注意! Disk 仍維持由 0 開始數
menuentry "Grub 2 Floopy Image Boot" {
root (hd0,1)
linux16 /boot/memdisk
initrd16 /boot/disk2880.img
}
參考 Memdisk 說明書網址:
http://syslinux.zytor.com/wiki/index.php/MEMDISK

Grub 2 初探

Grub 2 的設定檔共有 1 個目錄及 1 個共同設定檔案:
目錄在 /etc/grub.d 包含好幾個規劃好的設定檔, 看其命名應該就能體會其用意, 另外一個共同檔案則是 /etc/default/grub, 執行 sudo update-grub 後, 將會自動產生 grub.cfg, 並將它放在 /boot/grub 目錄內
一般如果要修改,或增加 menuentry, 可以加入到 /etc/grub.d/41_custom 檔案內, 再執行 update-grub 來變更設定
另外 Grub 2 多了 loopback device, 可以用以提取檔案內容, 讓後面的 linux 或 initrd 來使用. 是一相當實用的功能, 以下例子

menuentry "Ubuntu 10.10" {
# set root directory to disk0, 2nd patition
root (hd0,2)

# define a loopback device as loop, point to file: /boot/ubuntu.iso
loopback loop /boot/ubuntu.iso

#grab the linux kernel from loopback device (loop)
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/ubuntu.iso ro splash quiet locale=zh_TW.UTF-8

#grab the initial ram disk from loopback device (loop)
initrd (loop)/casper/initrd.lz
}


參考 Grub 2 說明書網址:
http://www.gnu.org/software/grub/manual/grub.html#Introduction