Debian
安裝記錄
1.藍(lán)色標(biāo)注是安裝的部分或配置的。
作者:http://www.shnenglu.com/jinglexy上海體育館
2.linux 發(fā)行版測(cè)評(píng)網(wǎng)站:www.distrowatch.com
打印機(jī)支持及驅(qū)動(dòng):www.linuxprinting.org
內(nèi)核下載:www.kernel.org
3.當(dāng)前的發(fā)行版本
stable----->sarge
testing---->etch
unstable--->sid
推薦的安裝版本:etch
4.修復(fù)grub的招數(shù):
grub> root (hd0,3)
grub> setup (hd0)
5.安裝debian基本系統(tǒng):
下載etch 的第一張光盤(pán),完整光盤(pán),這樣可以少到網(wǎng)上找deb源了
vmlinuz和initrd.gz可以用http://debian.cn99.com/的,不要用cd中的isolinux
debian/dists/etch/main/installer-i386/beta3/images/hd-media/2.6/
grub> find /debian/vmlinz
grub> kernel (hd0,1)/debian/vmlinuz root=/dev/ram ramdisk_size=256000
devfs=mount,dall
grub> initrd (hd0,1)/debian/initrd.gz
grub> boot
6.安裝選項(xiàng):語(yǔ)言(英語(yǔ)),根分區(qū)reiserfs,數(shù)據(jù)分區(qū)推薦xfs,os可以選這個(gè):
kernel-2.6.16-2.686(服務(wù)器推薦用486),
安裝組件一個(gè)也不要(就是Debian software selection不要選)
網(wǎng)絡(luò)不要配置
grub裝不上去:
# dpkg -i grub_0.97-19_i386.deb
# grub-install /dev/hda
配置/boot/grub/menu.lst文件(沒(méi)有則創(chuàng)建)
###################################################################
default 1
timeout 5
color cyan/blue white/blue
title Debian GNU/Linux, kernel 2.6.16-2-686
vga=788(800x600)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-2-686
root=/dev/hda2 ro
vga=788
initrd /boot/initrd.img-2.6.16-2-686
savedefault
boot
title Debian GNU/Linux, kernel 2.6.18-2-686
vga=788(800x600)
root (hd0,1)
kernel /boot/vmlinuz-2.6.18-2-686
root=/dev/hda2 ro
vga=788
initrd /boot/initrd.img-2.6.18-2-686
savedefault
boot
title Windows XP SP2
root (hd0,0)
chainloader +1
###################################################################
7.啟動(dòng)系統(tǒng):可以修改/boot/grub/menu.lst中kernel
參數(shù)vga=791,這樣字體合適一些
~/.bashrc中加入:
alias ls='ls --color'
alias ll='ls -l --color'
alias lsa='ls --color
-a'
alias lla='ls -l --color
-a'
alias vi='vim'
alias rm='rm -i'
alias cp='cp --interactive'
alias rxvt='urxvtc -pe
tabbed'
alias sdcv='sdcv --data-dir
/usr/local/share/stardict/dic/'
. /etc/bash_completion
去掉root密碼:/etc/paasswd中的第一行root后面的x去掉
/etc/profile中加入: setleds +num --->
開(kāi)機(jī)就打開(kāi)小鍵盤(pán)
再加入:export PKG_CONFIG=`which
pkg-config`
8.需要掌握的命令:cat, tail od, chmod, chown, wc, diff,
grep/egrep, find,
locate, shutdown, free, password, su, echo, date, fdisk, pstree, hwclock,
vim
9.dpkg學(xué)習(xí):
(1)dpkg是一個(gè)較底層的安裝工具,處理.deb文件,軟件包依賴(lài)性需要更高層的前端工具是apt;
dpkg本身是不能解決依賴(lài)的。
dpkg是dpkg-deb的前端,如果dpkg搞不定,可以用dpkg-deb。
(2)所有的packages信息在/var/lib/dpkg目錄下:
available是安裝源的描述,包括已安裝和沒(méi)有安裝的
info目錄描述已安裝的包:.list后綴是文件列表,.prerm描述關(guān)聯(lián)的服務(wù),
.config是配置,.preinst安裝前配置,.postinst安裝后配置
(3)dpkg命令:
dpkg -l 查看已經(jīng)安裝的所有包
dpkg -s vim-tiny 查看某個(gè)包的詳細(xì)信息
dpkg -L vim-tiny 查看某個(gè)包安裝的所有文件
dpkg -S /bin/ls 查看這個(gè)文件屬于哪個(gè)包
dpkg -I vim7.0.deb 查看這個(gè)deb包的描述信息
dpkg -c vim7.0.deb 查看這個(gè)deb包的所有安裝文件
dpkg -i /mnt/cdrom/poll/main/z/zhcon/zhcon_0.2.6-2_i386.deb
如果這個(gè)包存在依賴(lài)而安裝不能通過(guò),則它會(huì)在/var/lib/dpkg/info中記錄,
再使用:apt-get -f install解決掉依賴(lài)就可以成功dpkg -i zhcon.deb了
dpkg -r prozilla 刪除包,不刪除配置文件
dpkg -P prozilla 刪除包,也刪除配置文件
有些包安裝時(shí)就需要配置,如果想重新配置,可以用:
dpkg-reconfigure locales
10.apt學(xué)習(xí):
(1)自動(dòng)獲取軟件包,自動(dòng)解決倚賴(lài),自動(dòng)配置,自動(dòng)編譯,常用命令:
apt-get
apt-cache
(2)添加下面行到/ept/apt/sources.list
(mount /dev/cdrom /media/cdrom)
deb file:/media/cdrom etch main
它會(huì)在/mnt/iso的dists下尋找Packages.gz,并在pool下尋找包文件
(3)apt-cache stats 顯示數(shù)據(jù)源中包的統(tǒng)計(jì)信息
apt-cache search vim 按關(guān)鍵字查找軟件包
apt-cache show vim-common 這個(gè)包的詳細(xì)信息
apt-cache depends vim-common 依賴(lài),沖突,替換的包
apt-cache rdepends vim-common 反向依賴(lài)
(4)apt-get update
從數(shù)據(jù)源更新軟件包的列表,運(yùn)行產(chǎn)生軟件包數(shù)據(jù)庫(kù)
apt-get upgrade 更新所有軟件包(慎用,不要用!)
(5)apt-get install lynx 安裝軟件包
apt-get -y install lynx 安裝時(shí)不提問(wèn)是否確認(rèn)
apt-get --reinstall install lynx 重裝
apt-get remove lynx && dpkg -l |grep lynx 刪除,不刪除配置文件
apt-get --purge remove lynx 刪除,并刪除配置文件
(6)apt-get install安裝的軟件包會(huì)下載到/var/cache/apt/archives中,
刪除請(qǐng)用:apt-get clean
不要用:rm -fr /var/cache/apt/archives/*
(7)apt-cache showsrc lynx 搜索源程序
apt-get source lynx 下載源程序到當(dāng)前目錄
apt-get build-dep lynx 編譯依賴(lài)軟件包
(8)必殺技:apt-get -f install 糾正安裝依賴(lài)
11.debian中文配置:
(1)unicode編碼:
utf: UTF-16, UTF-8, UTF-7
ucs:
常見(jiàn)的漢語(yǔ)字符集編碼方式:GB13000, GBK, GB18030, GB2312
(2)locale機(jī)制
常見(jiàn)的locale變量:LC_CTYPE, LANG, LC_ALL, LC_MESSAGES
優(yōu)先級(jí):LC_ALL > LC_* > LANG
(3)編碼辨識(shí)和轉(zhuǎn)換工作由系統(tǒng)底層函數(shù)庫(kù)完成,即glibc完成
(4)/usr/share/locale目錄保存locale信息
/usr/share/consolefonts目錄存放console的字體信息
/uxr/lib/gconv字符轉(zhuǎn)換模塊信息
/usr/X11R6/lib/X11/locale
/usr/X11R6/lib/X11/fonts
(5)生產(chǎn)locale數(shù)據(jù)庫(kù)資料
apt-get install locales
dpkg-reconfigure locales
apt-get install file
apt-get install zhcon
apt-get install fontconfig
apt-get install bzip2
需要的配置:en_US.UTF-8 UTF-8
en_US ISO-8859-1
zh_CN GB2312
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
默認(rèn)用en_US.UTF-8 UTF-8
12.網(wǎng)絡(luò)配置:
(1)命令:route, netstat -r
(2)dhcp配置:
echo "auto eth0" >> /etc/network/interfaces
echo "iface eth0 inet dhcp" >> /etc/network/interfaces
/etc/init.d/networking restart
(3)靜態(tài)ip地址配置
echo "auto eth0" >> /etc/network/interfaces
echo "iface eth0 inet static" >> /etc/network/interfaces
echo " address 192.168.0.2" >> /etc/network/interfaces
echo " netmask 255.255.255.0" >> /etc/network/interfaces
echo " gateway 192.168.0.1" >> /etc/network/interfaces
ifconfig eth0 down
ifconfig eth0 up
(4)配置主機(jī)名:/etc/hostname
(5)DNS配置:/etc/resolv.conf
13.重要的配置工具:
apt-get
install fbset
apt-get install rcconf
apt-get install
modconf
apt-get install fdflush # 用法:
fdflush /dev/sda1
apt-get install manpages-dev #
man 幫助頁(yè)安裝
模塊相關(guān)的知識(shí):
modprobe -c 顯示當(dāng)前被使用的模塊配制
modprobe
-l 顯示能匹配的模塊列表
modeprobe modname 加載模塊
modeprobe -r
modname 卸載模塊
modinfo modname 顯示模塊欣喜
insmod
rmmod
reset /* cat filename后屏幕一片混亂的恢復(fù)方法 */
dos2unix/unix2dos
convert /*
圖片轉(zhuǎn)換程序 */
iconv -f utf8 -t gb2312 file1 > file2
hdparm -tT
/dev/hda
updatedb更新數(shù)據(jù)庫(kù),locate
filename查找,這個(gè)可以加到crontab中定時(shí)執(zhí)行
包管理工具:
(1)console工具:tasksel, dselect, aptitude
(2)gui工具:synaptic
14.安裝桌面基本系統(tǒng)(從/mnt/iso光盤(pán)中)
apt-get install x-window-system-core
需要45M空間
apt-get --purge remove vim-common
apt-get --purge remove vim-tinny
apt-get install vim-full
fvwm安裝:
apt-get install fvwm
也可以用下面的命令安裝:
dpkg -i librplay3_3.3.2-11_i386.deb
dpkg -i libstroke0_0.5.1-5_i386.deb
dpkg -i fvwm_2.5.18-1_i386.deb
apt-get -f install
15.配置中文環(huán)境和fcitx
因?yàn)槲覀兛梢栽O(shè)置LC_ALL為zh_CN.GB2312,所以對(duì)應(yīng)的startx啟動(dòng)后顯示中文的fvwm,
是不是很爽啊,但是先不要這么設(shè)置!
fvwm設(shè)置:
如果你用 startx 進(jìn) X 可以修改 ~/.xinitrc
為(沒(méi)有就創(chuàng)建一個(gè))
export G_FILENAME_ENCODING=@GBK
export
LANG=zh_CN.GB2312
export LC_ALL=zh_CN.GB2312
export XMODIFIERS=@im=fcitx
export XIM=fcitx
export
XIM_PROGRAM=fcitx
fcitx
exec fvwm-session
推薦另一種做法:新建文件 /etc/X11/Xsession.d/25xchinput寫(xiě)入
# 編碼方式
export
G_FILENAME_ENCODING=@GBK
export LANG=zh_CN.GBK
export
LC_ALL=zh_CN.GB2312
# 輸入法
export XIM=fcitx
export
XIM_PROGRAM=fcitx
export
GTK_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
fcitx
# 配置$[HOME]/.fcitx/config文件,候選詞9個(gè),去掉其他輸入法只保留拼音
fcitx隱藏主窗口: 主窗口隱藏模式=0設(shè)置為1即可
16.fvwm需要的包及終端安裝
# 說(shuō)明:fvwm編譯前要裝上libxpm-devel,libpng-devel
# apt-get install
imagemagick fvwm不能load圖形(xpm,png)安裝這個(gè)
# 支持的命令:
# $ convert filename.jpg filename.xpm
裝一個(gè)支持中文支持透明的終端:
apt-get install mlterm
終端配置,使用rxvt-unicode
apt-get
install rxvt-unicode
在/etc/X11/Xsession.d/25xchinput中加入
urxvtd&
配置文件:/etc/X11/Xresources/Xresources
不重啟更新配置文件的方法:xrdb
Xresources
xev獲取按鍵
17.內(nèi)核編譯環(huán)境
(choose 1)apt-get install build-essential
上面命令安裝內(nèi)核頭文件,make工具,一些libc的庫(kù), dpkg-dev,gcc,
已經(jīng)包含了apt-get install gcc
也可以用命令替代上面的安裝:
(choose 2)apt-get install libc6-dev
編譯內(nèi)核:
在console中編譯官方內(nèi)核,需要以下軟件包
bin86 - 16-bit assembler and loader
diff - File
comparison utilities
libc6-dev - GNU C Library: Development Libraries and
Header Files
libncurses5-dev - Developer's
libraries and docs for ncurses
patch - Apply a diff file to an original
apt-get install bin86
apt-get install
libncurses5-dev
apt-get install kernel-package
apt-cache search mkinitrd 這個(gè)包已經(jīng)有了,里面包含mkinitramfs工具。
說(shuō)明:initramfs-tools和initrd-tools,前者是2.6.15以上內(nèi)核推薦使用的
內(nèi)核編譯指令:
make mrproper
make menuconfig(reiserfs 和
xfs靜態(tài)編譯到內(nèi)核中)
make
make
modules_install 編譯安裝模塊文件到/lib/modules/對(duì)應(yīng)的版本文件夾下
cp arch/i386/boot/bzImage
/boot/lfskernel-2.6.11.12
cp System.map
/boot/System.map-2.6.11.12
cp .config
/boot/config-2.6.11.12
mkinitramfs -o
/boot/initrd-2.6.17.8.img /lib/modules/2.6.17.8
添加到grub中,即/boot/grub/menu.lst文件,重新啟動(dòng)系統(tǒng)
18.smb工具安裝(共享windows機(jī)器上的文件)
安裝smbfs工具
dpkg -i
samba-common_3.0.22-1_i386.deb
dpkg -i
smbfs_3.0.22-1_i386.deb
使用范例:
mount -t smbfs -o codepage=cp936,username=用戶名,password=密碼
//ip/文件夾名 掛載點(diǎn)
或者:
mount -t smbfs -o codepage=cp936,username=用戶名,password=密碼
//ip/文件夾名 掛載點(diǎn)
19.字體美化,有兩種X
字體處理系統(tǒng)(兩種字體可并存)
1) xfs(x font server) + xtt
特點(diǎn):非平滑字體,由X
服務(wù)器處理
名稱(chēng):-wqy-fixed-medium-r-normal--10-100-75-......-iso8820-1類(lèi)試的表達(dá)式
安裝配置:
X 字體服務(wù)器路徑:
/etc/X11/xorg.conf 中的 Files節(jié)的FontPath
字體模塊(解析庫(kù))的路徑:
/etc/X11/xorg.conf 中的 Module節(jié)的Load
例如:freetype
,它支持ttf 和ttc
說(shuō)明:不要使用xtt 模塊!
生成字體索引文件:
truetype字體:
使用ttmkfdir命令,例如文泉驛字體 以及大多數(shù)windows字體
其他字體:使用mkfontdir 和
mkfontscale
說(shuō)明:fonts.dir是索引文件,fonts.scale是可縮放字體索引
說(shuō)明:這3個(gè)工具需要安裝
apt-get install ttmkfdir
工具:在X 環(huán)境下運(yùn)行 xlsfonts 查看系統(tǒng)已安裝的核心字體
xfontsel選擇字體
2)xft + fontconfig + freetype
特點(diǎn):xft是負(fù)責(zé)顯示的庫(kù)
fontconfig是配置工具
工具:fc-list 列出安裝的所有字體
fc-cache -fv
手動(dòng)更新系統(tǒng)字體配置
fc-match -v Tahoma 查找某個(gè)字體的信息
配置:
添加字體文件到/etc/fonts/fonts.conf中或新建一個(gè)路徑,
添加完后不要忘了fc-cache -fv
3)為應(yīng)用程序配置字體
1.gtk1 程序, 如xmms, gimp, 只能使用X
核心字體
配置文件:/etc/gtk/gtkrc.zh_CN
2.gtk2 和 qt程序, 可以使用xft 加 fontconfig
gtk2配置文件:
/etc/gtk-2.0/gtkrc
qt配置:運(yùn)行qtconfig 程序即可
4)其他技巧
5)查看dpi等信息: xdpyinfo | grep
resolution
xdpyinfo | grep dimensions
調(diào)整dpi: vi
/etc/X11/xorg.conf 加入
Section "Monitor"
......
DisplaySize
287 215 # 1024x768 90dpi
......
EndSection
重啟X
才能生效
6)使用windows_xp的字體
指令:
mkdir
/usr/share/fonts/truetype/winxp
找臺(tái) Winxp,拷貝 C:\windows\Fonts 下的 tahoma.ttf
tahomab.ttf simsun.ttf mingliu.ttf
到該目錄下。
同時(shí)在 /etc/X11/xorg.conf 中加入該路徑,好讓 legacy X font
server(xfs)
找到是上述四個(gè)新添加字體。如下:
FontPath
"/usr/share/fonts/truetype/winxp"
ttmkfdir 創(chuàng)建fonts.scale 文件,
fonts.dir是fonts.scale的拷貝
重啟 X, 使之生效。
或者:放到/etc/fonts/fonts.conf指定的目錄中然后fc-cache -fv
7)X 支持truetype字體引擎:xtt, freetype, xfs, xft。
前兩個(gè)是X
的內(nèi)部模塊,xfs和xft是外部服務(wù)例程,只有xft支持AA,支持中文最好的是xtt
8)fontconfig及xft
西方字體:serif 和sans
serif,sarif在字的筆畫(huà)邊緣處有額外的裝飾,
sans serif就沒(méi)有。
***Times, Times New
Roman等都屬于serif字體,
通常文章正文采用這個(gè).
***Arial, Tahoma, verdana, helvetica等都屬于sans
serif字體,
通常標(biāo)題等醒目字體采用這個(gè).
中文字體中,宋體和細(xì)明體就是serif; 黑體和圓體就是sans
serif字體。
monospace 也是sans
serif系列,但是是等距字體.
修改fonts.conf文件:
<alias><family>serif</family>
<prefer>中:DejaVu和Bitstream
Vera英文顯示效果較好放在所有英文字體前面,
AR PL New
Sung(就是firefly字體)以及Simsun中文效果最好,放在所有cjk
字體前面,技巧是搜索Luxi字體,放在它的前面。
需要安裝的字體:
windows中拷貝 simsun.ttf, simhei.ttf, tahoma.ttf,
tahomabd.ttf
拷貝到/usr/local/share/fonts/,然后執(zhí)行fc-cache
-fv
拷貝預(yù)先編輯好的font.conf到/etc/fonts/目錄
20.常用工具安裝
apt-get install
links2 支持彩色的控制臺(tái)瀏覽器
apt-get install firefox
apt-get install
firefox-locale-zh-cn
apt-get install less /* 讓man支持vi風(fēng)格 */
apt-get
install rox-filer
apt-get install wireshark /* ethereal */
apt-get install
gtksee
apt-get install amule
apt-get install xpaint
apt-get install
gimp
apt-get install beep-media-player
apt-get install
mp3blaster
apt-get install gaim
apt-get install liferea /* RSS reader
*/
apt-get install zlib1g-dev /* zlib library */
apt-get install
libglib2.0-dev /* glib2.0 */
apt-get install libxml-perl /* stardict need it
*/
apt-get install libgnomeui-dev /* stardict need it */
apt-get install
scrollkeeper /* before stardict make */
apt-get install gthumb /* picture
browse */
apt-get install kopete /* for chat (graphics) */
apt-get
install irssi /* for chat (console) */
apt-get install gftp
apt-get
install mpg321 /* console mp3 player */
apt-get install dia /* 流程圖軟件
*/
apt-get install scrot /* 截圖軟件 */
apt-get install xxdiff /*
比較目錄,比較文件可以用vimdiff */
apt-get install pciutils /* lspci */
apt-get
install hdparm
apt-get install mkisofs
apt-get install jfbterm /*
支持framebuffer的終端 */
apt-get install synaptic /* 新立德軟件包管理器 */
apt-get
install unzip
21.安裝stardict
tar jxf
sdcv-0.4.2.tar.bz2 && cd sdcv-0.4.2 && ./configure &&
make && make install
tar jxf stardict-2.4.8.tar.bz2 && cd
stardict-2.4.8 && ./configure && make && make
install
mkdir /usr/local/share/stardict/dic
tar jxf
infoBrowse-zh_CN-2.4.2.tar.bz2 --directory /usr/local/share/stardict/dic/
tar
jxf stardict-gaojihanyudacidian-2.4.2.tar.bz2 --directory
/usr/local/share/stardict/dic/
tar jxf
stardict-hanyuchengyucidian-2.4.2.tar.bz2 --directory
/usr/local/share/stardict/dic/
tar jxf stardict-langdao-ce-gb-2.4.2.tar.bz2
--directory /usr/local/share/stardict/dic/
tar jxf
stardict-langdao-ec-gb-2.4.2.tar.bz2 --directory
/usr/local/share/stardict/dic/
tar jxf stardict-ncce-ce-2.4.2.tar.bz2
--directory /usr/local/share/stardict/dic/
tar jxf
stardict-ncce-ec-2.4.2.tar.bz2 --directory /usr/local/share/stardict/dic/
tar
jxf stardict-oxford-gb-2.4.2.tar.bz2 --directory
/usr/local/share/stardict/dic/
tar jxf stardict-oxfordjm-ec-2.4.2.tar.bz2
--directory /usr/local/share/stardict/dic/
tar jxf
stardict-treedict-infoBrowse-zh_CN-2.4.2 --directory
/usr/local/share/stardict/dic/
tar jxf stardict-xdict-ce-gb-2.4.2.tar.bz2
--directory /usr/local/share/stardict/dic/
tar jxf
stardict-xdict-ec-gb-2.4.2.tar.bz2 --directory
/usr/local/share/stardict/dic/