前言:
当前同学们对“centos中文字体安装”大约比较关心,你们都想要知道一些“centos中文字体安装”的相关内容。那么小编在网络上收集了一些关于“centos中文字体安装””的相关内容,希望看官们能喜欢,看官们一起来学习一下吧!为了方便把安装Zabbix的过程整理成自动化一键部署脚本,有兴趣可以参考,
都是些基本的命令:
vi install.sh
########以下是脚本内容##################
#!/bin/bash
#Zabbix 一键部署脚本
#安装zabbix3.4
#for Centos7
echo -n "正在配置iptables防火墙……"
systemctl stop firewalld > /dev/null 2>&1
systemctl disable firewalld > /dev/null 2>&1
if [ $? -eq 0 ];then
echo -n "Iptables防火墙初始化完毕!"
fi
echo -n "正在关闭SELinux……"
setenforce 0 > /dev/null 2>&1
sed -i '/^SELINUX=/s/=.*/=disabled/' /etc/selinux/config
if [ $? -eq 0 ];then
echo -n "SELinux初始化完毕!"
fi
echo -n "正在设置时区,系统语言"
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& yum -y install kde-l10n-Chinese \
&& yum -y reinstall glibc-common \
&& localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8 \
&& export LC_ALL=zh_CN.UTF-8 \
&& echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
if [ $? -eq 0 ];then
echo -n "设置时区为上海,系统语言zh_CN.UTF-8!"
fi
#echo -n "正在配置源为192.168.20.237……"
#sed -e "s/^metalink=/#metalink=/g" \
# -e "s/^mirrorlist=http/#mirrorlist=http/g" \
# -e "s@^#baseurl=@baseurl=@g" \
# -e "s@" \
# -i /etc/yum.repos.d/*.repo > /dev/null 2>&1
#if [ $? -eq 0 ];then
# echo -n "已经配置源为192.168.20.237!"
#fi
echo -n "正在安装zabbix mariadb ……"
rpm -ivh
yum install -y zabbix-server-mysql zabbix-proxy-mysql zabbix-web-mysql zabbix-agent mariadb* wget bash-completion
if [ $? -eq 0 ];then
echo -n "zabbix 及mariadb 包己安装!"
systemctl enable mariadb
fi
systemctl start mariadb
if [ $? -eq 0 ];then
echo -n "Mariadb启动完毕!"
fi
#echo -n "正在为mysql的root用户设置密码……"
#mysql_user_root_password="password"
#mysql_user_zabbix_password="zabbix"
#mysqladmin -uroot -p password $mysql_user_root_password
echo "正在执行mysql语句,创建zabbix数据库,授权zabbix访问数据库"
mysql -e "create database zabbix character set utf8;grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';flush privileges;"
#echo "正在执行mysql语句,创建zabbix数据库,授权zabbix访问数据库"
#mysql -uroot -p"$mysql_user_root_password" -e "create database zabbix character set utf8" && echo "创建zabbix数据库完成"
#mysql -uroot -p"$mysql_user_root_password" -e "grant all privileges on zabbix.* to zabbix@localhost identified by '$mysql_user_zabbix_password'" && echo "授权zabbix本地登录数据库"
#mysql -uroot -p"$mysql_user_root_password" -e "grant all privileges on zabbix.* to zabbix@'%' identified by '$mysql_user_zabbix_password'" && echo "授权任何主机本地登录数据库"
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
if [ $? -eq 0 ];then
echo -n "zabbix数据导入启动完毕!"
fi
echo -n "正在配置zabbix配置文件...."
cd /etc/zabbix/
sed '/# DBHost=localhost/a\DBHost=localhost' zabbix_server.conf -i
sed '/# DBPassword=/a\DBPassword=zabbix' zabbix_server.conf -i
sed '/# EnableRemoteCommands=0/a\EnableRemoteCommands=1' zabbix_agentd.conf -i
sed '/# ListenPort=10050/a\ListenPort=10050' zabbix_agentd.conf -i
sed '/# User=zabbix/a\User=zabbix' zabbix_agentd.conf -i
sed '/# AllowRoot=0/a\AllowRoot=1' zabbix_agentd.conf -i
sed '/# UnsafeUserParameters=0/a\UnsafeUserParameters=1' zabbix_agentd.conf -i
if [ $? -eq 0 ];then
echo -n "zabbix配置完毕!"
fi
echo -n "正在启动zabbix_server and zabbix_agent...."
systemctl start zabbix-server.service
systemctl start zabbix-agent.service
systemctl enable zabbix-server.service
systemctl enable zabbix-agent.service
if [ $? -eq 0 ];then
echo -n "zabbix-server zabbix-agent 启动完毕!"
fi
echo -n "正在进行最后的zabbix Install ,php参数修改....."
sed '/^post_max_size =/s/=.*/= 16M/' /etc/php.ini -i
sed '/^max_execution_time =/s/=.*/= 300/' /etc/php.ini -i
sed '/^max_input_time =/s/=.*/= 300/' /etc/php.ini -i
sed -i '/^;date.timezone/a\date.timezone = Asia/Shanghai' /etc/php.ini
sed -i '/^;always_populate_raw_post_data.*/a\always_populate_raw_post_data = -1' /etc/php.ini
sed -i '/^mysqli.default_socket =/s/=.*/= \/var\/lib\/mysql\/mysql.sock/' /etc/php.ini
echo -n "正在启动httpd服务....."
systemctl start httpd
systemctl enable httpd
echo -n "正在安装中文字体支持包,解决zabbix server 乱码问题,请你耐心等待....."
yum groupinstall "fonts" -y
echo -n "使用文泉驿小黑字体"
ln -fs /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /etc/alternatives/zabbix-web-font
Server_IP=`ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`
echo -n "恭喜你,Zabbix 部署到此完成,如有问题,请参照脚本单独解决!!!"
echo -e -n "后续的操作:1、通过 访问你的zabbix Web页面,下一步....一直到底。数据库密码为zabbix,web登录默认帐号密码是admin,密码是zabbix。2、你可能需要配置域名,通过域名访问Zabbix Server.... 3、你需要自己自定义或者使用系统自带模板,添加主机等等...."
yum update -y
####################以上是脚本内容########################
脚本跑完没报错,在你的浏览器里输入:http://主机ip/zabbix/ 应该可以看到下面的页面:
点右上角小人图标admin
改语言为中文,点更新(update)。
界面变成中文了。
点配置中zabbix主机,改为己启用
点监控中--聚合图形
就可以看到
恭喜你的zabbix server安装成功,并可以使用了。
标签: #centos中文字体安装