目前分類:Debian (16)

瀏覽方式: 標題列表 簡短摘要

當執行 sudo 指令時,會出現 unable to resolve host xxxxx﹍
此為反解問題,去修改 /etc/hosts 內容增加本機的電腦名稱進去即可。

sudo vim /etc/hosts

修改
127.0.0.1 localhost


127.0.0.1 localhost 電腦名稱

neio 發表在 痞客邦 留言(0) 人氣()

自動登錄使用者


建立 /usr/bin/autologin
sudo vim /usr/bin/autologin

增加下面內容至檔案內:

#!/bin/bash
/bin/login -f <使用者名稱>


好了後設定檔案權限為可執行檔:

sudo chmod +x /usr/bin/autologin

修改 /etc/inittab

sudo vim /etc/inittab


尋找下面這行:
1:2345:respawn:/sbin/getty 38400 tty1

修改為
1:2345:respawn:/sbin/getty -n -l /usr/bin/autologin 38400 tty1


自動啟動 X

修改使用者個人設定檔:

vim ~/.profile

添加下面內容至檔尾:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
       startx
fi

neio 發表在 痞客邦 留言(0) 人氣()

Postfix 是一套相容於 Sendmail 的郵件伺服器。由於設定較簡易且功能強大安全性更高,因此在目前使用程度廣泛,且相關支援文件也很齊全。

安裝
$sudo aptitude install postfix libsasl2 libsasl2-modules sasl2-bin dovecot-common dovecot-imapd dovecot-pop3d
上面指令將會安裝 postfix,且會一併安裝 dovecot 來作 pop3/imap 收信以及 SASL 負責 relay 的驗證。

設定
postfix 的主要設定檔為 /etc/postfix/main.cf,以下列出常用設定值。
# 主機名稱,必須與 DNS 的 MX 主機名稱對應
myhostname = aaa.bbb.ccc.ddd
# 網域名稱
mydomain = bbb.ccc.ddd
# 接受 relay 的網域
mydestination = bbb.ccc.ddd, localhost.localdomain, localhost
# 接受 relay 的網域主機
relay_domain = xxx.bbb.ccc.ddd
# 若要 smarthost 時,relay 的主機,一般設定成 isp 的 mail 主機即可。
# 如不設定似乎在寄給某些 mail server 會有編號 550-5.7.1 的問題而無法寄出,如 gmail。
# 下面 ip 為 hinet ms23.hinet.net 主機
relayhost = 168.95.4.23
# 內部網路
mynetworks = 127.0.0.0/8
# 設定信箱存放目錄
mail_spool_directory = /var/mail
# 信箱大小限制,單位 bytes,0 為不限。
mailbox_size_limit = 0
# 單封信件大小限制,單位 bytes
message_size_limit = 10240000

備註:若無設定 DNS MX 紀錄的對應,則無法正常 relay 到某些遠端主機。

設定 SASL 認證支援
SASL 為符合 RFC 2222 標準的認証機制,此作用可防止任意使用者登入使用郵件伺服器亂發郵件。目前幾乎大部分的 MTA Server 內定都關掉 OpenRelay 功能,改用 SMTP 認證來驗證使用者是否可進行 mail relay。

設定 SASL
修改 /etc/default/saslauthd 檔,設定 saslauthd 使用的認證方式與開機自動啟動。
# 讓 saslauthd 一開機就啟動
# This needs to be uncommented before saslauthd will be run automatically
START=yes
# 讓 saslauthd 採用 linux 的系統帳號密碼檔作驗證
# Which authentication mechanisms should saslauthd use? (default: pam)
#
# Available options in this Debian package:
# getpwent  -- use the getpwent() library function
# kerberos5 -- use Kerberos 5
# pam       -- use PAM
# rimap     -- use a remote IMAP server
# shadow    -- use the local shadow password file
# sasldb    -- use the local sasldb database file
# ldap      -- use LDAP (configuration is in /etc/saslauthd.conf)
#
# Only one option may be used at a time. See the saslauthd man page
# for more information.
#
# Example: MECHANISMS="pam"
MECHANISMS="pam"

# 讓 saslauthd 支援 postfix 預設安裝的 chroot 模式
# Other options (default: -c)
# See the saslauthd man page for information about these options.
#
# Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
# Note: See /usr/share/doc/sasl2-bin/README.Debian
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

