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環境
root@PogoPlugProHD:/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博客,轉載請保留作者和出處,謝謝。