安裝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以及對應版本的擴展包

參考:https://wiki.debian.org/VirtualBox#Debian_7_.22Wheezy.22

安裝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 | 訂閱 | 發私信

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章