最後使用 dpkg-statoverride 來建立 saslauthd 的執行時期目錄
$sudo  dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd


設定 Postfix 使用 SASL
編輯 /etc/postfix/sasl/smtpd.conf 讓 postfix 使用 saslauthd 來認證。
# log 檔的紀錄等級
log_level: 3
# 設定密碼檢驗使用哪種服務
pwcheck_method: saslauthd
# 設定所使用的認證機制
mech_list: PLAIN LOGIN

接著把 postfix 加入到 sasl 的群組中,才能使用 saslauthd 來認證。
$sudo addgroup postfix sasl

接著修改 postfix 設定檔 /etc/postfix/main.cf,啟用 SMTP 及 SASL 認證機制。
# 設定 Postfix 使用 SASL 認証。
smtpd_sasl_auth_enable = yes
# 設定 SASL 支援非標準 E-mail Client 的認証動作。
broken_sasl_auth_clients = yes
# 不使用 ANONYMOUS 這個認証。
smtpd_sasl_security_options = noanonymous
# 設定 SASL 的認証方法
# permit_sasl_authenticated        允許通過 SASL 認証者可 relay
# permit_mynetworks                   mynetworks 內使用者可 relay
# check_relay_domains               檢查可進行 ralay 的 domains
# reject_unauth_destination         未通過認證不予接收
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination
# 限制未經信任的 client 登入就啟動 sasl 認證
smtpd_client_restrictions = permit_sasl_authenticated

重新啟動服務
做好上述設定後,最後重新啟動各項服務或是重開機以使設定生效。
$sudo /etc/init.d/saslauthd restart
$sudo /etc/init.d/postfix restart

最後測試
在重新啟動服務後,可用以下方式來測試 saslauthd 服務是否正常運作。
$sudo testsaslauthd -u 使用者名稱 -p 密碼
回傳為「0: OK “Success.“」代表正常,反之則檢查 saslauthd 服務是否啟動;
接著登入 postfix 測試 sasl 是否運作。
$ perl -MMIME::Base64 -e 'print encode_base64("\0使用者帳號\0密碼");'
執行之後會產生一組 base64 編碼,稍後會用到;接著 telnet postfix。
$telnet 127.0.0.1 25
出現下面訊息:
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 aaa.bbb.ccc.ddd ESMTP Postfix (Debian/GNU)
輸入以下指令:
ehlo aaa <- aaa 為 hostname
出現下面訊息:
250-aaa.bbb.ccc.ddd
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
輸入以下指令:
auth plain xxxxxxxxxxxxxxxxxx <-剛剛用 perl 算出的 base64 值
若出現「235 2.0.0 Authentication successful」代表 sasl 認證成功,
反之如果驗證失敗則檢查設定步驟是否有誤。

設定 dovecot
dovecot 設定檔為 /etc/dovecot/dovecot.conf
# 設定支援哪些協定,在此為 IMAP 與 POP3 兩個
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps
protocols = imap pop3
# 設定監聽的 ip 與 port,可個別指定 imap 與 pop3 的監聽介面
# If you want to specify ports for each service, you will need to configure
# these settings inside the protocol imap/pop3 { ... } section, so you can
# specify different ports for IMAP/POP3. For example:
#   protocol imap {
#     listen = *:10143
#     ssl_listen = *:10943
#     ..
#   }
#   protocol pop3 {
#     listen = *:10100
#     ..
#   }
listen = *
# 設定啟動認證 
# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
disable_plaintext_auth = no
# 認證機制
# Space separated list of wanted authentication mechanisms:
#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
# NOTE: See also disable_plaintext_auth setting.
mechanisms = plain login

至此已完成 debian 上整個 mail server 的架設,client  端的帳號設定部份要記得在外寄伺服器要勾選驗證。

neio 發表在 痞客邦 留言(1) 人氣()

心智圖軟體﹍這啥鬼?用了會變聰明?
簡單說就是把心中的雜亂思緒繪製成圖,
方便自己整理一下的工具。
程式用 Java 開發的,所以跨平台沒問題。
如果熟用,其實能表現的地方還挺多的﹍


Debian 安裝用 sudo aptitude install freemind,
不過版本比較舊,上 google 查一下可以抓到新版,
新版有自動繁中語系。自由軟體萬歲!

