解决Linux系统字符集不匹配安装软件失败问题

使用SSHSecureShellClient客户端连接Linux服务器,把字符集设置为:
export LC_CTYPE=zh_CN.GB18030
export LC_ALL=zh_CN.GB18030
export LANG=zh_CN.GB18030
解决客户端连接Linux中文乱码问题

中文可以正常显示了,解决了客户端连接Linux系统中文乱码问题。但是在安装一些软件时,比如安装GitLab时,显示Warnings信息安装失败,Warnings信息截取部分如下:
Running handlers:
There was an error running gitlab-ctl reconfigure:

execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (postgresql::enable line 49) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: The files belonging to this database system will be owned by user “gitlab-psql”.
This user must also own the server process.

The database cluster will be initialized with locale “zh_CN.GB18030”.
STDERR: initdb: error: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (GB18030) do not match. This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1

Warnings:
Environment variable LC_ALL specifies a non-UTF-8 locale. GitLab requires UTF-8 encoding to function properly. Please check your locale settings.
截图如下:
安装GitLab时字符集不匹配安装失败
以上是安装GitLab时,把字符集更改成zh_CN.GB18030造成安装失败。通常Linux服务器安装软件都是英文版的,如果把字符集设置成zh_CN.GB18030可能安装失败,所以把字符集更改为en_US.UTF-8字符集就解决问题了:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

如下图所示:
更改字符集解决GitLab安装失败

更改字符集后再进行安装GitLab软件就成功了。这个方法也适用其他软件

注:每次使用客户端连接Linux服务器时,都要手动改一下。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YunFeiDong

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值