Config HOWTO 系統(tǒng)設(shè)置 (2)
2024-07-26 00:30:57
供稿:網(wǎng)友
--------------------------------------------------------------------------------
4. 軟件設(shè)置
下列設(shè)置檔必需加以設(shè)定:/etc/PRofile /etc/bashrc .bashrc .bashrc .bash_profile .bash_logout .inputrc .less .lessrc .xinitrc .fvwmrc .fvwm2rc95 .Xmodmap .Xmodmap.num .Xdefaults .jedrc .abbrevs.sl .joerc .emacs . 在完成系統(tǒng)設(shè)定以前不要增添用戶;需要將點(diǎn)文檔(dot files)放入/etc/skel。
4.1 bash(1)
有人認(rèn)為,這個(gè)軟件是除內(nèi)核之外最重要的軟件。要使bash適合個(gè)人口味,可修改下列文檔:
/etc/bashrc 存有整個(gè)系統(tǒng)的別名和功能;
/etc/profile 存有整個(gè)系統(tǒng)的環(huán)境參數(shù)和啟動(dòng)程式;
$HOME/.bashrc 存有用戶的的別名和功能;
$HOME/.bash_profile 存有用戶的環(huán)境參數(shù)和啟動(dòng)程式;
$HOME/.inputrc 存有主要綁定數(shù)值和其他位元數(shù)值;
下文例舉對這些文檔的修改。首先,最重要的文檔是:/etc/profile。以下幾節(jié)中可以看到,修改這個(gè)文檔可以設(shè)定 linux 的各種功能。
--------------------------------------------------------------------------------
# /etc/profile
# System wide environment and startup programs
# --整個(gè)系統(tǒng)環(huán)境和啟動(dòng)程式
#
# Functions and aliases go in /etc/bashrc
# --/etc/bashhrc中包含功能和別名
#
# This file sets up the following features and programs:
# --這個(gè)文檔設(shè)定下列功能:
#
# o path --路徑
# o prompts --提示符
# o a few environment variables --幾個(gè)環(huán)境變數(shù)
# o colour ls --ls 的顏色
# o less behaviour --設(shè)定less的功能
# o rxvt
#
# Users can override these settings and/or add others in their
# $HOME/.bash_profile
# 用戶可在 $HOME/.bash_profile 中取消這些設(shè)定和(或)增加其他設(shè)定
# set a decent path
# 設(shè)定可行的路徑
PATH="$PATH:/usr/X11R6/bin:$HOME/bin:."
# notify the user: login or non-login shell. If login, the prompt is
# coloured in blue; otherwise in magenta. Root's prompt is red.
# See the Colour-ls mini HOWTO for an explanation of the escape codes.
# 通知用戶:登錄(login)或不登錄(non-login)的外圍程序(shell)。
# 如果登錄,則提示符為藍(lán)色,否則為紫紅色。Root的提示符為紅色。
# 參閱Colour-ls mini HOWTO 中對換碼符(escape codes)的使用解釋。
USER=`whoami`
if [ $LOGNAME = $USER ] ; then
COLOUR=44 # blue --藍(lán)色
else
COLOUR=45 # magenta --紫紅色
fi
if [ $USER = 'root' ] ; then
COLOUR=41 # red --紅色
PATH="$PATH:/usr/local/bin"
fi
ESC="/033"
PROMPT='/h' # hostname --主機(jī)名
STYLE=';1m' # bold --粗體
# PROMPT='/u' # username --用戶名
# STYLE='m' # plain --一般字體
PS1="/[$ESC[$COLOUR;37$STYLE/]$PROMPT:/[$ESC[37;40$STYLE/]/w//$ "
PS2="> "
# no core dumps, please
# 請勿轉(zhuǎn)儲(chǔ)內(nèi)存信息
ulimit -c 0
# set umask
# 設(shè)定umask
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
umask 002
else
umask 022
fi
# a few variables
# 幾項(xiàng)變數(shù)
USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER" # sendmail, postfix, smail
# MAIL="$HOME/Mailbox" # qmail
NNTPSERVER=news.myisp.it # put your own here
VISUAL=jed
EDITOR=jed
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
HISTFILESIZE=1000
export PATH PS1 PS2 USER LOGNAME MAIL NNTPSERVER
export VISUAL EDITOR HOSTNAME HISTSIZE HISTFILESIZE
# enable colour ls
# 設(shè)定ls的顏色
eval `dircolors /etc/DIR_COLORS -b`
export LS_OPTIONS='-s -F -T 0 --color=yes'
# customize less
# 設(shè)定less
LESS='-M-Q'
LESSEDIT="%E ?lt+%lt. %f"
LESSOPEN="| lesspipe.sh %s"
LESSCHARDEF=8bcccbcc13b.4b95.33b. # show colours in ls -l | less
# LESSCHARSET=latin1
PAGER=less
export LESS LESSEDIT LESSOPEN VISUAL LESSCHARDEF
# fix the backspace key in rxvt/xterm
# 設(shè)定rxvt/xterm中的退後鍵
CTRL_H="/010"
NULL_STRING=" $CTRL_H" # space + backspace
if [ "$NULL_STRING" != "" ] ; then
stty erase ^?
else
stty erase ^H
fi
# set xterm title: full path
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "/033]0;${USER}@${HOSTNAME}: ${PWD}/007"'
;;
esac
for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i # beware - variables and aliases might get overridden!
fi
done
# call fortune, if available --如有fortune
if [ -x /usr/games/fortune ] ; then
echo ; /usr/games/fortune ; echo
fi
--------------------------------------------------------------------------------
此處為 /etc/bashrc:
--------------------------------------------------------------------------------
# /etc/bashrc
# System wide functions and aliases
# 整個(gè)系統(tǒng)的功能和別名
#
# Environment stuff goes in /etc/profile
# /etc/profile中的環(huán)境參數(shù)
#
# Insert PS1 definitions here if you experience problems.
# 如有問題可將PS1的參數(shù)放在此處
export CDPATH="$CDPATH:
# common aliases --共同別名
alias cp='cp -i'
alias l=less
alias ls="ls $LS_OPTIONS"
alias mv='mv -i'
alias rm='rm -i'
alias rmbk='/bin/rm -f .*
alias u='cd ..'
alias which="type -path"
alias x=startx
# A few useful functions --幾項(xiàng)有用的功能
c () # cd to the new directory and list its contents
{
cd $1 ; ls
}
inst() # Install a .tar.gz archive in current directory --在當(dāng)前目錄中建立.tar.gz儲(chǔ)存庫
{
if [ $# != 0 ]; then tar zxvf $1; fi
}
cz() # List the contents of a .zip archive --列出.zip的內(nèi)容
{
if [ $# != 0 ]; then unzip -l $*; fi
}
ctgz() # List the contents of a .tar.gz archive --列出.tar.gz的內(nèi)容
{
for file in $* ; do
tar ztf ${file}
done
}
tgz() # Create a .tgz archive a la zip. --建立壓縮檔.tgz
{
if [ $# != 0 ]; then
name=$1.tar; shift; tar -rvf ${name} $* ; gzip -9 ${name}
fi
}
crpm() # list information on an .rpm file --列出.rpm檔的內(nèi)容
{
if [ $# != 0 ]; then rpm -qil $1 | less; fi
}
--------------------------------------------------------------------------------
此處為 .bashrc:
--------------------------------------------------------------------------------
# $HOME/.bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# this is needed to notify the user that they are in non-login shell
# 需要以下設(shè)定,以便通知處於不登錄(non-login)外圍程序(shell)中的用戶
if [ "$GET_PS1" = "" ] ; then
COLOUR=45; ESC="/033"; STYLE=';1m'; # STYLE='m'
USER=`whoami`
export PS1="/[$ESC[$COLOUR;37$STYLE/]$USER:/[$ESC[37;40$STYLE/]/w//$ "
fi
# personal aliases
# 個(gè)人別名
alias backup='tar -Mcvf /dev/fd0'
alias dial='eznet up myisp'
alias f='cd
alias hangup='eznet down'
alias lyx='lyx -width 580 -height 450'
alias restore='tar -M -xpvf /dev/fd0'
# personal functions
# 幾個(gè)個(gè)人使用的功能
xj() # Launch xjed and a file in background --在背景啟動(dòng)xjed和文檔
{
xjed $1 &
}
--------------------------------------------------------------------------------
此處為.bash_profile:
--------------------------------------------------------------------------------
# $HOME/.bash_profile
# User specific environment and startup programs
# 用戶特定的環(huán)境參數(shù)和啟動(dòng)程式
#
# This file contains user-defined settings that override
# those in /etc/profile
# 這個(gè)文檔中存有用戶自訂的設(shè)置,可取代/etc/profile 中的數(shù)值
#
# Get aliases and functions
# 設(shè)定別名和功能
#
if [ -f then
GET_PS1="NO" # don't change the prompt colour --不改變提示符的顏色
.
fi
# set a few `default' directories
# 設(shè)定幾個(gè)“默認(rèn)”目錄
export CDPATH="$CDPATH:$HOME:$HOME/text:$HOME/text/geology"
--------------------------------------------------------------------------------
此處為 .inputrc:
--------------------------------------------------------------------------------
# $HOME/.inputrc
# key bindings
# 主要綁定
"/e[1
"/e[3
"/e[4
# (F1 .. F5) are "/e[[A" ... "/e[[E"
# (F1 .. F5) 分別為 "/e[[A" ... "/e[[E"
"/e[[A": "info /C-m"
set bell-style visible # please don't beep
# 喇叭不發(fā)聲
set meta-flag On # allow 8-bit input (i.e, accented letters)
# 允許8-位元輸入(例如重音字符)譯注:用于歐洲
set convert-meta Off # don't strip 8-bit characters
# 不取消8-位元字符
set output-meta On # display 8-bit characters correctly
# 正確顯示8-位元字符
set horizontal-scroll-mode On # scroll long command lines
# 長指令行自動(dòng)翻轉(zhuǎn)
set show-all-if-ambiguous On # after TAB is pressed
# 按TAB鍵
--------------------------------------------------------------------------------
設(shè)定下列參數(shù)使 backspace 和 delete 兩鍵在xterm 和其他X11應(yīng)用中運(yùn)作正常:
在.xinitrc中添加:
usermodmap=$HOME/.Xmodmap
xmodmap $usermodmap
在.Xmodmap中添加:
keycode 22 = BackSpace
keycode 107 = Delete
以上就設(shè)定了主控臺(tái)的參數(shù)。要修改xterm,則更改如下:
在.Xdefaults中增添:
xterm*VT100.Translations: #override BackSpace: string(0x7F)/n/
Delete: string(0x1b) string("[3
Home: string(0x1b) string("[1
End: string(0x1b) string("[4
CtrlPrior: string(0x1b) string("[40
CtrlNext: string(0x1b) string("[41
nxterm*VT100.Translations: #override BackSpace: string(0x7F)/n/
Delete: string(0x1b) string("[3
Home: string(0x1b) string("[1
End: string(0x1b) string("[4
CtrlPrior: string(0x1b) string("[40
CtrlNext: string(0x1b) string("[41
rxvt的問題比較復(fù)雜,因?yàn)樵诰庉嫊r(shí)的一些設(shè)定會(huì)影響它的功能。參看上文 /etc/profile部分。
在bash(1) 和 readline(3) 的 man 說明中有更多這方面的資料。
不要以為這些設(shè)定在每種應(yīng)用中都可正常運(yùn)作。例如,在xterm中運(yùn)行joe,有些鍵位就不起作用;運(yùn)行rxvt也有相同的問題。
4.2 ls(1)
ls可用顏色顯示目錄,突出不同種類的文檔。如上文所示,要使用這項(xiàng)功能,只要在 /etc/profile 增加幾行內(nèi)容即可。不過,這對有些版本的rxvt不起作用;得使用 xterm 替代。看來一些老版本的rxvt有設(shè)計(jì)不全之處,以致在有些情況下無法正確使用環(huán)境參數(shù)。
Caldera版本的ls不顯示顏色,但它有一個(gè)類似的color-ls。將以下內(nèi)容加到 /etc/bashrc:
alias ls="color-ls $LS_OPTIONS"
4.3 less(1)
利用這個(gè)優(yōu)越的頁面調(diào)度程序不僅能瀏覽一般文字文檔,也能觀看壓縮的 gzip 文檔和以 tar 和 zip 格式儲(chǔ)存的檔案文檔和 man 文檔,其設(shè)置如下:
如要配合使用方向鍵,則將以下以ASCII編寫的一般文字檔.lesskey 置于home目錄內(nèi):
^[[A back-line
^[[B forw-line
^[[C right-scroll
^[[D left-scroll
^[OA back-line
^[OB forw-line
^[OC right-scroll
^[OD left-scroll
^[[6
^[[5
^[[1
^[[4
^[[7
^[[8
然後運(yùn)行指令lesskey。(這是類似vt100型終端機(jī)的換碼符)。這會(huì)生成綁定鍵位的二進(jìn)制文檔 .less。
編制下列稱為w /usr/local/bin/lesspipe.sh的文檔:
--------------------------------------------------------------------------------
#!/bin/sh
# This is a preprocessor for 'less'. It is used when this environment
# variable is set: LESSOPEN="|lesspipe.sh %s"
# 此為‘less’的預(yù)處理器。當(dāng)環(huán)境參數(shù)定為LESSOPEN="|lesspipe.sh %s"
# 時(shí),便起用這個(gè)預(yù)處理器。
lesspipe() {
case "$1" in
*.tar) tar tf $1 2>/dev/null ;; # View contents of .tar and .tgz files
# 閱讀.tar和.tgz檔的內(nèi)容
*.tgz|*.tar.gz|*.tar.Z|*.tar.z) tar ztf $1 2>/dev/null ;;
*.Z|*.z|*.gz) gzip -dc $1 2>/dev/null ;; # View compressed files
correctly
# 正確閱讀壓縮文檔
*.zip) unzip -l $1 2>/dev/null ;; # View archives
# 閱讀檔案文檔
*.arj) unarj -l $1 2>/dev/null ;;
*.rpm) rpm -qpil $1 2>/dev/null ;;
*.cpio) cpio --list -F $1 2>/dev/null ;;
*.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.l|*.man) FILE=`file -L $1`
FILE=`echo $FILE | cut -d ' ' -f 2`
if [ "$FILE" = "troff" ]; then
groff -s -p -t -e -Tascii -mandoc $1
fi ;;
*) file $1 | grep text > /dev/null ;
if [ $? = 1 ] ; then # it's not some kind of text
strings $1
fi ;;
esac
}
lesspipe $1
--------------------------------------------------------------------------------
然後運(yùn)行chmod 755 lesspipe.sh,使其成為可執(zhí)行檔。
按照上文將必要的變數(shù)放入/etc/profile。
4.4 emacs(1) 文本編輯器
由于我不太用emacs,因此心得不多。有些emacs 版本沒有預(yù)先設(shè)置顏色和語法標(biāo)示。可在.emacs中增添:
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
這只對X11有用。如需使用重音符號,可增加此行:
(standard-display-european 1)
我讓您自己從關(guān)於emacs的文件資料中尋找設(shè)定符合您的需要的方法,有時(shí)這需要幾個(gè)月的時(shí)間。點(diǎn)文檔產(chǎn)生器( 設(shè)置軟件)可以幫些忙。
4.5 joe(1) 文本編輯器
有些joe的版本不在主控臺(tái)顯示顏色,并且有些特殊鍵位不起作用。解決這項(xiàng)問題的最快方法是:
(譯注:原文似乎有漏)
要使特殊鍵位發(fā)生作用,只要修改.joerc、.jstarrc或喜愛的仿真設(shè)定;首先改變/usr/lib/joe中的設(shè)置文檔。利用第四部分(鍵位梆定)設(shè)定Home和 End兩鍵。
bol ^[ [ 1
eol ^[ [ 4
找出ESC的次序,鍵入cat,然後再鍵入特殊鍵。
4.6 jed(1) 文本編輯器
這是相當(dāng)好用的編輯器:比emacs短小精悍,也宜於設(shè)定,使用方式也與其他編輯器十分類似。我們大學(xué)的許多用戶都用jed替代VMS的系統(tǒng)編輯器EDT。
jed的設(shè)置文檔為 .jedrc和/usr/lib/jed/lib/*;前者可從後者目錄中的jed.rc修改而得。
要使jed的特殊鍵位設(shè)置正確,編制/usr/lib/jed/lib/defaults.sl檔,其內(nèi)容如下:
() = evalfile(" Linux ");
如果xjed不識(shí)別DEL鍵,則在.jedrc中增加下列內(nèi)容:
#ifdef XWINDOWS
x_set_keysym (0xFFFF, 0, "/e[3
setkey (``delete_char_cmd'', "/e[3
#endif
編輯/usr/lib/jed/lib/ Linux .sl,設(shè)定Info_Directory = "/usr/info";并在/UCB_Mailer = "/bin/mail";后添加/bin/mail;
設(shè)置jed模擬EDT(或其他編輯器)的工作不難:只須編輯 .jedrc 中的幾行內(nèi)容。 如果要用小鍵盤中的‘+’鍵刪字,而不只刪一個(gè)字母,則在.jedrc中() = evalfile("edt")(或類似的設(shè)定)之後增添下列內(nèi)容:
unsetkey("/eOl");
unsetkey("/eOP/eOl");
setkey("edt_wdel", "/eOl");
setkey("edt_uwdel", "/eOP/eOl");
在EDT模擬中,要使xjed使用數(shù)字小鍵盤,則須在 .Xmodmap 中添加下列內(nèi)容:
keycode 77 = KP_F1
keycode 112 = KP_F2
keycode 63 = KP_F3
keycode 82 = KP_F4
keycode 86 = KP_Separator
在.Xdefaults中增加以下內(nèi)容可以更改xjed的顏色:
xjed*Geometry: 80x32+150+50
xjed*font: 10x20
xjed*background: midnight blue
# and so on...
設(shè)定“簡稱表”可節(jié)省許多時(shí)間。編輯一個(gè)稱為 $HOME/.abbrevs.sl 的程序(如要改變名稱,可在.jedrc中插入variable Abbrev_File = "/usr/lib/jed/abbrev.sl";):
create_abbrev_table ("Global", "0-9A-Za-z");
define_abbrev ("Global", "GG", "Guido Gonzato");
create_abbrev_table ("TeX", "http://A-Za-z0-9");
define_abbrev ("TeX", "http://beq", "http://begin{equation}");
define_abbrev ("TeX", "http://eeq", "http://end{equation}");
% and so on...
并鍵入ESC x abbrev_mode使其運(yùn)行。如要自動(dòng)運(yùn)行簡稱功能,將下列內(nèi)容加入 .jedrc:
define text_mode_hook ()
{
set_abbrev_mode (1);
}
%
define fortran_hook ()
{
set_abbrev_mode (1);
use_abbrev_table ("Fortran");
}
% and so on...
4.7 pine(1) 郵件閱讀器
修改/usr/lib/pine.conf中涉及整個(gè)系統(tǒng)的設(shè)置,特別注意: user-domain、smtp-server和nntp-server。同時(shí)注意 inbox-path取決于使用何種 MTA:如使用 sendmail 或 postfix,則為 var/spool/mail/$USER;如使用 Qmail,則為 /home/$USER/Mailbox (但 root 使用 /usr/lib/pine.conf)。
4.8 minicom(1)
除非 root 修改影響整個(gè)系統(tǒng)的設(shè)置,否則用戶無法使用 minicom。記住修改。
4.9 efax(1) 軟件
可能這是一套最容易收發(fā)傳真(fax)的軟件。只要修改 /usr/bin/fax 內(nèi)的指令即可;修改不難,但有些小地方卻需注意:
利用 at+fclass=? 指令找出系統(tǒng)內(nèi)的數(shù)據(jù)機(jī)的級別為 class 1、2或2.0型。系統(tǒng)的回覆可能為 0,1,2;1 和 2 表示數(shù)據(jù)機(jī)支持的級別;
DIALPREFIX: 單單使用“T”或“P”可能不適用于有些國家(至少不適用于義大利)。改用 “ATDT”或“ATDP”撥號;
INIT and RESET: efax 需要起始參數(shù) “-i”和 “-k”。如需使用 AT 指令,則將其從指令中消除,并以 “-i” 或 “-k”替代。例如:在 INIT 中使用 “ATX3” 指令,則加入 “-iX3”即可。
完成這項(xiàng)設(shè)置後,還要設(shè)置幾項(xiàng)使用者的權(quán)限設(shè)定,這樣非 root 的使用者才能收發(fā)傳真。首先要使 /var/lock 和 /var/spool/fax 成為可寫目錄。要完成這項(xiàng)工作,不妨設(shè)立 faxusers 群組,將使用者加入其中,然後以下列指令改變屬性:
chmod g+w /var/spool/fax
4.10 Ghostscript
這個(gè)有用的軟件有點(diǎn)小問題。因?yàn)槊绹某隹谙拗疲琾df2ps 不能在加密的 .pdf 文檔上使用。解決辦法是將瀏覽器接上 http://www.ozemail.com.au/, 把 pdf_sec.ps 文檔取代 Ghostscript 中的同名文檔即可。
4.11 TeX 的使用
假設(shè) Linux 機(jī)上已安裝了LeTeX。
從最近的鏡像站下載其他與LaTeX有關(guān)的軟件,例如 ftp://ftp.dante.de/pub/tex。將這些文檔放在 /usr/share/texmf/tex/latex 目錄下,然後運(yùn)行指令texhash,使 teTeX知道新軟件的存在;
設(shè)置連字符(hyphenation),則可修改 /usr/share/texmf/tex/generic/config/language.dat檔,然後運(yùn)行:
texconfig hyphen
如要設(shè)定dvips,則需編輯 /usr/share/texmf/dvips/config/config.ps檔。 注意:有關(guān)默認(rèn)分辨率的參數(shù)也影響 xdvi的運(yùn)行;如果每次運(yùn)行時(shí)發(fā)現(xiàn)都要?jiǎng)?chuàng)造字體,則可改動(dòng) .Xdefault的內(nèi)容如下:
XDvi*mfmode:
這應(yīng)有所幫助。
擴(kuò)大TeX的尋找□圍可將子目錄中的PostScript數(shù)字包括再內(nèi)。將下列指令放入 .bash_profile:
export TEXINPUTS="$HOME/figures::./figures"
這使TeX在查找默認(rèn)目錄之前先查找$HOME/figures,并在查找默認(rèn)目錄之後查找 ./figures。
4.12 避免PPP的問題
目前 Linux 的內(nèi)核幾乎都已編入了 PPP + TCP/IP 功能,設(shè)定了回送地址(loopback)和正確安裝了pppd軟件和作為suid root。當(dāng)然,ISP 得支持PPP。目前有兩種方式可使 PPP 正常運(yùn)作:(a)手動(dòng)設(shè)定;和(b)利用一個(gè)程式自動(dòng)設(shè)定。不論采用何種方式,均請收集下列資料:
ISP的電話號碼
ISP的名字、郵件和新聞服務(wù)器的地址
ISP的域名
用戶名字和密碼
手動(dòng)設(shè)置是件單調(diào)無聊、十分乏味的事。雖然涉及的工作無非是修改文檔和編輯腳本,并不麻煩,但極易出錯(cuò),新手往往不敢輕易□試。幸好有 PPP HOWTO 可以參考。此外,也有工具可以使用,輸入上述資料,然後自動(dòng)為您設(shè)置。 Gnome和KDE兩套軟件中分別包括了gnome-ppp和kppp兩個(gè)工具,方便安裝PPP,令人十分感激。此外,也不妨使用在主控臺(tái)上操作的工具wvdial和eznet。只要提供ISP的電話號碼、用戶姓名、密碼,就聯(lián)網(wǎng)上路了。它們的網(wǎng)頁是 http://www.worldvisions.ca/wvdial和 http://www.hwaci.com/sw/eznet,不妨試用。這兩個(gè)工具都十分好用,也需後者更方便一些。
使用eznet
首先,建立一個(gè)文檔/etc/resolv.conf,內(nèi)容如下:
nameserver w.x.y.z
其中填入您使用的ISP的域名伺服器(nameserver)的地址。要利用eznet建立帳戶,可使用下列指令:
#(譯注:原文有漏)
這會(huì)產(chǎn)生一個(gè)屬於root的文檔/var/eznet/eznet.conf,使用權(quán)限為600;如要讓大家都能使用,用chmod將其改為666。利用eznet up YOUR_ISP撥號給ISP。如果數(shù)據(jù)機(jī)一直等待電話的接撥信號,無法接通,試試下列指令:
#(譯注:原文有漏)
要掛斷電話,只要發(fā)出eznet down指令。不是十分簡單嗎!
使用wvdial
wvdial的設(shè)置甚至更短。鍵入wvdialconf /etc/wvdial.conf,然後修改這個(gè)文檔使其列入用戶姓名、密碼和電話號碼。用wvdial試撥,希望一切順利。要斷線,用 Ctrl-C即可。
4.13 POP用戶端程序
要從POP伺服器收取郵件,可使用POP用戶端程序,如fetchpop或 fetchmail等;後者比較先進(jìn),但需要運(yùn)行sendmail。這對低檔電腦而言,似乎是多此一舉。這些軟件可從 ftp://metalab.unc.edu/pub/ Linux /system/mail/pop得到。
設(shè)置用戶端的程式如下:
fetchpop:在第一次運(yùn)行這個(gè)軟件時(shí)會(huì)要求輸入一些資料。只要回答所有問題即可。如果ISP的POP3伺服器不能正確執(zhí)行LAST指令,在使用fetchpop時(shí)必需加附參數(shù)-r
fetchmail:修改.fetchmailrc如下:
# $HOME/.fetchmailrc
poll mbox.myisp.com with protocol pop3;
user john there with passWord _Loo%ny is john here
有個(gè)用戶指出在第二行中增加“smtphost localhost”能大大改善運(yùn)行速度。 必須運(yùn)行chmod 600 .fetchmailrc設(shè)定此檔的使用權(quán)限,否則fetchmail會(huì)完全拒絕運(yùn)行。這個(gè)例子只是一種非常基本的設(shè)定,還有其他各種可能設(shè)定的辦法, 可參看 http://www.ccil.org/。
4.14 X 視窗系統(tǒng) (XFree86)
設(shè)定X伺服器
歸根結(jié)底,設(shè)定X伺服器已經(jīng)沒有以前那麼困難。所有版本的 Linux 現(xiàn)在都包括了設(shè)定X11的工具(XConfigurator、sax、XF86Setup 或至少有xf86config)。目前X伺服器的設(shè)置幾乎完全自動(dòng),只是有少數(shù)幾種視像卡可能拒絕工作。在設(shè)定X伺服器時(shí)如遭遇困難,可用下列簡單的方法解決:
確定安裝了通用的VGA伺服器;
連接到 ftp://ftp.XFree86.org/pub/XFree86/current/binaries,cd到適當(dāng)?shù)?nbsp;Linux 子目錄,下載X_version_bin.tgz、X_version_set.tgz和所有伺服器。在其他軟件中,第一個(gè)存檔軟件內(nèi)載有最新的SuperProbe;
將X_version_bin.tgz打開到一個(gè)臨時(shí)目錄,cd到該目錄,然後運(yùn)行 ./SuperProbe。如果這個(gè)程式測得視像卡,那就有可能設(shè)定視像卡。否則就沒有希望;
從/usr/X11R6/安裝各個(gè)伺服器和X_version_set.tgz,然後運(yùn)行 XF86Setup。
這種方法一般都萬無一失,但各人的情況可能不同。X11不開始運(yùn)行的多數(shù)原因是視像器的參數(shù)選擇過高。不妨從比較低的參數(shù)開始,例如選800x600和256色,然後逐步上升。注意:這些操作應(yīng)謹(jǐn)慎小心,可能會(huì)損壞視像器!
數(shù)字小鍵盤
上文已經(jīng)示□如何設(shè)定幾個(gè)特別鍵位。如果使用Xjed,示□文檔.Xmodmap就符合需要,但缺點(diǎn)是無法使用數(shù)字小鍵盤(keypad)。因此需要.Xmodmap.num另作設(shè)定:
! Definitions can be found in
! 在中可找到各項(xiàng)定義
keycode 77 = Num_Lock
keycode 112 = KP_Divide
keycode 63 = KP_Multiply
keycode 82 = KP_Subtract
keycode 86 = KP_Add
keycode 79 = KP_7
keycode 80 = KP_8
keycode 81 = KP_9
keycode 83 = KP_4
keycode 84 = KP_5
keycode 85 = KP_6
keycode 87 = KP_1
keycode 88 = KP_2
keycode 89 = KP_3
keycode 90 = KP_0
keycode 91 = KP_Decimal
確定/etc/X11/XF86Config中不得有下列三行:
ServerNumLock
Xleds
XkbDisable
否則用#注銷。要重新使用數(shù)字小鍵盤,運(yùn)行指令xmodmap .Xmodmap.num。
用xdm圖像登錄
要使用圖像登錄,不妨修改/etc/inittab,使其包含下列內(nèi)容:
x:5:respawn:/usr/bin/X11/xdm -nodaemon
其中5是X11的運(yùn)行級別(runlevel)(S.u.S.E. 用4)。按照下列方法修改默認(rèn)運(yùn)行級別(通常為2或3):
id:5:initdefault:
顏色的數(shù)值設(shè)定于/etc/X11/xdm/Xserver:
:0 local /usr/X11R6/bin/X :0 -bpp 16 vt07 # first X server, 65k colours
:1 local /usr/X11R6/bin/X :1 -bpp 32 vt08 # second X server, true colour
如果已有.xinitrc,將其復(fù)制成.xsession,并運(yùn)行chmod +x .xsession使其成為可執(zhí)行檔。然後運(yùn)行指令telinit 5,那就大功告成了。
視窗管理器
一旦X伺服器能夠無誤地工作,那就有各種組合的設(shè)置;當(dāng)然,這得看用哪種視窗管理器(window manager),目前就有幾十種可選。多數(shù)設(shè)置都是修改一、兩個(gè)主目錄內(nèi)的文本文件(ASCII files);也有根本不需作任何修改的視窗管理器,而用一個(gè)小程式或甚至菜單來管理。
舉例如下:
屬於fvwm家族: 拷貝 /etc/X11/fvwm/system.fvwmrc (或類似的程式)到主目錄, 打開試用。用這種方法可能會(huì)浪費(fèi)不少時(shí)間,不過這樣才會(huì)真正知道它的特性,并了解是否投你所好;
WindowMaker: 它有幾個(gè)設(shè)置文檔,都在 $HOME/GNUstep內(nèi),并有一個(gè)相當(dāng)不錯(cuò)的小程式(applet);
KDE 和 Gnome: 沒有任何修改之處:任何設(shè)定都通過菜單進(jìn)行。
簡言之,如果不在乎修改設(shè)置文檔,可選用icewm、fvwm*、blackbox等;否則就選用目前常見的KDE、Gnome、WindowMaker和XFCE。
應(yīng)該要有一個(gè)好的.xinitrc。舉例如下:
#!/bin/sh
# $HOME/.xinitrc
usermodmap=$HOME/.Xmodmap
xmodmap $usermodmap
xset s noblank # turn off the screen saver -- 關(guān)閉屏幕保護(hù)軟件
xset s 300 2 # screen saver start after 5 min -- 5分鐘之後啟動(dòng)屏幕保護(hù)
xset m 10 5 # set mouse acceleration -- 設(shè)定鼠標(biāo)的速度
rxvt -cr green -ls -bg black -fg white -fn 7x14 /
-geometry 80x30+57+0 &
if [ "$1" = "" ] ; then # default
WINMGR=wmaker
else
WINMGR=$1
fi
$WINMGR
雖然并非必需,但將其變成可執(zhí)行檔chmod +x .xinitrc。
這個(gè) .xinitrc 讓你選用視窗管理器:
$ startx startkde # or other w.m. -- 或其他視窗管理器
(不過它不適用于有些版本的 S.u.S.E.)
X11 應(yīng)用軟件的默認(rèn)值
找出app-defaults的所在位置(應(yīng)該在/usr/X11R6/lib/X11/app-defaults)。有幾個(gè)應(yīng)用軟件的設(shè)置文檔都在這個(gè)目錄內(nèi)。
4.15 使用者的設(shè)置文檔
完成 Dot 文檔的編輯後,將這些設(shè)置文檔按 軟件設(shè)置的方法抄到 /etc/skel。
4.16 制作 .rpm
rpm是一種管理整套軟件的好方法,除非在特殊情況下(安全理由),一般我都不太愿意安裝.tar.gz軟件。要安裝.tar.gz軟件時(shí),不妨將其轉(zhuǎn)換成.rpm檔,然後再安裝;參考RPM HOWTO。此外,在使用比較新的gcc版本時(shí),例如 egcs或pgcc,不妨將下列內(nèi)容加入/etc/rpmrc:
optflags: i386 -O2 -mpentium
4.17 Upgrading
在機(jī)器升級時(shí),應(yīng)首先制作備份,并保存一些重要文檔,其中應(yīng)包括 /etc/X11/XF86Config、/usr/bin/fax和/usr/local 中的所有文檔以及內(nèi)核設(shè)置、全套/etc和/var/spool/mail中的所有郵件。
然後應(yīng)該升級(極少降級)軟件版本附帶的應(yīng)用軟件,和增加應(yīng)用軟件。
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
5. 設(shè)置軟件
有一些程式使 Linux 易于安裝和設(shè)置。有些程式已經(jīng)成為標(biāo)準(zhǔn): Red Hat 和 Caldera 以及一些附帶 setup、printtool、netcfg、usertool的版本, S.u.S.E.奉送整套設(shè)置程序Yast。其他有用的程序包括:
The Dotfile Generator: X視窗的應(yīng)用軟件和模組,以便設(shè)置emacs、bash、procmail等軟件。其網(wǎng)址為 http://www.imada.ou.dk/
Linux conf: 最有用的設(shè)置工具。它能在主控臺(tái)和X下均可運(yùn)行。要查找資料,不妨利用 http://www.solucorp.qc.ca/ Linux conf網(wǎng)址。
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
6. 結(jié)束
6.1 版權(quán)說明(譯者:保留原文)
Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective authors. Linux HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions.
All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at the address given below.
In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTO s.
If you have questions, please contact Tim Bynum, the Linux HOWTO coordinator, at Linux-HOWTO@metalab.unc.edu via email.
6.2 反饋意見
這份 HOWTO 也許比其他 HOWTO 更需要您提出意見和作出評論。我不僅對此表示歡迎,事實(shí)上,這還是必需的。如果您發(fā)現(xiàn)遺漏或錯(cuò)誤,請務(wù)必通知我。如果您使用的版本不同于 Red Hat/Mandrake,并且設(shè)置文檔放置在不同的目錄內(nèi),請通知我,我會(huì)列入您的使用心得。我希望大家使用 Linux 能越方便越好。
Linux 的版本很多,因此不可能羅列所有各種說明。請將您的要求和建議盡量符合最“合理”的程式 - 我留待您自己決定何者為合理的程度。
6.3 免責(zé)聲明Disclaimer
“系統(tǒng)設(shè)置 HOWTO ”是我 Guido Gonzato guido@ibogeo.df.unibo.it編寫的,在此我要感謝所有其他 HOWTO 的作者和 man 說明的作者和(或)管理人員,因?yàn)槲視r(shí)常剽竊他們的心得,實(shí)感汗顏。我并要感謝所有對我的文章提出批評和建議的同好。
這份文件就以以上的內(nèi)容提供給大家。我已盡力使內(nèi)容正確,請各位斟酌使用,但我對大家使用這份文件可能造成的後果不負(fù)任何責(zé)任。
我衷心希望這篇文章對您有用,因?yàn)槲以诎惭b新 Linux 系統(tǒng)時(shí),也都時(shí)時(shí)借助....
希望您用得得心應(yīng)手。
Guido =8-)
--------------------------------------------------------------------------------