2010年2月27日

在 ubuntu 下, 啟動第 2 個 X, 同時執行 linux 和 winXP

在 ubuntu 下, 啟動第 2 個 X, 同時執行 linux 和 winXP (in VirtualBox 全螢幕), 如此一來, 即像是在執行雙系統

1. 在 display:1 執行另一個 X, 再執行 xterm, (twm), VirtualBox
    X -display :1 &
    xterm -dsplay :1 &
    VirtualBox -display :1 &
2. 按 [Ctrl+Alt+F9] 切換到 display:1 (按 [Ctrl+Alt+F7] 可切回 display:0)
    在其中執行全視窗的 winXP in VirtualBox

若要執行全部 gnome 桌面的話, 下指令:
    startx -- :1 -bpp 32 -quiet &
事實上, 只要執行以下指令即可
    startx -- :1 &

ubuntu 9.10 無法休眠 (安裝時忘了建立 swap)

 安裝 ubuntu 9.10 時, 忘記分割 swap, 所以無法休眠, 修正方法如下:

1. (可利用 gparted) 重新分割 swap
2. ls -l /dev/disk/by-uuid/ 找出 swap 分割區的 uuid, 以便掛載
    或 sudo blkid
    /dev/sda6: UUID="08c5f7ed-1cf2-4bc5-9cea-7534dd554e3c" TYPE="swap"
3. sudo gedit /etc/fsatb 修改自動掛載的分區檔, 紅字部份請填入剛剛得到的uuid
    UUID=08c5f7ed-1cf2-4bc5-9cea-7534dd554e3c none swap  sw     0       0
4. 修改 (或新增)
sudo gedit /etc/initramfs-tools/conf.d/resume, 填入剛剛獲得的 UUID:
    RESUME=UUID=08c5f7ed-1cf2-4bc5-9cea-7534dd554e3c
5. 重建initrt檔 
    sudo update-initramfs -u
重新啟動後, 休眠功能回復了, 但喚醒後, 滑鼠不動 (還沒解決) 

2010年2月26日

ubuntu 自動登入後, 無線網路每次都必需輸入 keyring 密碼的不方便問題

不想每次自動登入 ubuntu 後, 還要輸入鑰匙圈的密碼 (keyring),可參考此網站的做法 (但可能不是很安全喔)

http://maketecheasier.com/auto-unlock-keyring-manager-in-ubuntu-intrepid/2009/03/14
應用程式->附屬應用程式->密碼及加密金鑰
然後在出現的視窗主選單中, 選 ->編輯->偏好設定, 按 [更改解鎖密碼] 鈕, 輸入原有密碼後, 不輸入新密碼 (就是留空白), 重新開機後, 應該就不用再輸入密碼了! Yeah!

2010年2月20日

在 ubuntu 下架設 VPN

很久以前試了一次沒成功能, 再次找到這一個架設 VPN 的說明, 有空試試
see: http://gsyan888.blogspot.com/2009/11/ubuntu-vpn-server.html

所需套件:pptpd
設定檔案:/etc/pptpd.conf , /etc/ppp/pptpd-options , /etc/ppp/chap-secrets

1. 安裝 pptpd
apt-get update
apt-get install pptpd
2. 修改 /etc/pptpd.conf
#server 端之 ip
localip 192.168.0.2
#要分配給 client 端之 ip
remoteip 192.168.0.11-20

指定當 client 連線成功以後分配 192.168.0.11 到 192.168.0.20 之間任一個 IP 給它,也可以用逗號分隔,一個個列表。

3.  修改 /etc/ppp/pptpd-options
這個檔案裡面,最重要的是兩項設定: name 和 ms-dns。
name 是定義在 /etc/ppp/chap-secrets 中第二個欄位(server name),因此兩邊要配合好,例如,下面是預設值:
name pptpd
依前述設定,在 /etc/ppp/chap-secrets 中就必須是下面的格式
xxxx pptpd xxxx 1.2.3.4
pptpd-options 中的另外一項要設的是 ms-dns ,它可以幫 client 端在連線成功以後指定 DNS,例如:
ms-dns 192.168.1.2
client 端連線成功以後會指定 192.168.1.2 為 DNS。對 Windows 的 clinet 來說,這項設定最多可以有兩行,因為 Windows 只能指定最多兩個 DNS。
此外,如果想幫 client 指定 WINS 則可以加入底下的設定:
ms-wins 192.168.1.3
上面的的設定可以幫 client 設定 WINS 到 192.168.1.3

