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环境

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博客,转载请保留作者和出处,谢谢。

你可能感兴趣的:(pogoplug,nas)