1. 程式人生 > >安裝Debian後的基本配置

安裝Debian後的基本配置

說明

  • 描述:本文介紹了安裝Debian7.5發行版後的必要配置以便於更好的使用Debian進行軟體開發。
  • 映象:本文基於已安裝的 debian-live-7.5.0-amd64/i386-gnome-desktop.iso 中文版
  • 假設:你的安裝使用者名稱是wpf

1. 修改/etc/sudoers,掛載,修改/etc/apt/source.list

新增wpf到sudoer

切換到root:

su root

用編輯器開啟 /etc/sudoers,在:

# User privilege specification
root    ALL=(ALL:ALL) ALL

後面新增一行,新增後如下:

# User privilege specification
root    ALL=(ALL:ALL) ALL
wpf     ALL=(ALL:ALL) ALL

儲存修改並推出root使用者:

exit

開機自動掛在現有分割槽

修改/etc/fstab檔案,新增如下一行:

# 裝置節點      掛在目錄   檔案系統型別   引數      dump   pass
/dev/YourNode    /YourDir    fstype        defaults    0    0

解釋:

  • YourNode:你要掛在的裝置節點,通常是sdb1或sdb2。
  • YourDir:你想要將YourNode掛在到那個目錄下,一般在自己的主目錄下面新建一個檔案目錄。
  • fstype:是你的YourNode檔案系統的型別,一般是ext3/ext4/ntfs,分別對應的fstype為
    ext3/ext4/ntfs-3g
  • 後面三項引數使用 defaults 0 0 即可。

更新軟體源 /etc/apt/source.list

備份:

sudo cp /etc/apt/source.list /etc/apt/source.list-org

/etc/apt/source.list 內容替換為下面的內容:

Debian 7 wheezy

#
# Official mirror for wheezy
#
deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
deb http://ftp.cn.debian.org/debian/ wheezy-backports main contrib non-free
deb http://ftp.cn.debian.org/debian/ wheezy-proposed-updates main contrib non-free
deb http://ftp.cn.debian.org/debian/ wheezy-updates main contrib non-free

deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ wheezy-backports main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ wheezy-proposed-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ wheezy-updates main contrib non-free

#
# http://debian.ustc.edu.cn/debian/ Zhong Ke Da for wheezy
#
deb http://debian.ustc.edu.cn/debian/ wheezy main contrib non-free
deb http://debian.ustc.edu.cn/debian/ wheezy-backports main contrib non-free
deb http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates main contrib non-free
deb http://debian.ustc.edu.cn/debian/ wheezy-updates main contrib non-free

deb-src http://debian.ustc.edu.cn/debian/ wheezy main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-backports main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-updates main contrib non-free

#
# 163 mirror for wheezy
#
deb http://mirrors.163.com/debian/ wheezy main contrib non-free
deb http://mirrors.163.com/debian/ wheezy-backports main contrib non-free
deb http://mirrors.163.com/debian/ wheezy-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian/ wheezy-updates main contrib non-free

deb-src http://mirrors.163.com/debian/ wheezy main contrib non-free
deb-src http://mirrors.163.com/debian/ wheezy-backports main contrib non-free
deb-src http://mirrors.163.com/debian/ wheezy-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian/ wheezy-updates main contrib non-free

jessie

# Debian 8 jessie

#
# Official mirror for jessie
#
deb http://ftp.cn.debian.org/debian/ jessie main contrib non-free
deb http://ftp.cn.debian.org/debian/ jessie-backports main contrib non-free
deb http://ftp.cn.debian.org/debian/ jessie-proposed-updates main contrib non-free
deb http://ftp.cn.debian.org/debian/ jessie-updates main contrib non-free

deb-src http://ftp.cn.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ jessie-backports main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ jessie-proposed-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ jessie-updates main contrib non-free

#
# http://debian.ustc.edu.cn/debian/ Zhong Ke Da for jessie
#
deb http://debian.ustc.edu.cn/debian/ jessie main contrib non-free
deb http://debian.ustc.edu.cn/debian/ jessie-backports main contrib non-free
deb http://debian.ustc.edu.cn/debian/ jessie-proposed-updates main contrib non-free
deb http://debian.ustc.edu.cn/debian/ jessie-updates main contrib non-free

deb-src http://debian.ustc.edu.cn/debian/ jessie main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ jessie-backports main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ jessie-proposed-updates main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ jessie-updates main contrib non-free

#
# 163 mirror for jessie
#
deb http://mirrors.163.com/debian/ jessie main contrib non-free
deb http://mirrors.163.com/debian/ jessie-backports main contrib non-free
deb http://mirrors.163.com/debian/ jessie-proposed-updates main contrib non-free
deb http://mirrors.163.com/debian/ jessie-updates main contrib non-free

deb-src http://mirrors.163.com/debian/ jessie main contrib non-free
deb-src http://mirrors.163.com/debian/ jessie-backports main contrib non-free
deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main contrib non-free
deb-src http://mirrors.163.com/debian/ jessie-updates main contrib non-free

更新軟體列表:

sudo apt-get update

2. 安裝中文輸入法

作為母語為中文的孩子,我願意使用中文輸入法,安裝吧:

sudo apt-get install ibus ibus-googlepinyin im-config
sudo im-config -n ibus

登出,重新登入,手動設定一下螢幕右上角的ibus輸入法即可使用中文了哈哈。

3. 選擇語系

