linux一键中文脚本
linux一键中文脚本源码 使用脚本教程
wget -N --no-check-certificate https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/LocaleCN.sh && bash LocaleCN.sh
适用linux系统
- Debian 8 / 9
- Ubuntu 14 / 16
- CentOS 6 / 7
- kali
下面是脚本源码
#!/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 zh_CN.UTF-8 > /dev/null 2>&1 | |
cd /etc | |
rm -rf locale.conf | |
wget https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/locale.conf > /dev/null 2>&1 | |
cp locale.conf locale | |
cat locale.conf >> /etc/environment | |
elif [ "${release}" == "debian" ]; then | |
rm -rf /etc/locale.gen | |
rm -rf /etc/default/locale | |
rm -rf /etc/default/locale.conf | |
cd /etc/ | |
wget https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/locale.gen > /dev/null 2>&1 | |
locale-gen | |
cd /etc/default/ | |
wget https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/locale.conf > /dev/null 2>&1 | |
cp locale.conf locale | |
elif [ "${release}" == "ubuntu" ]; then | |
rm -rf /etc/locale.gen | |
rm -rf /etc/default/locale | |
rm -rf /etc/default/locale.conf | |
cd /etc/ | |
wget https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/locale.gen > /dev/null 2>&1 | |
locale-gen | |
cd /etc/default/ | |
wget https://raw.githubusercontent.com/lvwuwei/LocaleCN/master/locale.conf > /dev/null 2>&1 | |
cp locale.conf locale | |
fi | |
# Echo Success | |
clear | |
echo "Your VPS Language setting is changed to Chinese(Simplified)" | |
echo "Reconnect to your VPS to check it" | |
echo "" | |
echo "Powered By byy3.com " | |
echo "QQ: 448632440" | |
# Delete self | |
cd ${dir} | |
rm -rf LocaleCN.sh |
一键中文脚本源代码脚本