2008年9月22日 星期一

Debian DHCP server設定

  • 安裝dhcp server套件

    debian:~# apt-get install dhcpd

  • 基本設定

    指定listen的介面

    debian:~# vi /etc/default/dhcp
    INTERFACES="eth0"

    debian:~# vi /etc/init.d/dhcp
    # Defaults
    INTERFACES="eth0"

  • DHCP模式

    1. 單純DHCP:同一區網內,一電腦為DHCP Server,並單純做IP的指派,介面設定為eth0即可

      debian:~# vi /etc/dhcpd.conf

      add/fix

      option domain-name-servers 140.134.4.1; #設定dns
      default-lease-time 600; #設定租約
      max-lease-time 7200;

      #network/netmask 這邊是用子網路切割140.134.210.128/25

      subnet 140.134.210.128 netmask 255.255.255.128 {
      range 140.134.210.240 140.134.210.245; #ip範圍
      option routers 140.134.210.254; #GATEWAY
      option subnet-mask 255.255.255.128; # netmask
      option broadcast-address 140.134.210.255; #broadcast
      }

      "option routers 140.134.210.254;"的設定如果將ip改成DHCP Server的電腦,就會變成DHCP/NAT的模式

    2. DHCP/NAT:eth0為外網設定eth1為內網,並需將listen的介面改成eth1,並利用iptables做nat的轉換

      network--eth0 eth1-- local

      debian:~# vi /etc/dhcpd.conf

      add/fix

      option domain-name-servers 140.134.4.1; #設定dns
      default-lease-time 600; #設定租約
      max-lease-time 7200;

      subnet 192.168.20.0 netmask 255.255.255.0 {
      range 192.168.20.101 192.168.20.200; #ip範圍
      option routers 192.168.20.1; #GATEWAY,eth1的ip
      option subnet-mask 255.255.255.0; # netmask
      option broadcast-address 192.168.20.255; #broadcast
      host inside {
      hardware ethernet 08:00:27:C9:D0:47; #靜態DHCP設定
      fixed-address 192.168.20.100;#指定ip
      }
      }

      設定iptables nat,如不做此設定local網路會無法上網

      debian:~# echo "1" > /proc/sys/net/ipv4/ip_forward
      debian:~# iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -j MASQUERADE

Blogger文章加密

Blogger文章加密,來自雪兔の部屋,還滿好用的,加密性也夠,但唯一的缺點是忘記密碼就完了!

2008年9月15日 星期一

Debian 編譯kernel

編譯kernel所需的套件
debian:~# apt-get install linux-source
debian:~# apt-get install libncurses5-dev
debian:~# apt-get install bzip2
debian:~# apt-get install gcc
debian:~# apt-get install make
下載核心
debian:~# apt-get install linux-source-2.6.24
debian:~# cd /usr/src
debian:/usr/src# tar jxvf linux-source-2.6.24.tar.bz2
debian:/usr/src# cd linux-source-2.6.24/
設定核心
debian:/usr/src/linux-source-2.6.24# make mrproper
debian:/usr/src/linux-source-2.6.24# make menuconfig
編譯核心
debian:/usr/src/linux-source-2.6.24# make
debian:/usr/src/linux-source-2.6.24# make modules (模組檔案放在 /lib/modules)
安裝核心
debian:/usr/src/linux-source-2.6.24# make modules_install
debian:/usr/src/linux-source-2.6.24# make install
更新grub
debian:/usr/src/linux-source-2.6.24# update-grub
核心的編譯非常的耗時,而且編譯出來的核心也不一定能穩定的執行,如非特定需求直接下載安裝編譯好的穩定核心會是比較好的辦法

Debian 解決firefox播放flash影片crash

