2018.06.10 - zabbix的安装

前面实际操作了 LAMP(mysql5.6,php5.6)的安装,基本安装运行都没什么问题。

于是今天开始在原来的环境上安装zabbix(3.5版本),结果运行失败。甚至系统都出现了问题,不能reboot、poweroff。

也可能是远程虚拟机的问题,也可能是我所安装的环境和zabbix所需求的环境不一致造成的。

不过不管了,直接将原来的虚拟机删除了,从头来过!!!


安装起来还是很快的,毕竟是最小化安装。配置下网卡,连上网络。


转到XSHELL操作了,先完成基本的升级---yum update。

查看当前系统环境 

安装LAMP环境

yum install epel-release

yum install mariadb mariadb-server php php-mysql httpd


查看环境版本:



初始化mysql数据库,并配置root用户密码


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the currentpassword for the root user.  If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank,so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password: 
Re-enter new password: 

Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB installation should now be secure.
Thanks for using MariaDB!


创建zabbix数据库及其用户



测试刚刚创建的zabbix用户,是否可以连接mysql数据库


启动Apache服务

systemctl start httpd

netstat –tunl

firewall-cmd --zone=public --add-port=80/tcp –permanent

firewall-cmd --reload

安装zabbix的yum源(这里选择的是最新版本3.5)

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

安装zabbix

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

数据库导入

zcat /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql -uzabbix -p zabbix

配置数据库用户及密码

vi /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix

DBPassword=zabbix

SELinux配置(最终还是关闭了)

setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on

编辑Zabbix前端PHP配置,更改时区
vim /etc/httpd/conf.d/zabbix.conf

php_value date.timezone Asia/Shanghai

重启Apache、zabbix服务

浏览器访问 http://10.50.8.230/zabbix,终于出现了这个页面了!


2018.06.12

基本设置了一下,使用正常。(报警很多....)






Zabbix是一款开源的网络监控和报警系统,可以用于监控服务器、网络设备、虚拟机等。下面是Linux系统上安装Zabbix的操作步骤: 1. 安装所需软件: - 在Debian/Ubuntu系统上,使用以下命令安装所需软件: ``` sudo apt-get update sudo apt-get install apache2 mysql-server mysql-client php php-mysql php-gd php-xml php-bcmath php-mbstring php-ldap php-xmlrpc ``` - 在CentOS/RHEL系统上,使用以下命令安装所需软件: ``` sudo yum install httpd mariadb-server mariadb php php-mysql php-gd php-xml php-bcmath php-mbstring php-ldap php-xmlrpc ``` 2. 配置数据库: - 启动并设置MariaDB/MySQL服务: ``` sudo systemctl start mariadb sudo systemctl enable mariadb ``` - 运行以下命令来设置MariaDB/MySQL的root密码和其他配置: ``` sudo mysql_secure_installation ``` - 创建一个新的数据库和用户: ``` sudo mysql -u root -p CREATE DATABASE zabbixdb character set utf8 collate utf8_bin; GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; EXIT; ``` 3. 下载和安装Zabbix Server: - 下载最新的Zabbix Server软件包: ``` wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb ``` - 安装Zabbix Server软件包: ``` sudo dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb sudo apt-get update sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent ``` 4. 导入Zabbix数据库模板: - 运行以下命令导入Zabbix数据库模板: ``` sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | sudo mysql -u zabbixuser -p zabbixdb ``` 5. 配置Zabbix Server: - 编辑Zabbix Server配置文件: ``` sudo nano /etc/zabbix/zabbix_server.conf ``` - 修改以下参数: ``` DBHost=localhost DBName=zabbixdb DBUser=zabbixuser DBPassword=password ``` - 保存并关闭文件。 6. 配置Zabbix Frontend: - 编辑Zabbix Frontend配置文件: ``` sudo nano /etc/zabbix/apache.conf ``` - 修改以下参数: ``` php_value date.timezone Asia/Shanghai ``` - 保存并关闭文件。 7. 启动Zabbix服务: - 启动Zabbix Server和Zabbix Agent服务: ``` sudo systemctl start zabbix-server sudo systemctl enable zabbix-server sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent ``` 8. 访问Zabbix Web界面: - 打开Web浏览器,访问以下URL: ``` http://服务器IP地址/zabbix ``` - 根据安装向导完成Zabbix的初始化配置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值