如果沒有安裝locales,首先需要安裝locales程式,Debian現在推薦使用aptitude來安裝程式,
它能比apt-get更好的解決軟體包之間的衝突。

sudo aptitude install locales

安裝完locales後,就重新選擇Debian所使用的語系,命令是:

sudo dpkg-reconfigure locales

使用 locale -a 命令檢視一下當前支援的語系,在我的計算機上輸出如下:

C
C.UTF-8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
POSIX
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_HK
zh_HK.big5hkscs
zh_HK.utf8
zh_TW.utf8

配置好語系(locale)後,最好重新登入一次。

4. 配置中文字型

sudo apt-get install ttf-droid ttf-wqy-zenhei ttf-wqy-microhei \
    ttf-arphic-ukai ttf-arphic-uming xfonts-wqy ttf-bitstream-vera

5. 安裝Windows字型

新建一個字型目錄,用來存放下面將要安裝的Windows字型檔案:

sudo mkdir -p /usr/local/share/fonts/msfonts

將Windows系統下的 WINDOWS/Fonts/ 下的你需要的字型檔案拷貝到上一步新建的目錄中。例如
如果你有一個Windows下所有字型的壓縮包的話,你可以這樣安裝字型:

sudo tar -xf WindowsFonts_i_love.tar.bz2 -C /usr/local/share/fonts/msfonts

修改字型許可權:

sudo chmod a+r /usr/local/share/fonts/msfonts/*

更新字型快取:

sudo fc-cache /usr/local/share/fonts/msfonts/

檢視一下宋體喔!

fc-list | grep -i sun

輸出資訊如下:

/usr/local/share/fonts/msfonts/MicrosoftFonts_i_love/simsun.ttc: 宋體,SimSun:style=Regular
/usr/local/share/fonts/msfonts/MicrosoftFonts_i_love/simsunb.ttf: SimSun\-ExtB:style=Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/local/share/fonts/msfonts/MicrosoftFonts_i_love/simsun.ttc: 新宋體,NSimSun:style=Regular

登出後重新登入一次。重新登入後,介面中文顯示應該美化好多了。Not Bad ! 自己再根據個人
喜好,在高階選項中選擇合適的字型。

6. 安裝Chromium以及flashplayer

sudo apt-get install chromium chromium-l10n pepperflashplugin-nonfree

7. 安裝VirtualBox以及對應版本的擴充套件包

安裝VirtualBox:

sudo apt-get install linux-headers-$(uname -r|sed 's,[^=XXFN}*-{FNXX=]*-,,') virtualbox

擴充套件包

下載並安裝對應版本的擴充套件包。

如果出現USB裝置不可用,參考:

http://www.virtualbox.org/manual/ch12.html#ts_usb-linux
http://www.linuxdiyf.com/viewarticle.php?id=73478

如果不能訪問usb子系統,請將wpf新增到vboxusers組中

sudo usermod -a -G vboxusers wpf # 一定要有-a,否則會離其他次要組。

檢視wpf使用者屬組:

cat /etc/group | grep wpf

8. 配置VPN

sudo apt-get install network-manager-pptp network-manager-pptp-gnome pptp-linux

9. 配置samba服務

安裝samba包:

$ sudo apt-get install samba

建立samba共享目錄:

$ mkdir /home/wpf/data

新增wpf系統使用者為samba使用者:

$ sudo smbpasswd -a wpf

/etc/samba/smb.conf 末尾新增如下內容:

# add by wpf begin
[data]
        comment         = share via samba
        path            = /home/wpf/data
        guest ok        = no
        create mask     = 0755
        directory mask  = 0755
        writable        = yes
        valid users     = wpf
# add by wpf end

重啟samba服務以使修改生效

$ sudo /etc/init.d/samba restart

10. 在Win7與Debian雙系統下,Win7設為預設啟動項

修改/boot/grub/grub.cfg檔案的預設啟專案就可以。修改前:

 set default="0"

修改後:

set default="6"

11. 安裝基本開發工具

安裝基本開發工具

sudo apt-get install build-essential bison flex manpages-dev
sudo apt-get install ncurses-base ncurses-doc ncurses-hexedit ncurses-bin \ 
    ncurses-examples ncurses-term

安裝 git

sudo apt-get install git git-core git-all

安裝FTP服務

安裝:

sudo apt-get install vsftpd

配置:

修改/etc/vsftpd,去掉#local_enable=YES和#write_enable=YES之前的#號

重啟服務:

sudo /etc/init.d/vsftpd restart

安裝nfs服務

安裝:

sudo apt-get install nfs-kernel-server rpcbind

配置/etc/exports檔案內容,如下即可!(不安全,但是通用):

#/ *(rw,sync,no_root_squash)

重啟:

sudo /etc/init.d/nfs-kernel-server restart

安裝tree和htop

sudo apt-get install tree htop

配置 /etc/network/interfaces

靜態地址

# 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
#allow-hotplug eth1
auto eth1
#iface eth1 inet dhcp
iface eth1 inet static
address 172.16.7.3
netmask 255.255.255.0
gateway 172.16.7.1

動態獲取

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

# add by wpf
auto eth0
#iface eth0 inet dhcp

#allow-hotplug eth0

安裝openvpn

# apt-get install openvpn
# sudo openvpn /etc/openvpn/wupengfei.ovpn

參考

閱讀原文 | 作者官網 | 公眾號 | Feed | 訂閱 | 發私信