由於Debian安裝預設的libflash-mozplugin,會無法觀賞youtube的網站,於是到了adobe的官網下載install_flash_player_9_linux.tar.gz的套件並安裝
debian:~# apt-get remove libflash-mozplugin
user@debian:~$ tar zxvf install_flash_player_9_linux.tar.gz
user@debian:~$ cd install_flash_player_9_linux
user@debian:~/install_flash_player_9_linux$ sh flashplayer-installer

最後到Perform another installation? (y/n):,按n離開就安裝完成了

x-window我不太喜歡用root登入,但還是說一下root的安裝法
debian:~# tar zxvf install_flash_player_9_linux.tar.gz
debian:~# cd install_flash_player_9_linux
debian:~/install_flash_player_9_linux# sh flashplayer-installer

Please enter the installation path of the Mozilla, Netscape,
or Opera browser (i.e., /usr/lib/mozilla):

輸入/usr/lib/iceweasel

最後到Perform another installation? (y/n):,按n離開就安裝完成了

安裝完成後,重新啟動x-window,再開啟firefox會發現yotube的影片可以觀看了,但只要一按到暫停,前進…等的控制項,整個firefox就會crash,上網查詢資料發現是與gcin衝到,非常的神奇,瀏覽器的flash player居然會跟輸入法衝到,因此必需將原本的gcin升級

debian:~# vi /etc/apt/sources.list

add

#gcin
deb http://www.calno.com etch-backports main
deb-src http://www.calno.com etch-backports main

debian:~# apt-get update
debian:~# apt-get gcin

更新安裝完成後,再將sources.list新增的部份註解

debian:~# vi /etc/apt/sources.list

fix

#gcin
#deb http://www.calno.com etch-backports main
#deb-src http://www.calno.com etch-backports main
重新啟動X-window即可

Debian 播放中文mp3

安裝beep media player
  • debian:~# apt-get install beep-media-player
設定beep media player
  • 進入x-window後執行beep media player,滑鼠右鍵->Preferences->Plugins->Output選擇正確的音效驅動程式

  • 在Plugins下,Media標籤選擇"MPEG Audio Plugin",並點擊下方的"偏好設定"出現MPEG Audio Plugin Configuration視窗,切換至Title標籤,勾選"Convert nono-UTF8 ID3 Tags to UTF-8",並在"ID3 ecoding:"中輸入"big5","ID3-format:"改成%f
設定完成後,載入中文名稱的mp3即可正確的顯示出檔案名稱

2008年9月14日 星期日

Debian VNC遠端登入KDE with gcin