neio 發表在 痞客邦 留言(1) 人氣()

svn 全名 Subversion,是一種常見的版本控制工具。
安裝

Server 端

$ sudo aptitude install libapache2-svn apache2 subversion

設定

以下為首次設定範例: 專案名稱:project_sample 使用者名稱:user1、user2

建立專案存放路徑

sudo mkdir -p /home/svn/project_sample

建立 svn 專案

sudo svnadmin create /home/svn/project_sample

更改 svn 根目錄擁有者

sudo chown -R www-data.www-data /home/svn/

設定 Apache 的 svn 設定檔 /etc/apache2/mods-available/dav_svn.conf,確認其內容如下:

<Location /svn>
DAV svn
SVNParentPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/dav_svn.authz
Require valid-user
</Location>

設定使用者權限設定檔 /etc/apache2/dev_svn.authz。

[project_sample:/]
# 設定 user1 可讀
user1 = r
# 設定 user2 可讀/寫
user2 = rw

建立使用者帳密

sudo /usr/bin/htpasswd -c /etc/apache2/dav_svn.passwd user1
sudo /usr/bin/htpasswd /etc/apache2/dav_svn.passwd user2

重新啟動apache sudo /etc/init.d/apache2 restart

執行 svn co http://localhost/svn/project_sample 即可 check-out。
SSL 連線設定

當連線因防火牆阻擋無法使用,產生 400 Bad Request 訊息時,改用 ssl 連線即可解決。

Apache2 SSL 連線設定份請參照 ssl_連線

設定好後執行 svn co https://localhost/svn/project_sample 即可 check-out。

neio 發表在 痞客邦 留言(0) 人氣()

Apache 是目前廣泛使用的跨平台 Web Server。其與 PHP、MySQL 等的結合,已成為中小型網站主機的最佳選擇。
安裝

安裝 Apache2 與 PHP5

$ sudo aptitude install apache2 php5

設定
虛擬主機

以下範例假設網域為 abc.com,三台虛擬主機分別為 a.abc.com、b.abc.com、c.abc.com 且都位於 IP 1.2.3.4 這台伺服器上。
DNS 設定

要方便管理設定虛擬主機,最好要能自己管理 DNS,否則需要一個配合度極高的 ISP。 於 DNS 設定上,僅需將上面三台虛擬主機的 FQDN 對應到 1.2.3.4 這個 IP 上即可;亦即正解部份加上三比如下紀錄:

;三台虛擬主機
a            IN    A    1.2.3.4
b            IN    A    1.2.3.4
c            IN    A    1.2.3.4

Apache 設定

Apache 設定虛擬主機有需多種方式,但主要都是以 http 表頭傳入的網址來作判別;以下列出兩種設定虛擬主機的方式。
一般設定方式

NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>
        ServerName      a.abc.com
        ServerAdmin     root@abc.com
        DocumentRoot    /var/www/a
</VirtualHost>

<VirtualHost 1.2.3.4>
        ServerName      b.abc.com
        ServerAdmin     root@abc.com
        DocumentRoot    /var/www/b
</VirtualHost>

<VirtualHost 1.2.3.4>
        ServerName      c.abc.com
        ServerAdmin     root@abc.com
        DocumentRoot    /var/www/c
</VirtualHost>

簡易設定方式

使用此方式需要啟用 vhost_alias_module 這個模組。

$ sudo ln -s /etc/apache2/mods-available/vhost_alias.load /etc/apache2/mods-enabled/vhost_alias.load

接著於 httpd.conf 加入下面設定:

UseCanonicalName Off
VirtualDocumentRoot /home/www/%0

此種方式在 /home/www 目錄下,每增加一個目錄就等同增加一台虛擬主機,最後的 %0 的意思參照下表。

0    the whole name
1    the first part
2    the second part
-1    the last part
-2    the penultimate part
2+    the second and all subsequent parts
-2+    the penultimate and all preceding parts
1+ and -1+    the same as 0
SSL 連線

使用 SSL 連線時資料有經過加密處理,安全性高、不易外洩。但對網站主機來說,須消耗更多資源,速度會較緩慢。
啟用 Apache2 SSL 功能模組

sudo a2enmod ssl

