标签:使用 character lld word 查看 usr ESS 编码 httpd
系统环境[root @ zabbix-server~] # systemctl disable firewalld.service
[root @ zabbix-server~] # systemctl stop firewalld.service
#关闭系统防火墙
[root @ zabbix-server~] # setenforce 0
[root @ zabbix-server~] # vim / etc / selinux / config
修改成:SELINUX = disabled
#关闭Selinux安全策略
首先配置lamp环境
分别安装 apache mysql php,并开启服务,设置自启,并检查有无错误.
[root@zabbix ~]# yum install -y httpd
[root@zabbix ~]# systemctl enable httpd
[root@zabbix ~]# systemctl restart httpd
[root@zabbix ~]# yum install mariadb mariadb-server mariadb-libs mariadb-devel
[root@zabbix ~]# systemctl restart mariadb.service
[root@zabbix ~]# systemctl enable mariadb.service
[root@zabbix ~]# yum install -y php php-mysql php-fpm
[root@zabbix ~]# systemctl restart php-fpm
[root@zabbix ~]# systemctl enable php-fpm
测试lamp环境是否ok,在以上环节启动服务都没报错的情况下,在apache默认网站服务器下,输入以下测试内容,重启httpd,在网页上显示以下内容就表示ok.
[root@zabbix ~]# vim /var/www/html/index.php
<?php
phpinfo();
?>
[root@zabbix ~]# systemctl restart httpd
安装配置数据库
为了安全性,使用zabbix账户创建zabbix数据库
[root@zabbix ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> insert into mysql.user(Host,User,Password) values("localhost","zabbix",password("mimimama"));
Query OK, 1 row affected, 4 warnings (0.01 sec)
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by "mimimama";
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
以上内容
mysql -u root -p
#用root登录,默认无密码,所以按两下回车即可
insert into mysql.user(Host,User,Password) values("localhost","zabbix",password("mimimama"));
#添加一个mysql用户zabbix并设置密码为mimimama
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
#创建zabbix数据库并且编码为utf8
flush privileges;
Query OK, 0 rows affected (0.00 sec)
#刷新数据库
grant all on zabbix. to zabbix@localhost identified by "mimimama";
Query OK, 0 rows affected (0.00 sec)
#grant 权限 on 数据库. to 用户名@登录主机 identified by "密码";
flush privileges;
Query OK, 0 rows affected (0.00 sec)
#再刷新次数据库,使权限的设定生效
quit
#退出数据库
测试是否生效
[root@zabbix ~]# cat /var/www/html/index.php
<?php
$link=mysql_connect(‘127.0.0.1‘,‘zabbix‘,‘mimimama‘);
if($link) echo "<h1>Success!!</h1>";
else echo "hahahahaha";
mysql_close();
?>
安装配置zabbix
如果要安装某个版本的话请自行在浏览器输入 http://repo.zabbix.com/zabbix/在里面找相关版本
安装zabbix所需要EPEL源和zabbix的yum源
[root@zabbix ~]# yum install -y php-mbstring
[root@zabbix ~]# yum install -y php-bcmath
或者是
rpm -ivh php-mbstring-5.4.16-42.el7.x86_64.rpm
rpm -ivh php-bcmath-5.4.16-42.el7.x86_64.rpm
接下来
[root@zabbix ~]# rpm -ivh zabbix-web-4.4.0-1.el7.noarch.rpm
[root@zabbix ~]# rpm -ivh zabbix-server-mysql-4.4.0-1.el7.x86_64.rpm
[root@zabbix ~]# rpm -ivh zabbix-web-mysql-4.4.0-1.el7.noarch.rpm
RPM安装需要安装依赖包用yum本地直接安装。
[root@zabbix ~]# cd /usr/share/doc/
[root@zabbix doc]# ls |grep zabbix-server
zabbix-server-mysql-4.4.0
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-4.4.0/create.sql.gz | mysql -uzabbix -p -h 127.0.0.1 zabbix
Enter password:
[root@zabbix ~]#
修改时区,修改zabbix_server.conf的配置文件
[root@zabbix ~]# cat /etc/php.ini | grep date.timezone
; http://php.net/date.timezone
;date.timezone =
[root@zabbix ~]# vim /etc/php.ini
[root@zabbix ~]# cat /etc/php.ini | grep date.timezone
; http://php.net/date.timezone
date.timezone = PRC
[root@zabbix ~]# cat /etc/httpd/conf.d/zabbix.conf | grep date.timezone
[root@zabbix ~]# vim /etc/httpd/conf.d/zabbix.conf
[root@zabbix ~]# cat /etc/httpd/conf.d/zabbix.conf | grep date.timezone
php_value date.timezone Asia/Shanghai
[root@zabbix zabbix]# vim /etc/zabbix/zabbix_server.conf
找到DBPassword取消注释并输入之前设置的密码,之前设置的是mimimama,不用加引号
设置服务开机自启动,重启服务,查看端口是否已开始监听
[root@zabbix ~]# systemctl restart zabbix-server.service
[root@zabbix ~]# systemctl enable zabbix-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
root@zabbix ~]# systemctl restart httpd
接下来在浏览器中输入http://192.168.1.12/zabbix/
mariadb端口号为3306,数据库名zabbix,用户zabbix
默认账号Admin,密码zabbix
修改语言的话右上角点击
然后修改为中文即可
如果直接输入ip地址的话访问的还是之前的hahahaha界面,如果想直接输入ip就访问zabbix监控的话只需要修改httpd.conf文件即可
[root@zabbix zabbix]# whereis zabbix
zabbix: /usr/lib/zabbix /etc/zabbix /usr/share/zabbix
[root@zabbix zabbix]# whereis zabbix
[root@zabbix zabbix]# vim /etc/httpd/conf/httpd.conf
#编辑配置文件
DocumentRoot "/usr/share/zabbix"
#将DocumentRoot 之前的/var/www/html改为/usr/share/zabbix
[root@zabbix zabbix]# systemctl restart httpd
#最后重启apache服务即可
标签:使用 character lld word 查看 usr ESS 编码 httpd
原文地址:https://blog.51cto.com/chinak/2503740