1、安装LAMP
1
2
3
4
5
|
#关闭防火墙方便测试
yum
install
epel-release -y
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
|
1
2
3
4
|
#安装httpd
yum
install
httpd
systemctl start httpd.service
systemctl
enable
httpd.service
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#安装数据库5.6
wget http:
//dev
.mysql.com
/get/mysql-community-release-el7-5
.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum
install
mysql-community-server
systemctl restart mysqld.service
#设置msyql密码为 123456
mysql>
set
password
for
'root'
@
'localhost'
=password(
'123456'
);
#远程连接设置,所有以root账号连接的远程用户,设其密码为 123456
mysql> grant all on xxxx.* to
'root'
@
'%'
identified by
'123456'
with grant option;
#更新权限
mysql>flush privileges;
#数据库开机启动
systemctl
enable
mysqld.service
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#安装php
yum
install
php -y
#安装PHP组件,使PHP支持mysql
yum
install
php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash -y
#重启对应服务
systemctl restart mysqld.service
systemctl restart httpd.service
#以上 安装 apahce 、mysql 、php 安装完毕。
查看安装环境版本:
cd
/var/www/html
,新建index.php文件,输入:
<?php
phpinfo();
?>
|
2、安装zabbix
1
2
3
4
5
6
7
8
9
|
#安装zabbix server
rpm -ivh http:
//repo
.zabbix.com
/zabbix/3
.4
/rhel/7/x86_64/zabbix-release-3
.4-1.el7.centos.noarch.rpm
#安装Zabbix server and agent(agent是可选的)
yum
install
zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
vi
/etc/httpd/conf
.d
/zabbix
.conf
更新时区:
php_value
date
.timezone Asia
/Shanghai
#重启httpd
systemctl restart httpd
|
1
2
3
4
5
6
7
|
#创建MySQL 数据库和用户
mysql –u root –p
mysql> create database zabbix character
set
utf8;
mysql> grant all privileges on zabbix.* to
'zabbix'
@
'%'
identified by
'zabbix'
;
mysql> flush privileges;
|
1
2
3
4
5
6
7
8
9
10
|
#数据库导入zabbix template
#-p 后面的zabbix不是密码,而是选择zabbix数据库,导入都是数据表
zcat
/usr/share/doc/zabbix-server-mysql-3
.4.0
/create
.sql.gz | mysql -uzabbix -p zabbix
#Configure database for Zabbix server/proxy
# vi /etc/zabbix/zabbix_server.conf
DBHost=192.168.1.100
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
|
1
2
3
4
5
6
7
|
#Starting Zabbix server process
systemctl start zabbix-server
systemctl
enable
zabbix-server
#添加selinux设置
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
systemctl start httpd
|
1
2
3
4
5
6
7
8
|
#修改PHP 设置,后来再搭建多几次发现这个php设置可以不用更改
vi
/etc/php
.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 256
Mpost_max_size = 32M
upload_max_filesize = 16M
date
.timezone = Asia
/Shanghai
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#允许Zabbix web console 对特定IP段可用 (可选)
vi
/etc/httpd/conf
.d
/zabbix
.conf
如果设置 ‘Allow from All’, 这可以允许全部可以访问
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
php_value
date
.timezone Asia
/Shanghai
<
/IfModule
>
<
/Directory
>
<Directory
"/usr/share/zabbix/conf"
>
Require all denied
<
/Directory
>
<Directory
"/usr/share/zabbix/app"
>
Require all denied
<
/Directory
>
<Directory
"/usr/share/zabbix/include"
>
Require all denied
<
/Directory
>
<Directory
"/usr/share/zabbix/local"
>
Require all denied
<
/Directory
>
|
1
2
3
4
5
|
#前端web界面访问配置
http:
//192
.168.1.100
/zabbix/setup
.php
#zabbix默认账号和密码
The default user name is Admin, password zabbix.
|
1
2
3
4
5
6
7
|
#添加zabbix-agent,前面安装zabbix server的时候,一起yum安装了,现在只要修改一下数据即可
vim
/etc/hosts
添加
192.168.1.100 Zabbix server
service zabbix-agent start
chkconfig zabbix-agent on
|
本文转自 yanconggod 51CTO博客,原文链接:http://blog.51cto.com/yanconggod/1959796