建立 SSL 認證檔

sudo mkdir /etc/apache2/ssl
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
上述指令執行後依照畫面描述輸入各項所需資料即可。

註:使用 make-ssl-sert 建立的認證檔預設使用時間是一個月。若要更長時間則須手動更改 /usr/sbin/make-ssl-cert,將 -keyout $output 更改成 -keyout $output -days 365 (你要的天數)。
建立 SSL 站台

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl

修改 /etc/apache2/sites-available/default

NameVirtualHost *

<VirtualHost *>
ServerName  hostname

改成

NameVirtualHost *:80

<VirtualHost *:80>
ServerName  hostname:80

修改 /etc/apache2/sites-available/ssl

NameVirtualHost *

<VirtualHost * >

ServerName  hostname
ServerAdmin webmaster@localhost

改成

NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem

ServerName  hostname:443
ServerAdmin webmaster@localhost
.
.
.

最後更改 Apache2 監聽的通訊埠,修改 /etc/apache2/ports.conf

#新增下面這行,讓 Apache2 監聽 443 port
Listen 443

neio 發表在 痞客邦 留言(0) 人氣()

BIND 是 Berkeley Internet Name Domain 的縮寫,為目前被廣泛使用的 Domain Name System(DNS)。 目前已經發展到版本 9,即 Bind9,解決了一些先前版本的問題。
安裝

$ sudo aptitude install bind9

設定

有關整個 DNS 的架構與設定方法參考 StudyArea;範例網域為 x9.idv.tw,dns 主機 ip 220.132.142.52,主機名稱 dnsvr。另外考量到安全性因素,建議讓 bind 執行於 chroot 環境,以保護系統免被入侵。

在一般 Linux distro. 上面 bind 主要設定檔為 /etc/bind/named.conf,但 Debian 上略有不同;Debian 上面主要設定檔為 /etc/bind/named.conf.local。除了設定檔的檔名不同外其餘設定皆大同小異。

首先看看 /etc/bind/named.conf.local 的內容:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "x9.idv.tw" in {
    type    master;
    file    "/etc/bind/db.x9.idv.tw";
};

zone "142.132.220.in-addr.arpa" in {
    type     master;
    file    "/etc/bind/db.220.132.142";
};

上面第一個 zone 定義了 x9.idv.tw 這個網域的正解部份,並設定類型為 master,設定檔為 /etc/bind/db.x9.idv.tw;142.132.220.in-addr.arpa 的部份則是反解的部份且設定檔為 /etc/bind/db.220.132.142。

接著來看看正解設定檔 db.x9.idv.tw 的內容:

$TTL 86400
$ORIGIN x9.idv.tw.
@            IN    SOA    x9.idv.tw. root.x9.idv.tw. (
                20070927 ; Serial
                      604800 ; Refresh
                   86400 ; Retry
                 2419200 ; Expire
                 86400 ) ; Negative Cache TTL

; 主要 NS、MX 與主要主機
@            IN    NS    x9.idv.tw.
@            IN    A    220.132.142.52
@            IN    MX 10    x9.idv.tw.
dnsvr            IN    A    220.132.142.52
dnsvr            IN    MX 20    x9.idv.tw.

; 別名紀錄,直接指向主機 dnsvr
www            IN     CNAME     dnsvr
ftp            IN    CNAME    dnsvr
mail            IN    CNAME    dnsvr

正解設定檔內除了設定兩筆 mailserver MX 紀錄外,另外還設定了 www、ftp、mail 三個 CNAME 指向 x9.idv.tw;特別注意到上面 “x9.idv.tw.”,最後的 ”.” 意思為代表這是 FQDN。

最後來看反解設定檔 db.220.132.142:

$TTL    86400
@    IN    SOA    x9.idv.tw. root.x9.idv.tw. (
                20070926 ; Serial
              604800 ; Refresh
               86400 ; Retry
                 2419200 ; Expire
                    86400 ) ; Negative Cache TTL
;
@    IN    NS    x9.idv.tw.
52    IN    PTR    x9.idv.tw.
52    IN    PTR    dnsvr.x9.idv.tw.
52    IN    PTR    www.x9.idv.tw.
52    IN    PTR    mail.x9.idv.tw.
52    IN    PTR    ftp.x9.idv.tw.