安裝VNC Server

  • 至VNC官方網站(http://www.realvnc.com)下載VNC Enterprise Edition for Linux (x86) Debian Package

  • 安裝deb套件,並新增序號

    debian:~# dpkg -i vnc-e_4.4.2_i386.deb
    debian:~# vnclicense -add xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
VNC Server設定
  • 先執行第一次,產生.vnc/xstartup,停掉VNC Server

    user@debian:~$ vncserver
    user@debian:~$ vncserver -kill :1

  • 設定xstartup後再重開VNC Server

    user@debian:~$ vi .vnc/xstartup

    fix

    x-window-manager &

    to

    #x-window-manager &
    export XMODIFIERS=@im=gcin
    gcin &
    startkde & #gnome為gnome-session &

  • 存檔後離開,再執行vncserver

    user@debian:~$ vncserver
Winxp遠端登入VNC

  • 下載VNC Enterprise Edition Viewer for Windows (x86, x64 & ia64)
  • 輸入server:vnc number,ex:192.168.20.1:1
  • 再輸入Debian本機user的帳號密碼即可登入

2008年9月9日 星期二

Debian 安裝無蝦米scim

參考網站

http://plog.longwin.com.tw/my_note-unix/2007/06/21/install_liu_in_debian_2007


  • 安裝scim

    debian:~# apt-get install scim-chewing
    debian:~# apt-get install scim-tables-zh

  • 切換預設輸入法為scim

    user@debian:~$ im-switch -s scim

  • 取得liu57.cin並製成scim輸入法表格

    debian~:# iconv -f cp950 -t utf8 liu57.cin > liu57.cin.utf8
    debian~:# vi liu57.cin.utf8

    將a A前的標頭全部刪除,並加入以下的內容

    ### File header must not be modified
    ### This file must be encoded into UTF-8.
    ### This file comes from xcin module.
    SCIM_Generic_Table_Phrase_Library_TEXT
    VERSION_1_0

    ### Begin Table definition.
    BEGIN_DEFINITION

    ### An unique id to distinguish this table among others.
    ### Use uuidgen to generate this kind of id.
    UUID = 3d872a7a-760e-400c-8b23-688d38390e81

    ### A unique number indicates the version of this file.
    ### For example the last modified date of this file.
    ### This number must be less than 2^32.
    SERIAL_NUMBER = 20040922

    ICON = /usr/share/scim/icons/liu57.png

    ### The default name of this table
    NAME = Liu5

    ### The local names of this table
    NAME.zh_CN = 嘸蝦米
    NAME.zh_TW = 嘸蝦米
    NAME.zh_HK = 嘸蝦米

    ### Supported languages of this table
    LANGUAGES = zh_TW,zh_HK,zh_CN,zh_SG

    ### Prompt string to be displayed in the status area.
    STATUS_PROMPT = 中

    ### If true then the first candidate phrase
    ### will be selected automatically during inputing.
    AUTO_SELECT = FALSE

    ### If true then a multi wildcard will be appended
    ### at the end of inputing string automatically.
    AUTO_WILDCARD = TRUE

    ### If true then the result string will be committed to client automatically.
    ### This should be used with AUTO_SELECT = TRUE.
    AUTO_COMMIT = FALSE

    ### If true then the inputed string will be automatically splitted during inputing.
    AUTO_SPLIT = TRUE

    ### If true then the phrases' frequencies will be adjusted dynamically.
    DYNAMIC_ADJUST = TRUE

    ### If true then the preedit area will be filled up by the current candidate phrase automatically.
    AUTO_FILL = FALSE

    ### If true then the lookup table will always be shown if there is any candidate phrase.
    ### Otherwise the lookup table won't be shown unless the user requires it by moving the preedit caret left.
    ALWAYS_SHOW_LOOKUP = TRUE

    ### Use full width punctuation by default
    DEF_FULL_WIDTH_PUNCT = TRUE

    ### Use full width letter by default
    DEF_FULL_WIDTH_LETTER = FALSE

    ### The maxmium length of a key.
    MAX_KEY_LENGTH = 4

    ### Valid input chars.
    VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]

    ### Single wildcard char, can have multiple chars.
    SINGLE_WILDCARD_CHAR = ?

    ### Multi wildcard char.
    MULTI_WILDCARD_CHAR = *

    ### The key strokes to split inputed string.
    SPLIT_KEYS = space

    ### The key strokes to commit the convert result to client.
    COMMIT_KEYS = space

    ### The key strokes to forward the inputed string to client.
    FORWARD_KEYS = Return

    ### The key strokes to select candidiate phrases.
    SELECT_KEYS = space,v,3,4,5,6,7,8,9,0

    ### The key strokes to page up the lookup table.
    PAGE_UP_KEYS = Page_Up

    ### The key strokes to page down the lookup table.
    PAGE_DOWN_KEYS = Page_Down,space
    END_DEFINITION

    ### Begin Table data.
    BEGIN_TABLE


    這邊之後才開始接a A,最後到檔案的結尾加入END_TABLE

    debian:~# scim-make-table liu57.cin.utf8 -b -o liu57.bin
    debian:~# wget http://plog.longwin.com.tw/files/liu5.png
    debian:~# mv liu5.png liu57.png
    debian:~# cp liu57.png /usr/share/scim/icons
    debian:~# cp liu57.bin /usr/share/scim/tables

  • 重新啟動X即可