天天看點

PogoPlug折騰全過程--Debian系統配置及優化

Debian系統預設安裝語言為英語,時間使用是UTC。這不符合國人習慣。

需要修改時區為上海,顯示CST時間。添加中文支援。

ok,開始折騰。

在路由器中的dhcp配置設定表中找到PogoPlug的ip,ssh登入到裝置。

在/etc/default/rcS裡面修改,設定UTC=no

設定時區為上海

cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime
           

date檢視時間檢查是否生效。

安裝locales,并重新配置locales

apt-get install locales
dpkg-reconfigure locales
           

選擇422. zh_CN.UTF-8 UTF-8

确認全局修改

Many packages in Debian use locales to display text in the correct language for the user. You can choose a default locale for the system 
from the generated locales.

This will select the default language for the entire system. If this system is a multi-user system where not all users are able to speak 
the default language, they will experience difficulties.

  1. None  2. zh_CN.UTF-8

                                                                                                                                           Default locale for the system environment: 2
           

運作LOCALE指令檢查目前的LOCALE環境

[email protected]:/etc# locale
LANG=zh_CN.UTF-8
LANGUAGE=
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
           

安裝中文字型

apt-get install xfonts-intl-chinese 
           

至此,修複時區和中文問題。

修改主機名稱為PogoPlugProHD

echo PogoPlugProHD >/etc/hostname
           

挂載sda3,swap空間

生成256M檔案

cd ~
dd if=/dev/zero of=swapfile bs=1M count=256
           

建立交換格式檔案

mkswap swapfile 
           

挂載交換檔案

swapon swapfile 
           

編輯/etc/fstab

添加以下内容,每次開機自動挂載swap和sda3

/root/swapfile         swap           swap    defaults        0 0
/dev/sda3             /mnt/es2_1t     ext3    defaults        0 0
           

Debian預設為DHCP方式擷取IP位址,修改為靜态IP方式,并綁定子IP,做雙線使用。同時把mac位址改回與外殼一緻。

編輯/etc/network/interfaces

auto lo eth0
iface lo inet loopback

iface eth0 inet static
address 198.18.8.252
netmask 255.255.255.0
gateway 198.18.8.251
dns-nameservers 198.18.8.251
hwaddress ether 00:25:31:xx:xx:xx

auto eth0:0
iface eth0:0 inet static
address 198.18.8.250
netmask 255.255.255.0
           

重新開機網絡

/etc/init.d/networking restart
           

把252配置成預設IP(對外通路雙線效果),252為單線ip(接受外部請求使用)。

編輯/etc/rc.local,添加以下語句

ip route replace default via 198.18.8.251 dev eth0 src 198.18.8.252
ip route flush cache
           

網關上再配置源位址政策路由。我這裡用的網關是華為HG255d,刷OpenWrt系統。

OpenWrt自定義iptables語句,/etc/firewall.user裡面添加,網關和IP修改成相應的。如果是動态IP,需要通過腳本來更新,這個後面的文章再補吧,超出pogoplug範圍了。

ip route flush table 90
ip route add default via 網關 dev pppoe-wan src IP table 90 prio 50
ip rule add from 198.18.8.250 table 90
           

配置DNS

編輯/etc/resolv.conf,添加

nameserver 198.18.8.251
nameserver 202.96.134.133
           

至此,系統配置完成了。可以開始新的旅程,安裝部署各種軟體和應用。

Enjoy!!

原文首發CSDN部落格,轉載請保留作者和出處,謝謝。