完成網域的正反解設定後,最後修改幾個 bind9 的執行相關參數設定檔:

/etc/default/bind9:

OPTIONS="-u bind"
# Set RESOLVCONF=no to not run resolvconf
RESOLVCONF=yes

/etc/bind/named.conf.options:

forwarders {
        168.95.1.1;
        168.95.192.1;
};

auth-nxdomain yes;      # conform to RFC1035 default is no. edit by neio
listen-on-v6 { none; }; # listen ipv6 default is any

/etc/resolv.conf:

nameserver 168.95.192.1
nameserver 168.95.1.1
search neio.idv.tw

接著重新啟動 bind9 後,一個簡易的小型 DNS 伺服器便已架設完畢。
Chrooting Bind9

倘若 bind9 架設完畢且一切都測試無誤後,以下的設定可以把 bind9 運行於 chroot 模式。

建立 bind9 的 chroot 執行目錄與設定相關權限:

停止 bind9

$ sudo /etc/init.d/bind9 stop

建立 chroot 環境中必要的目錄

$ sudo mkdir -p /var/lib/bind9/etc
$ sudo mkdir -p /var/lib/bind9/dev
$ sudo mkdir -p /var/lib/bind9/var/cache/bind
$ sudo mkdir -p /var/lib/bind9/var/run/bind/run

搬移原 bind9 設定檔與建立鏈結

$ sudo mv /etc/bind /var/lib/bind9/etc/bind
$ sudo ln -s /var/lib/bind9/etc/bind /etc/bind

建立執行所需裝置檔

$ sudo mknod /var/lib/bind9/dev/null c 1 3
$ sudo mknod /var/lib/bind9/dev/random c 1 8

設定相關權限

