ihipop 发表于 2012-8-11 16:22:00

一句话搞定Xbian的SSH中文环境

可能是Xbian的BUG 使用update-locale没法更新系统语言 导致SSH上去是英文
下面假设你是全新安装的xbian
#非必须 如果你需要另外安装X桌面 请去掉下面两行的命令里面开头的#号
#apt-get update
#apt-get install ttf-wqy-microhei ttf-wqy-zenhei
#生成并且设置locale
cat <<EOF >/etc/locale.gen
en_US.UTF-8 UTF-8
#zh_CN GB2312
#zh_CN.GB18030 GB18030
#zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
#zh_TW BIG5
EOF
dpkg-reconfigure -f noninteractive locales
update-locale LANG=zh_CN.UTF-8
cat <<EOF >/etc/profile.d/user_lang_env.sh
#!/bin/sh
[ -f /etc/default/locale ] && . /etc/default/locale
[ -n "$LANG" ] && export LANG=$LANG
EOF
reboot


dteui 发表于 2012-8-11 18:20:18

新手不会啊,能不能详细一点

dteui 发表于 2012-8-11 18:20:44

新手不会啊,能不能详细一点

x-magic 发表于 2012-8-12 15:42:43

回 dteui 的帖子

dteui:新手不会啊,能不能详细一点 (2012-08-11 18:20) images/back.gif

LZ写得已经够详细了,请先复习Linux基础知识

xile 发表于 2012-9-1 00:51:28

刚才试了下是乱码,不过我的xbmc是12.0的

ihipop 发表于 2012-10-9 10:03:20

回 xile 的帖子

xile:
刚才试了下是乱码,不过我的xbmc是12.0的 images/back.gif


代码贴错了

改成这样再执行下

cat <<EOF >/etc/profile.d/user_lang_env.sh
#!/bin/sh
[ -f /etc/default/locale ] && . /etc/default/locale
[ -n "\\$LANG" ] && export LANG=\\$LANG
EOF

xile 发表于 2012-10-13 00:57:40

回 ihipop 的帖子

ihipop:代码贴错了

改成这样再执行下
....... (2012-10-09 10:03) images/back.gif

再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
Hit http://archive.raspbian.org wheezy InRelease      
Hit http://archive.raspbian.org wheezy/main Sources
Hit http://archive.raspbian.org wheezy/contrib Sources
Hit http://archive.raspbian.org wheezy/non-free Sources
Hit http://archive.raspbian.org wheezy/main armhf Packages
Hit http://archive.raspbian.org wheezy/contrib armhf Packages
Hit http://archive.raspbian.org wheezy/non-free armhf Packages
Ign http://archive.raspbian.org wheezy/contrib Translation-zh_CN
Ign http://archive.raspbian.org wheezy/contrib Translation-zh
Ign http://archive.raspbian.org wheezy/contrib Translation-en
Ign http://archive.raspbian.org wheezy/main Translation-zh_CN
Ign http://archive.raspbian.org wheezy/main Translation-zh
Ign http://archive.raspbian.org wheezy/main Translation-en
Ign http://archive.raspbian.org wheezy/non-free Translation-zh_CN
Ign http://archive.raspbian.org wheezy/non-free Translation-zh
Ign http://archive.raspbian.org wheezy/non-free Translation-en
Reading package lists... Done
root@XBian:~# apt-get install ttf-wqy-microhei ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Abort.
root@XBian:~# #生成并且设置locale
root@XBian:~# cat <<EOF >/etc/locale.gen
> en_US.UTF-8 UTF-8
> #zh_CN GB2312
> #zh_CN.GB18030 GB18030
> #zh_CN.GBK GBK
> zh_CN.UTF-8 UTF-8
> #zh_TW BIG5
> EOF
root@XBian:~# dpkg-reconfigure -f noninteractive locales
Generating locales (this might take a while)...
en_US.UTF-8... done
zh_CN.UTF-8... done
Generation complete.
root@XBian:~# update-locale LANG=zh_CN.UTF-8
root@XBian:~# cat <<EOF >/etc/profile.d/user_lang_env.sh
> #!/bin/sh
> [ -f /etc/default/locale ] && . /etc/default/locale
> [ -n "\\$LANG" ] && export LANG=\\$LANG
> EOF
root@XBian:~# reboot


Broadcast message from root@XBian (pts/0) (Fri Oct 12 16:55:09 2012):

The system is going down for reboot NOW!
root@XBian:~#
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@XBian:~# date
2012骞?10?12妤 骀浜 16:57:06 UTC
root@XBian:~#

xile 发表于 2012-10-13 01:07:37

回 ihipop 的帖子

ihipop:


代码贴错了

