Centos系统下载大全 | Redhat系统下载大全 | Windows2012系统下载大全 | Windows2008系统下载大全| CMS教程 | 网站地图 51运维网-专注Linux/Unix系统安全运维!
当前位置:51运维网 > 监控 > Zabbix > 正文

Zabbix 3.0.3 LTS安装/配置/2.x升级

时间:2016-05-30 17:48 来源:未知 作者:Zabbix 阅读:

环境准备:

操作系统:CentOS 7或以上

一.安装mysql

 

1.建立Mysql账号

groupadd mysql

useradd -s /sbin/nologin -g mysql -M mysql

 

2.创建mysql软件目录并修改权限

mkdir -p /usr/local/mysql

mkdir -p /data/mysql

chown -R root:mysql /usr/local/mysql

chown -R mysql:mysql /data/mysql

 

3.安装依赖包

yum -y install make gcc-c++ cmake bison-devel  ncurses-devel

 

4.下载源码包并解压

http://mirrors.sohu.com/mysql/

cd /usr/local/src

tar -zxf mysql-5.7.11.tar.gz

cd mysql-5.7.11

 

5.编译

cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DMYSQL_DATADIR=/data/mysql \

> -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci \
> -DEXTRA_CHARSETS=all \
> -DENABLED_LOCAL_INFILE=1 \
> -DDOWNLOAD_BOOST=1 \
> -DWITH_BOOST=/usr/local/boost
 

6.安装
make && make install
 

7. 初始化MySQL

cd /usr/local/mysql/bin
./mysqld --initialize   --user=mysql --datadir=/mysql/data --basedir=/usr/local/mysql --socket=/var/lib/mysql/mysql.sock

8. 添加MySQL服务并设置开机启动

cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysqld
cd /etc/init.d/

chkconfig --add mysqld

chkconfig --level 2345 mysqld on

 

9. 编辑my.cnf文件
vi /etc/my.cnf

[mysqld]

port = 3306

socket = /var/lib/mysql/mysql.sock

user = mysql

basedir = /usr/local/mysql

datadir = /data/mysql

log-error = /var/log/mysql/mysqld.log

skip-external-locking

key_buffer_size = 16M

max_allowed_packet = 1M

table_open_cache = 64

sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_size = 256K

read_rnd_buffer_size = 512K

myisam_sort_buffer_size = 8M

thread_cache_size = 8

query_cache_size = 8M

tmp_table_size = 16M

 

#skip-networking

max_connections = 500

max_connect_errors = 100

open_files_limit = 65535

 

log-bin=mysql-bin

binlog_format = mixed

server-id = 1

expire_logs_days = 10

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

[myisamchk]

key_buffer_size = 20M

sort_buffer_size = 20M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

 

10. 重启MySQL
/etc/init.d/mysql start
Starting MySQL.. SUCCESS! 

11. 登录MySQL
cd ../bin/
./mysql -uroot -p //第一次登录MySQL,密码文件在,也可以从make install 最后的一行看到密码,若看不到可以参考以下修改密码的步骤
Enter password: 
 

12.忘记root密码可通过以下方法修改

vi /etc/my.cnf

[mysqld]

skip-grant-tables 

重启mysqld服务,重新登陆已不需要密码

 

13.修改root密码

use mysql

update user set authentication_string=PASSWORD('zabbix') where User='root';

 

14.退出删除mysql.cnf中的skip-grant-tables,以新密码重新登陆即可

 

15.首次登陆需要重新设置一下新密码,否则任何命令都会提示:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

set password for root@localhost = password('zabbix'); 

 

 

16.创建zabbix数据库

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

 

二.安装Zabbix

1.安装官方的yum源

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

 

2.yum安装zabbix-server\zabbix-web\zabbix-agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

 

3.初始化数据库

 

cd /usr/share/doc/zabbix-server-mysql-3.0.*

zcat create.sql.gz | mysql -uroot -pzabbix zabbix

 

4.编辑zabbix server配置文件

vi /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

 

5.开启zabbix server以及agent服务并设置开机启动

systemctl start zabbix-server

systemctl enable zabbix-server

systemctl start zabbix-agent

systemctl enable zabbix-agent

 

6.确保php的配置符合zabbix的要求(默认已含下列配置),并修改timezone为PRC

vi /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 300

php_value memory_limit 128M

php_value post_max_size 16M

php_value upload_max_filesize 2M

php_value max_input_time 300

php_value always_populate_raw_post_data -1

php_value date.timezone Asia/Shanghai

 

7.开启Apache服务并设置开机启动

systemctl start httpd

systemctl enable httpd

 

8.打开zabbix页面http://192.168.17.100/zabbix/,首次要求初始化

 

wKioL1dL6CLQulOgAABUQ4XtQv8359.png

PHP检查通过

wKioL1dL6CKyDvpgAAB_I7GtNyQ543.png

连接mysql数据库

wKiom1dL5yfgEdGoAABo17anfRs954.png

确保mysql.sock协议文件在/var/lib/mysql/下,如果不在可通过my.cnf修改

wKioL1dL6COShrfOAACDYXbSWps300.png

wKiom1dL5yjj7S7SAAAUh8tWVqA401.png

自定义zabbix server的细节

wKioL1dL6CTyOTQzAABWTlrRckU971.png

wKiom1dL5ynSp29IAAB2EkK3ZVg838.png

初始化完成

进入zabbix界面

wKiom1dL5ymBbVQ6AABU-U9x6qk478.png

wKioL1dL6CXCTTz2AADgMwiWNMg472.png

wKiom1dL5yqRjUzjAADZziGG9Dg606.png

 

9.修改语言

Zabbix 3.0.3可以直接在界面上修改为简体中文

wKioL1dL6CWyvJrLAACK5iKSCd4081.png

 

三.Agent安装

 

1.Linux OS rpm包安装

rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

yum install zabbix-agent -y

sed -i 's/^Server=.*/Server=192.168.17.100/g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^ServerActive=.*/ServerActive=192.168.17.100/g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^Hostname=.*/Hostname=TestHost/g' /etc/zabbix/zabbix_agentd.conf
service zabbix-agent start

 

2.Windows OS agent设置

http://www.zabbix.com/downloads/3.0.0/zabbix_agents_3.0.0.win.zip

修改zabbix_agent\conf\zabbix_agentd.win.conf中的hostname

在cmd窗口运行以下命令(64位\32位)

"C:\Program Files\zabbix\bin\win64\zabbix_agentd.exe"  -c  "C:\Program Files\zabbix\conf\zabbix_agentd.win.conf" -i

"C:\Program Files\zabbix\bin\win64\zabbix_agentd.exe"  -c  "C:\Program Files\zabbix\conf\zabbix_agentd.win.conf" -s

感谢您对【51运维网 http://www.51ou.com/】的支持,我们为您免费提供《Zabbix 3.0.3 LTS安装/配置/2.x升级》技术文章,《Zabbix 3.0.3 LTS安装/配置/2.x升级》详细使用和说明,有时《Zabbix 3.0.3 LTS安装/配置/2.x升级》可能不完善、敬请谅解!如果《Zabbix 3.0.3 LTS安装/配置/2.x升级》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
验证码:点击我更换图片