$ sudo chmod 666 /var/lib/bind9/dev/null /var/lib/bind9/dev/random
$ sudo chown -R bind:bind /var/lib/bind9/var/*
$ sudo chown -R bind:bind /var/lib/bind9/etc/bind

修改 bind9 設定檔,指定啟動方式

$ sudo vim /etc/default/bind9

修改 OPTIONS 選項如下

OPTIONS="-u bind -t /var/lib/bind9"

重新啟動 bind9

$ sudo /etc/init.d/bind9 start

neio 發表在 痞客邦 留言(0) 人氣()

OpenSSH 為 SSH 的開放原始碼版本,正確來說,是為了取代商業 SSH 而開發的開放性原始碼程式。 SSH Protocol 為一加密的通訊協定,特點為經過加密處理來避免傳輸過程中資料遭竊取。
安裝

Server 端

$ sudo aptitude install openssh-server

Client 端

$ sudo aptitude install openssh-client

設定

基本設定檔為 /etc/ssh/sshd_config (此為 server 版,client 為 ssh_config),設定檔內大部份選項都有註解說明用途,以下列出常用選項。

/etc/ssh/sshd_config

# SSH 監聽的通訊埠,建議更換掉,預設為 22。
Port 2235

# 是否允許 root 遠端登入,基於安全性考量建議關閉此功能,預設為 yes。
PermitRootLogin yes

# 此選項用以指定哪些使用者才可使用 SSH。
AllowUsers username

免密碼登錄

依照上面步驟安裝設定完成後,ssh 已可登入使用。但每次登入均需打一長串的密碼,實在不方便,且安全性上也較差。
dsa key

在本機執行以下指令產生dsa key:
# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jouston/.ssh/id_rsa): [RETURN]
Enter passphrase (empty for no passphrase): [RETURN]
Enter same passphrase again: [RETURN]
Your identification has been saved in /home/jouston/.ssh/id_rsa.
Your public key has been saved in /home/jouston/.ssh/id_rsa.pub.
The key fingerprint is: aa:aa:aa:……:aa jouston@jouston.no-ip.com

基本上只需要連續按幾次[RETURN](就是鍵盤的[ENTER]鍵)

好了, 我們做到這一步已經弄到key了. 接下來需要把dsa.pub複製到遠端的伺服器:

# scp ~/.ssh/dsa.pub 10.1.1.1:.ssh/authorized_keys

搞定收工.

另外, 如果有多台機器要這樣免密碼登入的話, 你可以把後來的key在遠端機器那裡這麼作:

# cat dsa.pub » authorized_keys

直接附加上去就可以了

neio 發表在 痞客邦 留言(0) 人氣()

 Dovecot 是目前大部分 Linux 內定的 POP3/IMAP Server,其特點為高度安全性與設定簡易;不論是小型郵件系統或是大型郵件伺服器都適合使用。 在 Debian 中安裝好後僅需簡單設定即可使用。
安裝

以下安裝指令會安裝 POP3 與 IMAP 兩種協定。

$ sudo aptitude install dovecot-common dovecot-imapd dovecot-pop3d

設定

dovecot 設定檔為 /etc/dovecot/dovecot.conf

# 設定支援哪些協定,在此為 IMAP 與 POP3 兩個
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps
protocols = imap pop3

# 設定監聽的 ip 與 port,可個別指定 imap 與 pop3 的監聽介面
# If you want to specify ports for each service, you will need to configure
# these settings inside the protocol imap/pop3 { ... } section, so you can
# specify different ports for IMAP/POP3. For example:
#   protocol imap {
#     listen = *:10143
#     ssl_listen = *:10943
#     ..
#   }
#   protocol pop3 {
#     listen = *:10100
#     ..
#   }
listen = *

# 設定啟動認證 
# Disable LOGIN command and all other plaintext authentications unless
# SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP
# matches the local IP (ie. you're connecting from the same computer), the
# connection is considered secure and plaintext authentication is allowed.
disable_plaintext_auth = no

# 認證機制
# Space separated list of wanted authentication mechanisms:
#   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
# NOTE: See also disable_plaintext_auth setting.
mechanisms = plain login

mbox vs maildir

mbox 格式將每個資料夾視為一個檔案,該資料夾內的所有信件都存放於該單一檔案中。 maildir 與 mbox 格式不同處為 maildir 將每封 mail 視為一個檔案並儲存,理論上當 mail 數量大到一定程度後,其存取速度、損毀機會都遠較 mbox 來的好。

Dovecot 預設為 mbox 信件儲存格式,若要更改為 maildir 須於設定檔修改如下:

# See /usr/share/doc/dovecot-common/wiki/Variables.txt for full list. Some
# examples:
#
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# <doc/wiki/MailLocation.txt>
#
mail_location = maildir:~/Maildir

MTA 部份也必須跟著設定,最後重新起動即可;dovecot 會在接受到信件時自動建立對應的目錄。
 

neio 發表在 痞客邦 留言(0) 人氣()

環境:
Debian testing (lenny)
Windows 2000 server (ip 192.168.111.2,hp LaserJet 1000)

Debian 套件庫的 HP 驅動程式有問題,會無法正常使用印表機。
改用 foo2zjs 並照著 http://foo2zjs.rkkda.com/INSTALL 的安裝教學,
大致上跟著 run 一次應該就能正確的安裝好驅動程式,如下:

$ wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
$ tar zxf foo2zjs.tar.gz
$ cd foo2zjs
$ sudo make
$ ./getweb 1000
$ sudo make install
$ sudo make install-hotplug

安裝過程中若有遇到缺少的程式、套件就先安裝好後再來一次,
如無意外應都能正常安裝完畢。

接著使用 cups 來安裝印表機 (使用者需要加入 lpadmin 群組或是擁有 root 密碼):

先用 smbclient 查詢遠端分享的印表機
$smbclient -L 192.168.111.2
Domain=[SHARE] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]

    Sharename       Type      Comment
    ---------       ----      -------
    share          Disk    
    IPC$            IPC       遠端 IPC
    D$              Disk      預設共用
    print$          Disk      印表機驅動程式
    hpLaserJ        Printer   hp LaserJet 1000

記下印表機的 Sharename,
然後開啟瀏覽器輸入網址 http://localhost:631,
點選 Administration > Add Printer,
照著畫面指示輸入 Name、Location、Description 等資訊,
接下來 Device 的部份請選 Windows Printer via Samba,
再來 Device URI 依照『smb://使用者名稱:密碼@遠端 IP/分享印表機名稱』的格式輸入。
ex smb://user:1234@192.168.111.2/hpLaserJ,這邊的帳號密碼是指登入遠端主機的。
最後會詢問本機的帳號密碼,輸入後即安裝完畢。

 

neio 發表在 痞客邦 留言(0) 人氣()

# for skype
#deb http://download.skype.com/linux/repos/debian/ stable non-free

# for win32codecs
deb http://www.debian-multimedia.org lenny main

# for virtualbox
deb http://www.virtualbox.org/debian etch non-free

# for Beryl
#deb http://debian.beryl-project.org/ etch main
#deb-src http://debian.beryl-project.org/ etch main

# for gcin
deb http://www.calno.com unstable main
deb-src http://www.calno.com unstable main

# Swiftfox
# http://getswiftfox.com/
deb http://getswiftfox.com/builds/debian unstable non-free

neio 發表在 痞客邦 留言(0) 人氣()

find 功能強大的檔案搜尋指令。

用法:find [路徑...] [表達式]

預設路徑為目前的目錄,預設的表達式是 -print
表達式可以包括運算子、選項、測試和操作模式:

以下的運算子優先次序由高至低排列;如果沒有運算子,則會假設為 -and :
      ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
      EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2

位置選項 (邏輯值永遠為 true): -daystart -follow -regextype

一般選項 (邏輯值永遠為 true,必須加在其它表達式之前):
      -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
      --version -xdev -ignore_readdir_race -noignore_readdir_race

測試 (N 可以有或沒有正負號): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
      -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
      -used N -user NAME -xtype [bcdpfls]

操作模式: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;



範例:
find / -name *.* -exec grep -l "Apache"
將搜尋整個 / 目錄下所有檔案內容有 Apache 字串的檔案並顯示檔案名稱。

neio 發表在 痞客邦 留言(0) 人氣()

遠端桌面登錄 tsclient
sudo aptitude install tsclient

網頁瀏覽器 iceweasel
sudo aptitude install iceweasel-l10n-zh-tw

mp3 音樂播放 xmms

語音通訊  skype
wget http://www.skype.com/go/getskype-linux-deb
sudo aptitude qt3-qtconfig libstdc++5
sudo dpkg -i skype_debian-1.3.0.53-1_i386.deb


3D 桌面管理 Beryl
圖形系統管理介面 webmin


掛載 NTFS 檔案系統
sudo aptitude install smbfs
"echo //192.168.111.2/d$    /mnt/share    smbfs    username=neio,password=neio,iocharset=utf8,codepage=cp950,ro    0    0 >> /etc/fstab"





neio 發表在 痞客邦 留言(0) 人氣()

安裝好基本的系統環境後,把網路環境設定好。
接著新增安裝來源到  /etc/apt/sources.list:

sudo vim /etc/apt/sources.list

然後加入下面這段

------分隔線-----------------
# debian mirror - taiwan
deb http://ftp.tw.debian.org/debian etch main contrib non-free
deb-src http://ftp.tw.debian.org/debian etch main contrib non-free
------分隔線-----------------

這是台灣的 Debian 官方  mirror 站台。
然後跑一下 update 後就可以準備開始安裝。

sudo aptitude update

首先把 xorg xfce 兩個先裝起來,基本的 xwindow 環境就有了。

sudo aptitude install xorg xfce4

接著把 xwindow 設定一下,順便弄好中文介面。
首先開啟 /etc/X11/xorg.conf 編輯一下顯卡的設定,
這邊以 ATI X700 顯卡為設定對象。
(若無自動安裝顯卡驅動 ATI 顯卡建議使用 xserver-xorg-video-ati)

sudo vim /etc/X11/xorg.conf

尋找 Section "Device" 區段,然後更改如下:
------分隔線-----------------
        Driver          "radeon"
        Option          "XAANoOffscreenPixmaps" "true"
        Option          "AddARGBGLXVisuals"     "true"
        Option          "AllowGLXWithComposite" "true"
        Option          "EnablePageFlip"        "true"
        Option          "DRI"                   "true"
        Option          "ColorTiling"           "true"
        Option          "AccelMethod"           "XAA"
        Option          "RenderAccel"           "true"
------分隔線-----------------

接著尋找 Section "ServerLayout" 區段並新增:
------分隔線-----------------
        Option          "AIGLX"         "on"
------分隔線-----------------

並在檔案最後加上下面區段:
------分隔線-----------------
Section "Extensions"
        Option  "Composite"     "Enable"
EndSection
------分隔線-----------------

OK,至此顯卡的設定部份已完成,
其中部份參數為將來安裝 Beryl 所需。

接下來下載中文字型,建議不需安裝官方來源的文鼎字型,
改由 Opendesktop 字型替代更為美觀。
ftp://ftp.opendesktop.org.tw/odp/ODOFonts/OpenFonts
下載 opendesktop-fonts-1.4.2.tar.gz,
解壓縮將所得到的 .ttf 與 .ttc 檔案複製到字型目錄裡。

"wget ftp://ftp.opendesktop.org.tw/odp/ODOFonts/OpenFonts/
opendesktop-fonts-1.4.2.tar.gz"
"tar -xzf
opendesktop-fonts-1.4.2.tar.gz"
"sudo mkdir /usr/share/fonts/truetype/openfonts"
"sudo cp opendesktop-fonts-1.4.2/*.ttf /usr/share/fonts/truetype/openfonts/"
"sudo cp opendesktop-fonts-1.4.2/*.ttc /usr/share/fonts/truetype/openfonts/"

這樣便安裝
「文鼎PL新中楷」與「文鼎PL新宋」字型。
接著另外安裝一下文泉驛中文點陣字型與 unifont,
這在一些需要點陣字型的程式中會較美觀 Ex. qt/Gtk。

sudo aptitude install xfonts-wqy unifont

最後下個  sudo fc-cache -v -f  把剛剛安裝的字型掛上就好了。
安裝好中文字型接著就是中文輸入法,這邊以 scim 的新酷音輸入法為主。

sudo aptitude install scim-chewing

這樣整體上基本的中文桌面環境就大致上完成,
剩下的就是依照個人需求安裝所需的程式了。


附註:於 scim 中安裝嘸蝦米輸入法
必須要有
嘸蝦米的輸入法表格,可於所購買的嘸蝦米輸入法磁片中獲得,
複製出 unix 目錄中的 liu5.cin 到 home 目錄中,然後執行下面動作:

iconv -f big5 -t utf8 liu5.cin -o liu5.cin.utf8

然後修改 liu5.cin.utf8 的檔案內容,
從檔案一開頭至  %chardef begin 這一行為止全部刪除以下面取代:

------分隔線-----------------
### 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/liu5.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,2,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
------分隔線-----------------

接著將檔案結尾最後一行的 %chardef end 取代成為  END_TABLE,
然後存檔,再執行下面指令:

sudo aptitude install scim-modules-table
sudo scim-make-table  liu5.cin.utf8 -b -o liu5.bin

最後在 scim 的設定視窗中->泛用對照表->管理對照表,
點選安裝按鈕,然後選取剛才所產生的 liu5.bin 即可安裝完成。
完成後必須重新啟動 scim 就可以正常使用
嘸蝦米。


 

neio 發表在 痞客邦 留言(0) 人氣()

上個月 Debian 發佈新版本 4.0 代號 etch,
真是個劃時代的版本,果然期待是值得的。

新版本安裝 Debian 變得越來越容易了,
且多語系的 GUI 安裝介面也做的不錯,
可惜無法直接支援 ADSL 安裝方式,
需先安裝 Base-System 後再靠 pppoe 安裝。

4.0 包含的 X11 已升級為 X.Org 7.1,
安裝設定上幾乎不太會有問題與難搞,
且掛載 Beryl 3D 桌面也超 Easy,
唯一的問題在於對顯卡驅動上的問題!

對於中文的支援上面也是越來越棒了,
以前令人詬病的中文字型問題,
也在一些熱心的前輩貢獻下,獲得良好解決。
特別像是螢火飛、文泉驛字型等。

對於 APT 的強大功能真是越來越欣賞,
電腦就是要這樣用嘛,想要啥就 APT 一下就好啦!
目前將整個作業環境換到 Debian 後,
感覺挺不賴,除了沒有好用的 MSN 外﹍XD

neio 發表在 痞客邦 留言(0) 人氣()

ADSL撥接設定

網卡設定檔:
/etc/network/interfaces

—interfaces—————————————
#啟動eth0這張網卡
auto eth0
#設定eth0為靜態ip
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0

#如果要用ADSL撥接,則gateway不能設定!
gateway 192.168.0.254
network 192.168.0.0
—interfaces—————————————

neio 發表在 痞客邦 留言(0) 人氣()