改成这样再执行下
....... images/back.gif

再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
Hit http://archive.raspbian.org wheezy InRelease      
Hit http://archive.raspbian.org wheezy/main Sources
Hit http://archive.raspbian.org wheezy/contrib Sources
Hit http://archive.raspbian.org wheezy/non-free Sources
Hit http://archive.raspbian.org wheezy/main armhf Packages
Hit http://archive.raspbian.org wheezy/contrib armhf Packages
Hit http://archive.raspbian.org wheezy/non-free armhf Packages
Ign http://archive.raspbian.org wheezy/contrib Translation-zh_CN
Ign http://archive.raspbian.org wheezy/contrib Translation-zh
Ign http://archive.raspbian.org wheezy/contrib Translation-en
Ign http://archive.raspbian.org wheezy/main Translation-zh_CN
Ign http://archive.raspbian.org wheezy/main Translation-zh
Ign http://archive.raspbian.org wheezy/main Translation-en
Ign http://archive.raspbian.org wheezy/non-free Translation-zh_CN
Ign http://archive.raspbian.org wheezy/non-free Translation-zh
Ign http://archive.raspbian.org wheezy/non-free Translation-en
Reading package lists... Done
root@XBian:~# apt-get install ttf-wqy-microhei ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Abort.
root@XBian:~# #生成并且设置locale
root@XBian:~# cat <<EOF >/etc/locale.gen
> en_US.UTF-8 UTF-8
> #zh_CN GB2312
> #zh_CN.GB18030 GB18030
> #zh_CN.GBK GBK
> zh_CN.UTF-8 UTF-8
> #zh_TW BIG5
> EOF
root@XBian:~# dpkg-reconfigure -f noninteractive locales
Generating locales (this might take a while)...
en_US.UTF-8... done
zh_CN.UTF-8... done
Generation complete.
root@XBian:~# update-locale LANG=zh_CN.UTF-8
root@XBian:~# cat <<EOF >/etc/profile.d/user_lang_env.sh
> #!/bin/sh
> [ -f /etc/default/locale ] && . /etc/default/locale
> [ -n "\\$LANG" ] && export LANG=\\$LANG
> EOF
root@XBian:~# reboot


Broadcast message from root@XBian (pts/0) (Fri Oct 12 16:55:09 2012):

The system is going down for reboot NOW!
root@XBian:~#
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@XBian:~# date
2012骞?10?12妤 骀浜 16:57:06 UTC
root@XBian:~#

xile 发表于 2012-10-13 01:09:51

回 xile 的帖子

xile:

再次试了一下,不工作
root@XBian:~# date
2012骞?10?12妤 骀浜 16:49:27 UTC
root@XBian:~# apt-get update
....... images/back.gif

root@XBian:~# apt-get install ttf-wqy-microhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-microhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get install ttf-wqy-zenhei
Reading package lists... Done
Building dependency tree      
Reading state information... Done
ttf-wqy-zenhei is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get install util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
util-linux is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~# apt-get remove util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
liblockfile-bin liblockfile1 lockfile-progs pmount
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
makedev
The following packages will be REMOVED:
dmsetup e2fsprogs fuse libdevmapper1.02.1 libparted0debian1 nfs-common ntfs-3g parted udev usbmount util-linux
The following NEW packages will be installed:
makedev
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
e2fsprogs util-linux (due to e2fsprogs)
0 upgraded, 1 newly installed, 11 to remove and 19 not upgraded.
1 not fully installed or removed.
Need to get 42.3 kB of archives.
After this operation, 8,355 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?]
Abort.
root@XBian:~# apt-get remove util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
liblockfile-bin liblockfile1 lockfile-progs pmount
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
makedev
The following packages will be REMOVED:
dmsetup e2fsprogs fuse libdevmapper1.02.1 libparted0debian1 nfs-common ntfs-3g parted udev usbmount util-linux
The following NEW packages will be installed:
makedev
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
e2fsprogs util-linux (due to e2fsprogs)
0 upgraded, 1 newly installed, 11 to remove and 19 not upgraded.
1 not fully installed or removed.
Need to get 42.3 kB of archives.
After this operation, 8,355 kB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] Y
Abort.
root@XBian:~# apt-get install util-linux
Reading package lists... Done
Building dependency tree      
Reading state information... Done
util-linux is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue ?
Setting up util-linux (2.20.1-5.2) ...
update-rc.d: error: unable to read /etc/init.d/hwclock.sh
dpkg: error processing util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)
root@XBian:~#

tian0cai 发表于 2012-12-2 23:56:50

如果是用putty连接ssh还要改一下putty的字符集才能看到中文。
页: [1] 2
查看完整版本: 一句话搞定Xbian的SSH中文环境