4. 修改 /etc/ppp/chap-secrets
這個檔案主要是儲存 client 端進行 VPN 連線時的帳號、密碼資訊。例如:
username pptpd mypw *
上面的設定:
  • 帳號:username
  • 主機:pptpd (參考 /etc/ppp/pptpd-options 中的 name)
  • 密碼:mypw
最後一個欄位的星號  *  告訴 pptpd :不由這裡指定 client 連線時的 IP ,由 /etc/pptpd.conf 中的 remoteip 設定來分配。也就是採動態分配 IP (類似 DHCP),如果星號改成 IP ,那就是採固定 IP。


5. 啟動 pptpd
如果前面的步驟都完成,就可以啟動 pptpd !執行:
/etc/init.d/pptpd start
或是
/etc/init.d/pptpd restart

2010年2月19日

在ubuntu 將 virtualbox 裡網路設定靜態 IP

來源: http://waue0920.blogspot.com/2008/10/ubuntu-virtualbox.html
參考: https://help.ubuntu.com/community/VirtualBox#Networking
若要在virtualbox內的主機,設定為靜態或動態ip的上網模式, 我的router為 192.168.138.254,我ubuntu的主機網路位址為192.168.138.191,而在主機內的虛擬機器用dhcp的方式上網是完全沒有問題,但是想讓虛擬機器用同樣為192.168.138.xxx 的網址就需要額外設定了。
sudo apt-get install bridge-utils
sudo gedit /etc/network/interfaces
修改以下內容
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.138.191
netmask 255.255.255.0
gateway 192.168.138.254
bridge_ports eth0 vbox0
auto lo
iface lo inet loopback
然後
sudo /etc/init.d/networking restart
sudo gedit /etc/vbox/interfaces
修改以下內容
# Each line should be of the format :
#
vbox0 waue br0
sudo /etc/init.d/vboxnet restart
sudo chown root:vboxusers /dev/net/tun
sudo chmod g+rw /dev/net/tun
gedit /etc/udev/rules.d/20-names.rules
將以下
KERNEL=="tun", NAME="net/%k"
改成
KERNEL=="tun", NAME="net/%k", GROUP="vboxusers", MODE="0660"
開啟virtualbox -> 設定值->網路->
附掛到:"主端介面"
介面名稱:"vbox0"

之後,開啟虛擬主機進入其作業系統之後,就可以設定其為靜態ip囉

compile gretl in ubuntu Karmic 9.10

先建一個子目錄, 例如 cvs,
進入後,  先下指令, 抓原始碼

cvs -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl login
問密碼不用輸入, 直接按 [enter],
再輸入
cvs -z3 -d:pserver:anonymous@gretl.cvs.sourceforge.net:/cvsroot/gretl co -P gretl
如此會產生 ./cvs/gretl 子目錄, 以後更新原始碼時, 下指令
cvs update -d -P
就會自動更新了

在 ./configure 之後, 如果少了 zlib, 則需安裝
libzip-dev

2010年2月13日

grub2 的直接從 iso 檔開機功能 (boot from iso)

menuentry "Ubuntu Live 9.04 32bit" {
loopback loop /boot/isos/ubuntu9.04.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/isos/ubuntu9.04.iso --
initrd (loop)/casper/initrd.gz
}
menuentry "Ubuntu 8.10" {
set isofile="/boot/isos/ubuntu.iso"
loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash noprompt --
initrd (loop)/casper/initrd.lz
}

2010年2月5日

遠端控制你的 ubuntu - vino, xrdp, ssh

1. 在 ubuntu 工作列 系統 -> 偏好設定 -> 遠端桌面 設定後, 即可利用 vnc 協定來連線
    在 client 端, 若是 ubuntu, 可用預裝的 網際網路-》遠端桌面檢視器
2. 如果習慣用終端伺服器用戶端 (連 windows 用的), 則要加裝 vnc4viewer, 或  xrdp
3. 用文字 ssh 介面登入的人,可以安裝 ssh server

用 vnc 連的缺點是一定要使用者在本地端登入了,才可檢視桌面, 旦重開機而無預設帳號登入,則無法使用VNCViewer檢視, 此時可改用 XDMCP

在終端伺服器用戶端下, XDMCP 預設是不能選的, 因為還要加安裝 xnest:
sudo apt-get install xnest

2010年2月4日

主機裝 virtualBox 2.0.4 OSE, 在 client 端中裝 Ubuntu 9.04, 螢幕解析度設定

