1:安装准备
Zabbix需要的LNMP环境可以使用脚本或source code安装,前者较快, 在CentOS 7.x上大约1小时,源码安装比较慢。
系统和软件版本:
CentOS 7.x 在IBM Cloud上创建的虚机,测试中使用瞬态配置,上线时用Public型。 mysql-5.7.29.tar.gznginx-1.16.1.tar.gzphp-7.2.27.tar.gzzabbix-4.4.5.tar.gzgrafana-7.1.5-1.x86_64.rpmalexanderzobnin-zabbix-app version: 4.0.1(1) 关闭防火墙和linux
(2)创建安装目录和用户
mkdir -pv /tools/{ mysql-5.7,nginx-1.16,php-7.2,zabbix-4.4}mkdir -pv /tools/mysql-5.7/dataln -s /tools/mysql-5.7 /tools/mysqlln -s /tools/nginx-1.16 /tools/nginxln -s /tools/php-7.2 /tools/phpln -s /tools/zabbix-4.4 /tools/zabbixuradd -s /sbin/nologin mysqluradd -s /sbin/nologin nginxuradd -s /sbin/nologin zabbix
2:安装mysql
cd toolswget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.29.tar.gzwget https://dev.mysql.com/get/Downloads/M小说资料ySQL-5.7/mysql-boost-5.7.29.tar.gzyum install -y cmake gcc gcc-c++ openssl-devel ncurs-develtar xvf mysql-5.7.29.tar.gztar xvf mysql-boost-5.7.29.tar.gz -C /tools/cd mysql-5.7.29cmake \-DCMAKE_INSTALL_PREFIX=/tools/mysql-5.7 \-DMYSQL_DATADIR=/tools/mysql-5.7/data \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_unicode_ci \-DWITH_READLINE=1 \-DWITH_SSL=system \-DWITH_EMBEDDED_SERVER=1 \-DENABLED_LOCAL_INFILE=1 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_DEBUG=0 \-DWITH_BOOST=/tools/mysql-5.7.29/boost/boost_1_59_0make & make install
创建需要的文件及更改属主和属组
mkdir -pv /tools/mysql/logtouch /tools/mysql/log/mariadb.logtouch /tools/mysql/log/mariadb.pidchown -R mysql /tools/{ mysql-5.7,mysql-5.7.29,mysql}
(5) 初始化数据,修改配置文件
vim /etc/my.cnf[mysqld]datadir=/tools/mysql/data #数据目录位置socket=/tools/mysql/mysql.sock #sock文件的路径skip-grant-tables #跳过登录认证ur=mysqlexplicit_defaults_for_timestamp=true[mysqld_safe]log-error=/tools/mysql/log/mariadb.log #错误日志位置pid-file=/tools/mysql/log/mariadb.pid
(6) 添加环境变量
vim /etc/profile //末尾添加两行export PATH=$PATH:/tools/mysql/support-filesexport PATH=$PATH:/tools/mysql/bin保存退出刷新环境变量 source /etc/profile/
(7) 初始化启动mysql
mysqld --initialize --ur=mysql --badir=/tools/mysql --datadir=/tools/mysql/datamysql.rver start//记住此处系统自动生成的临时密码ln -s /tools/mysql/mysql.sock /tmp/
(8) 下载zabbix源码包并解压
wget /d/file/titlepic/ xvf zabbix-4.4.5.tar.gzcd zabbix-4.4.5/databa/mysql
登录mysql:
mysql -u root -p
输入刚才记录的密码,登录后执行以下命令:
u mysql;create databa zabbix default character t utf8;update mysql.ur t authentication_string=password('修改的密码') where ur='root';u zabbix;source schema.sql;source images.sql;source data.sql;exit;
最后恢复密码登录mysql 修改文件,重启mysql服务
vim /etc/my.cnf//去掉 skip-grant-tablesmysql.rver restart
//下次登录mysql需要修改密码
mysql> SET PASSWORD = PASSWORD('new-password');
添加lib文件
echo “/tools/mysql/lib” > /etc/ld.so.conf.d/mysql.confldconfig -v
3:安装nginx
(1) 下载 nginx 并解压
cd toolswget http://nginx.org/download/nginx-1.16.1.tar.gztar xvf nginx-1.16.1.tar.gz
(2) 编译安装并添加环境变量
cd nginx-1.16.1./configure --prefix=/tools/nginx-1.16 --ur=nginx --group=nginx --without-lect_module --without-poll_module --with-http_ssl_module --with-pcre --with-debugmake make install
添加变量
vim /etc/profile //追加一行export PATH=$PATH:/tools/nginx/sbinsource /etc/profile
(3)更改 nginx 的属主和属组以及修改配置文件
chown nginx:nginx -R /tools/nginx-1.16
修改配置文件
vim /tools/nginx/conf/nginx.conf
修改启动用户 ur nginx;
启动nginx:
nginx
4:安装php
(1) 下载php源码并井进行解压
cd /toolswget https://www.php.net/distributions/php-7.2.27.tar.gztar xvf p用餐hp-7.2.27.tar.gz
(2) 安装及解决依赖
yum install -y libxml2-devel openssl-devel net-snmp net-snmp-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel bzip2 bzip2-devel freetype-devel gmp-devel readline-devel libxslt-devel fontconfigcd php-7.2.27./configure --prefix=/tools/php-7.2 --with-mysqli=/tools/mysql/bin/mysql_config --enable-inline-optimization --enable-fpm --enable-soap --enable-pcntl --enable-xml --with-libxml-dir --with-xmlrpc --with-openssl --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --en请不要和我说话able-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-freetype-dir --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-ssion --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvm --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --without-pear make mak湖南高考分数e install
(3) 拷贝服务和配置文件,设置属主和属组
cp /tools/php-7.2.27/sapi/fpm/php-fpm.rvice /usr/lib/systemd/system/php-fpm.rvicecp /tools/php-7.2/etc/{ php-fpm.conf.default,php-fpm.conf}cp /tools/php-7.2/etc/php-fpm.d/www.conf{ .default,}cp php.ini-production /tools/php-7.2/lib/php.inichown nginx:nginx -R /tools/php-7.2
(4) 修改配置文件并启动
vim /tools/php/lib/php.ini //修改如下4行post_max_size = 16Mmax_execution_time = 300max_input_time = 300date.timezone =赞美祖国 PRC
systemctl start php-fpm.rvice && systemctl enable php-fpm.rvice
vim /tools/nginx/conf/nginx.conf location ~ \.php$ { root /tools/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /tools/nginx/html$fastcgi_script_name; include fastcgi_params; }
vim /tools/nginx/html/index.php <?php phpinfo(); ?>
nginx -s reload
5:安装Zabbix Server
(1) 安装依赖,编译安装
yum localinstall -y libevent-devel-2.0.21-4.el7.x86_64.rpmyum install unixODBC-devel mysql-devel net-snmp-devel libxml2-devel libcurl-devel libevent-devel -ycd zabbix-4.4.5./configure --prefix=/tools/zabbix-4.4 --enable-rver --enable-agent --with-mysql=/tools/mysql/bin/mysql_config --enable-ipv6 --with-netsnmp --with-libcurl --with-libxml2make make install
(2) 配置环境变量
vim /etc/profile//追加如下行export PATH=$PATH:/tools/zabbix/sbinsource /etc/profile
(3) 修改配置文件
vim /tools/zabbix/etc/zabbix_rver.conf DBUr=rootDBPassword=theDBpassword拷贝zabbix至nginx的目录下,重启nginx服务;cd /tools/zabbix-4.4.5cp -R frontends/php/* /tools/nginx/html/nginx -s reload
访问页面ok即可。
(4)登录
账户为 admin 密码zabbix
登录后界面为/d/file/titlepic/r2.php /> 注意:
# mysql -uroot -p -e "grant all on zabbix.* to 'zabbix'@localhost identified by 'zabbix'"Enter password:
安装Zabbix agentcd /toolswget https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-agent-4.4.5-1.el7.x86_64.rpmsystemctl stop firewalldsystemctl disable firewalld.rvicegrep SELINUX /etc/linux/configSELINUX=disabledrpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-agent-4.4.5-1.el7.x86_64.rpmvi /etc/zabbix/zabbix_agentd.conf# Server=StartAgents=0ServerActive=<rver's-IP-addr>Hostname=dallasrvice zabbix-agent startchkconfig zabbix-agent on
安装Grafanawget https://dl.grafana.com/oss/relea/grafana-7.1.5-1.x86_64.rpmyum install grafana-7.1.5-1.x86_64.rpmsystemctl start grafana-rversystemctl status grafana-rversystemctl enable grafana-rver
登录UI,默认用户名/口令为admin/admin
安装Grafana-Zabbix plugingrafana-cli plugins list-remote|grep zabbixgrafana-cli plugins install alexanderzobnin-zabbix-appgrafana-cli plugins install grafana-clock-panelsystemctl restart grafana-rver
配置Zabbix数据源,开启监控。
本文地址:https://blog.csdn.net/weixin_46707197/article/details/111996548
本文发布于:2023-04-09 00:56:42,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/7d8de3b7843fb0e4487917931903e7d6.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:IBM Cloud上基于Grafana和Zabbix的监控环境安装.doc
本文 PDF 下载地址:IBM Cloud上基于Grafana和Zabbix的监控环境安装.pdf
留言与评论(共有 0 条评论) |