zabbix 安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix 安装相关的知识,希望对你有一定的参考价值。

【前言】
epel 源:
阿里云
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum 源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
一、LNMP 之 nginx 安装
1)依赖包:
yum install openssl openssl-devel pcre pcre-devel
2)下载nginx
3)解压并进入目录
tar xf ......
cd .......
4)建用户
useradd nginx -g nginx -s /sbin/nologin -M
5)编译并安装
mkdir /application
./configure --user=myssql --with-http_stub_status_module --with-http_ssl_module --prefix=/application/nginx
make && make install
二、LNM 之 mysql 安装
1)依赖包
yum install ncurses-devel –y
2)下载、解压并进入目录
wget ./mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
tar xf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
cd mysql-5.6.14-linux-glibc2.5-x86_64
3)初始化数据库并配置my.cnf、mysql.server
./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysqldata --defaults-file=/etc/my.cnf
mysql.server ------启动数据库的脚本
my-default.cnf 配置文件,直接复制到 /etc/my.cnf
配置 my.cnf
basedir = /application/mysql
datadir = /application/mysql/data
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
配置 mysql.server
basedir = /application/mysql
datadir = /application/mysql/data
4)启动数据库并测试
./mysql.server start
mysql -uroot -p
[[email protected] tmp]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 796
Server version: 5.6.14 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql>
数据库安装完毕!!!!!!!
三、LNMP 之 php 安装
1)依赖包
yum install –y libxml2-devel gd-devel libmcrypt-devel libcurl-devel libjpeg-devel libpng-devel libtool-ltdl-devel libticonv-devel *iconv* bzip2 bzip2-devel
2)下载、解压并进入目录
5.5.25
3)编译并安装
./configure --prefix=/application/php --with-config-file-path=/application/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
make && make install
4)配置 php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = PRC
5)启动测试
/application/php/sbin/php-fpm
ss -lntup|grep php
ps -ef |grep php
六、LNMP 之 nginx 整合 php
vi nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

 

第二步:安装服务端

 

一、依赖包
yum install -y mysql-devel libxml2-devel curl-devel unixODBC-devel net-snmp-devel OpenIPMI-devel
二、下载zabbix 2.2.2
tar xf zabbix2.2.2.tar.gz
cd zabbix
四、编译
./configure --prefix=/application/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
五、安装
make &&make install
六、配置
1)创建ZABBIX用户
useradd zabbix -g zabbix -s /sbin/nologin -M
2)建库并导入数据
mysql -uroot -p123456
create database zabbix default charset utf8;
grant all privileges on zabbix.* to [email protected] identified "123456";
quit
mysql -uroot -pttlsapwd zabbix < database/mysql/schema.sql
mysql -uroot -pttlsapwd zabbix < database/mysql/images.sql
mysql -uroot -pttlsapwd zabbix < database/mysql/data.sql
3)配置zabbix_server.conf
vi /application/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=root
DBPassword=123456
DBPort=3306
七、启动zabbix
/application/zabbix/sbin/zabbix_server

 第三步:安装客户端

 

# cd /usr/local/src

 

# wget
http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz?r=http%3A%2F%2Fwww.zabbix.com%2Fdownload.php&ts=1395066528&use_mirror=jaist
# tar -xzvf zabbix-2.2.2.tar.gz
# cd zabbix-2.2.2
# ./configure --prefix=/usr/local/zabbix-2.2.2/ --enable-agent
# make
# make install
配置文件
vim /application/zabbix/etc/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
启动
/application/zabbix/etc/zabbix_agentd
查看
ss -lntup|grep zabbix_agentd

 

安装完毕!打开网页测试 

 

以上是关于zabbix 安装的主要内容,如果未能解决你的问题,请参考以下文章

zabbix安装

linux12 - zabbix -- zabbix安装01

如何在windows下安装zabbix

Zabbix——Zabbix的安装和基本配置

zabbix安装后怎么添加监控

zabbix的基本安装