概述

通过共享简单的脚本,您可以将Linux服务器上的点击语言设置为中文,并支持以下系统:

德比安8/9

Ubuntu 14/16

Centos 6/7

1、脚本内容。

请注意,需要联网。

#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH # Check System Release if [ -f /etc/redhat-release ]; then release="centos" elif cat /etc/issue | grep -Eqi "debian"; then release="debian" elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" elif cat /proc/version | grep -Eqi "debian"; then release="debian" elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" fi # Check root [[ $EUID -ne 0 ]] && echo -e "${RED}Error:${PLAIN} This script must be run as root!" && exit 1 # Install some dependencies if [ "${release}" == "centos" ]; then yum -y install wget ca-certificates locales localedef else apt-get update apt-get -y install wget ca-certificates locales fi # Get Word dir dir=$(pwd) # Change Locale if [ "${release}" == "centos" ]; then localedef -v -c -i zh_CN -f UTF-8 z > /dev/null 2>&1 cd /etc rm -rf locale.conf wget > /dev/null 2>&1 cp locale.conf locale cat locale.conf >> /etc/environment elif [ "${release}" == "debian" ]; then rm -rf /etc rm -rf /etc/default/locale rm -rf /etc/defaul cd /etc/ wget https://raw.githubusercontent.com/FunctionClub/LocaleCN/master > /dev/null 2>&1 locale-gen cd /etc/default/ wget > /dev/null 2>&1 cp locale.conf locale elif [ "${release}" == "ubuntu" ]; then rm -rf /etc rm -rf /etc/default/locale rm -rf /etc/defaul cd /etc/ wget https://raw.githubusercontent.com/FunctionClub/LocaleCN/master > /dev/null 2>&1 locale-gen cd /etc/default/ wget > /dev/null 2>&1 cp locale.conf locale fi # Echo Success clear echo "Your Machine Language setting is changed to Chinese(Simplified)" echo "Reconnect to your machine to check it" echo "" echo "copyright by hwb" echo "QQ : 1275758000" # Delete self cd ${dir} rm -rf LocaleCN.sh


3、执行结果:


觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~

1.《ubuntu怎么调语言?总结很全面速看!详解如何一键设置Linux服务器终端显示语言为中文》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。

2.《ubuntu怎么调语言?总结很全面速看!详解如何一键设置Linux服务器终端显示语言为中文》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。

3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/gl/3148321.html