2. Wheezy的基本配置
我这个人比较喜欢折腾,希望系统的字体是英文,但是也能显示中文,同时要能上网文本编辑等等,以下是最基本的配置。
(1)网络配置
在Debian开机的过程中,会自动调用ifup -a 命令来启动网络,/etc/network/interfaces文件用来描述所有的网络接口,通常情况下声明本机接口(loop),以太网接口(eth0)和无线网卡(wlan0),每个网络接口都是以iface开头,前面没有空格。
以下静态网络配置,其中网关是222.25.133.251,在该局域网内机器的IP地址是222.25.133.119,子网掩码是255.255.255.0。DHCP的配置相对简单,这里不作介绍。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
# This is an autoconfigured IPv6 interface
#allow-hotplug eth0
#iface eth0 inet6 auto
# Static IP Address
auto eth0
iface eth0 inet static
address 222.25.135.119
netmask 255.255.255.0
gateway 222.25.135.251
dns-search somedomain.org
dns-nameservers 8.8.8.8 202.117.112.3
代码中的auto表示启动中自动被激活,如果不想激活这里可以不设置auto,对于任何一台有TCP/IP网络支持的主机,都有一个IP地址作为本机地址,即127.0.0.1,这个接口的存在为很多程序的运行都提供了便利,是不可或缺的。使用DHCP的网络接口进行设置的时候,往往可以从DHCP服务器获取可用的域名解析(DNS)服务器,用来进行域名解析,对于享受不到DHCP服务的主机,如果想解析域名,需要通过/etc/resolv.conf来指定域名服务器。
nameserver 202.117.112.3
nameserver 8.8.8.8
ifconfig和tp ifconfig常用于查看网络配置,其中ifconfig用来查看网络接口状态,也可以通过ifconfig eth0 192.168.10.1来改变网卡状态。
APT可谓是debian的程序包管理的神器了,首先应该配置apt或者aptitude的源/etc/apt/sources.list,如下所示
#deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 DVD Binary-1 20130504-14:44]/ wheezy contrib main
#deb http://security.debian.org/ wheezy/updates main contrib
#deb-src http://security.debian.org/ wheezy/updates main contrib
# wheezy-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
# deb http://ftp.debian.org/debian/ wheezy-updates main contrib
# deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib
## 163
deb http://mirrors.163.com/debian wheezy main contrib non-free
deb http://mirrors.163.com/debian wheezy-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian wheezy main non-free contrib
deb-src http://mirrors.163.com/debian wheezy-proposed-updates main contrib non-free
## china
#deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
#deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
#debian security updates
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
#multimedia
deb http://deb-multimedia.org wheezy main non-free
#virtualbox
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
然后apt-get update, apt-get upgrade对安装的程序包进行升级后,就可以通过APT安装和卸载软件工具了。
(2)语言和输入法
我的系统是在中文环境下安装的,有中文文字包,将系统改成英文可以选择/etc/default/locale修改为LANG=en_US.UTF-8 LANGUAGE="en_US:en" 然后重新启动Gnome选择update即可。$dpkg-reconfigure locales可以选择系统的基础环境语言,$locale -a 可以观察修改结果。但是这样造成一个问题,即在Console和gedit打开文本发现都是乱码,我们可以输入命令gsettings set org.gnome.gedit.preferences.encodings
auto-detected "['GB18030', 'UTF-8', 'GB2312', 'GBK', 'BIG5', 'CURRENT', 'UTF-16']"
也可以通过图形界面,运行$dconf-editor展开/org/gnome/gedit/preference/encodings在auto-detected里面current前面加上GB18030,GB2312即可。可以通过以下方式添加拼音输入法,个人推荐ibus,很好用!
$apt-get install ibus ibus-cluster ibus-gtk ibus-gtk3 ibus-qt4
$apt-get install ibus-pinyin
为了可以使得启动时ibus自动启动,可以在$HOME/.bashrc中添加
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
然后在preference中设置以下个人喜好就可以了。

