November 24th, 2008

You are currently browsing the articles from KomKid.Net written on November 24th, 2008.

Linux (Ubuntu) in Windows #7 Qemu to coLinux

Convert Qemu Image to coLinux Image
อย่างที่บอกว่า Emu มันช้า อย่ากระนั้นเลย แปลงมันมาใช้กับ coLinux ดีกว่า
1.เริ่มด้วย cd เข้าไปหา directory ที่มี Image ของ Qemu จะใช้ Cygwin หรือติดตั้ง unxutils ก็สะดวกดี

unxutils : Some ports of common GNU utilities to native Win32. In this context, native means the executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools.

แล้วก็แปลงไฟล์ด้วยคำสั่ง

dd if=qemu_ubuntu_4gb of=ubuntu_4gb.img bs=512 skip=63

ตามคำแนะนำของ coLinux

2.Copy ไฟล์ไปใช้กับ coLinux คราวนี้ใช้ D:\coLinux (เพราะ drive C ใกล้จะเต็มแล้ว 555)
แล้วก็สร้าง swap file สำหรับ coLinux ด้วยคำสั่ง

fsutil file createnew swap_512mb 536870912

แล้วก็ย้ายไปไว้ใน folder root_fs ทั้ง ubuntu_4gb.img และ swap_512mb

3.จากนั้นก็สร้างไฟล์ config สำหรับ coLinux (ubuntu8_10.conf)ดังนี้

kernel=vmlinux
initrd=initrd.gz (ใช้เฉพาะตอน boot ครั้งแรก)
mem=256
root=/dev/hda1 fastboot 5
hda1=\DosDevices\D:\coLinux\root_fs\ubuntu_3gb.img
hdb1=\DosDevices\D:\coLinux\root_fs\swap_512mb

แล้วก็สร้าง batch file สำหรับเรียกใช้ coLinux (coLinux.bat) ดังนี้

@echo off
colinux-daemon.exe –install-driver
colinux-daemon.exe @”ubuntu8.10.conf” -t nt
colinux-daemon.exe –remove-driver
pause

4.ลองเรียกใช้ batch file ก็จะได้ ubuntu 8.10 ใน text mode (เพราะ coLinux แสดงผล X Application เองไม่ได้)

แต่ข้อดีของการแปลงมาจาก Qemu ก็คือ ตอนที่เราติดตั้งมันมีพวก Desktop Manager อยู่แล้ว แค่ coLinux มันแสดงผลไม่ได้เท่านั้นเอง

วิธีการแรกก็คือ ติดตั้ง VNC Server ไว้ แล้ว remote เข้าไปใช้ ตัวอย่าง ผมใช้ TightVNC

sudo apt-get install tightvncserver

ติดตั้งเสร็จ ก็ run Server ไว้แล้ว remote เข้าไปด้วย IP ของ coLinux:1 เช่น 192.168.0.2:1 ได้ผลดังรูป

อีกวิธีก็คือ ใช้ FreeNX ตามที่เคยบอกไว้แล้วใน Remote control Ubuntu from Windows

Written by admin on November 24th, 2008 with no comments.
Read more articles on Ubuntu.

Linux (Ubuntu) in Windows #6 Qemu

Install Ubuntu on Qemu

QEMU is an emulator for various CPUs. It works on Linux, Windows, FreeBSD and Mac OS X. Windows version is in an alpha stage. I hope I can provide useful information on development and usage of the software.

มาลองใช้ Ubuntu ผ่าน Qemu กันบ้าง ชื่อก็บอกอยู่แล้ว ว่า Emu (Emulation) ก็ต้องช้ากว่าของจริงอยู่แล้ว แต่ก็ลองดูกันหน่อย
1.เริ่มจาก Download Qemu แต่ไม่ต้องติดตั้ง แตกไฟล์แล้วใช้ได้เลย คราวนี้ผมแตกไว้ที่ D:\QEMU\
เรียก cmd แล้วก็ cd เข้าไปใน directory นั้น แล้วก็สร้างไฟล์สำหรับ install และ swap ด้วยคำสั่ง

fsutil file createnew qemu_ubuntu_4gb 4294967296

และ

fsutil file createnew qemu_swap_512mb 536903168

เพื่อสร้างไฟล์สำหรับติดตั้งขนาด 4GB และ Swap ขนาด 512MB

สร้าง folder Distro แล้วย้ายสองไฟล์เข้าไปไว้ในนั้น (ไม่มีนัยสำคัญอะไรครับ แค่จัดให้เป็นระเบียบ) แล้วก็ copy Image ของ Ubuntu ที่จะติดตั้งไว้ใน folder นี้ด้วย ซึ่งคราวนี้เลือกใช้ ubuntu-8.10-desktop

2.สร้าง Batch file สำหรับ boot ให้ชื่อว่า QEMU.bat

@ECHO OFF
set qemu_dir=D:\\QEMU\\Distro
set hd=%qemu_dir%\\qemu_ubuntu_4gb
set swap=%qemu_dir%\\qemu_swap_512mb
set cdrom=%qemu_dir%\\ubuntu-8.10-desktop-i386.iso
set mem=256
qemu -hda %hd% -hdb %swap% -cdrom %cdrom% -m %mem% -boot d -L .
pause

3.ทำการติดตั้งด้วยการ Double Click ที่ batch file ที่สร้างขึ้นแล้วก็ติดตั้งไปตามขั้นตอนของ Ubuntu หลัก ๆ ก็
- เลือกภาษาที่จะใช้ในการติดตั้ง
- เลือก timezone
- เลือก Keyboard Layout
- ป้อนข้อมูลเพื่อสร้าง Account
- กำหนด Partition ก็เลือกเอา 4GB เป็น primary partition แล้วก็ 512MB เป็น swap
- ยืนยันแล้วก็เริ่มทำการติดตั้ง

4.Boot ใหม่ โดยแก้ QEMU.bat นิดหน่อย

@ECHO OFF
set qemu_dir=D:\\QEMU\\Distro
set hd=%qemu_dir%\\qemu_ubuntu_4gb
set swap=%qemu_dir%\\qemu_swap_512mb
set mem=256
qemu -hda %hd% -hdb %swap% -m %mem% -L .
pause

แล้วก็จะได้ Ubuntu 8.10 intrepid ibex ไว้ทดลองใช้ ดังรูป

Written by admin on November 24th, 2008 with no comments.
Read more articles on Ubuntu.