參考: http://ok2.tw/blog/100
將以下 edit /etc/X11/xorg.conf 檔之內容改成以下, 即可用 1024x768 模式
Section "Device"
Identifier "VESA Framebuffer"
Driver "vesa"
#VideoRam 4096
# Insert Clocks lines here if appropriate
EndSection
Section "Monitor"
Identifier "My Monitor"
HorizSync 31.5 - 150.0
VertRefresh 75-85
EndSection
Section "Screen"
Identifier "Screen 1"
Device "VESA Framebuffer"
Monitor "My Monitor"
# If your card can handle it, a higher default color depth (like 24 or 32)
# is highly recommended.
# DefaultDepth 8
# DefaultDepth 16
DefaultDepth 24
# DefaultDepth 32
# "1024x768" is also a conservative usable default resolution. If you
# have a better monitor, feel free to try resolutions such as
# "1152x864", "1280x1024", "1600x1200", and "1800x1400" (or whatever your
# card/monitor can produce)
Subsection "Display"
Depth 8
Modes "1024x768" "800x600" "640x480"
EndSubsection
Subsection "Display"
Depth 16
Modes "1024x768" "800x600" "640x480"
EndSubsection
Subsection "Display"
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubsection
Subsection "Display"
Depth 32
Modes "1024x768" "800x600" "640x480"
EndSubsection
EndSection
Section "ServerLayout"
# The Identifier line must be present
Identifier "Simple Layout"
# Each Screen line specifies a Screen section name, and optionally
# the relative position of other screens. The four names after
# primary screen name are the screens to the top, bottom, left and right
# of the primary screen. In this example, screen 2 is located to the
# right of screen 1.
Screen "Screen 1"
EndSection

2010年2月1日

安裝 Acrobat Reader 在 Ubuntu 9.10 (karmic koala) AMD64

到這裡抓

http://archive.canonical.com/ubuntu/pool/partner/a/acroread/

或設套件來源
deb http://archive.canonical.com/ubuntu karmic partner

然後
sudo apt-get update
sudo apt-get install acroread

在 ubuntu 9.10 (AMD64) 裝 自行打包的 gretl 1.8.7 with aptitude

gretl-1.8.7 for ubuntu 9.10 (AMD64)
This deb file can be installed successfully on ubuntu 9.10 (Karmic) AMD64. But some actions should be done before gretl works.
1. Installing this deb on ubuntu 9.10 (AMD64) should have no problem.
2. After installing the deb, copy /usr/local/bin/libgrel*.* to /usr/bin (with sudo)
3. Install liblapack-dev with "sudo aptitude install liblapack-dev
    This is because synaptic and apt-get don't work for solving dependences issue.
OK, it is now to run gretl.

gretl_1.8.6-1_amd64.deb 這個是我在 ubutnu 8.10 AMD64 版本打包的, 還沒在其它電腦試過
安裝後發現
1. /usr/local/bin/gretl_x11: error while loading shared libraries: libgretl-1.0.so.0:
同上將 /usr/local/lib 下, libgretl-1.0.so.0 等 4 個以 libgretl* 開頭的檔, 全部複製到 /usr/lib

2. 發現有嚴重的 dependences 問題, google 後, 有人建議用 aptitude, 它會提出降級解決方案, 如下

xxx@xxx-desktop:~$ sudo aptitude install liblapack-dev
正在讀取套件清單... 完成
正在重建相依關係         
正在讀取狀態資料... 完成
初始化套件狀態... 完成    
正在編輯延伸狀態訊息... 完成
以下的套件狀態為毀斷
  libgfortran3
以下新套件將會安裝:
  libatlas-base-dev{a} libatlas-headers{a} libatlas3gf-base{a}
  libblas-dev{a} libblas3gf{a} liblapack-dev liblapack3gf{a}
0 個套件升級, 8 個新安裝, 0 個將移除且 0 個不會升級.
需要下載 22.9MB 的歸檔檔案. 解裝後將用去 91.3MB.
以下套件含有相依性:
  libgfortran3: 相依關係: gcc-4.4-base (= 4.4.1-4ubuntu8) 但 4.4.1-4ubuntu9 已安裝
以下動作會解決這些相依問題:

降級 下列套件:
cpp-4.4 [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]
gcc-4.4 [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]
gcc-4.4-base [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]
lib32gcc1 [1:4.4.1-4ubuntu9 (now) -> 1:4.4.1-4ubuntu8 (karmic)]
lib32stdc++6 [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]
libgcc1 [1:4.4.1-4ubuntu9 (now) -> 1:4.4.1-4ubuntu8 (karmic)]
libgomp1 [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]
libstdc++6 [4.4.1-4ubuntu9 (now) -> 4.4.1-4ubuntu8 (karmic)]

分數是 172

是否接受該解決方案?[Y/n/q/?] y


執行完畢後, 就可以正常跑了!