- 首先安装Apache、php、mysql,构建LAMP环境
1234567
sudo
apt-get
install
apache2
安装完成末尾,有如下信息:
* Starting web server apache2
AH00558: apache2: Could not reliably determine the server
's fully qualified domain name, using 127.0.1.1. Set the '
ServerName' directive globally to suppress this message
*
123451、在
/etc/apache2/
下新建httpd.conf文件,内容为:ServerName 127.0.0.1
2、修改
/etc/apache2/apache2
.conf文件在
IncludeOptional mods-enabled/*.conf后边增加如下:
# Include all the user configurations:
Include
/etc/apache2/httpd
.conf
-
sudo /etc/init.d/apache2 restart
-
sudo apt-get install php5
-
sudo apt-get install libapache2-mod-php5
-
sudo apt-get install mysql-server(openstack已安装就不要安装了。设置密码和重复密码:root)
-
sudo apt-get install libapache2-mod-auth-mysql
-
sudo apt-get install php5-mysql
-
sudo /etc/init.d/apache2 restart
-
sudo ls /etc/apache2/mods-enabled 看到php5.conf 和 php5.load说明OK
-
这里还需要配置下/etc/php5/apache2/php.ini
1234567;
date
.timezone ===>去掉注释在=后添加 Asia
/Shanghai
max_input_time =600
max_execution_time= 600
post_max_size =32M
-
1
sudo
/etc/init
.d
/apache2
restart
- ZABBIX安装
- sudo apt-get install zabbix-server-mysql
123456789101112131415
安装过程很安静,没有出现网上说的会输入2-3次数据库的密码,
sudo
/etc/init
.d
/zabbix-server
start
会出现:
* zabbix_server is disabled
in
/etc/default/zabbix-server
.
查看相关文件:
sudo
vim
/etc/default/zabbix-server
#如下一段
# This is by default set to "no" because a MySQL database needs to be prepared
# and configured before you can start the Zabbix server for the first time.
#
# Instructions on how to set up the database can be found in
# /usr/share/doc/zabbix-server-mysql/README.Debian
START=no
被设成no了,当然启动不了,改成
yes
-
这还没完呢,因为数据库什么的没有设置
1234567891011121314151617181920212223查看相关文件:
cat
/usr/share/doc/zabbix-server-mysql/README
.Debian可以看到相关信息:
-> apt-get
install
mysql-server
Create a new database (
let
's call it
"zabbix"
):
-> mysql -p -e
"create database zabbix character set utf8"
Create a MySQL user that has access rights to the database
(please use another password than
'SECRETPASSWORD'
):
-> mysql -p -e
"grant all on zabbix.* to 'zabbix'@'localhost' identified by 'SECRETPASSWORD'"
Create the database schema:
-> zcat
/usr/share/zabbix-server-mysql/
{schema,images,data}.sql.gz \
| mysql -uzabbix -pSECRETPASSWORD zabbix
我们照着做就好(不过我加上了用户名,因为我当前登录账户不是root,如果是的话就不用加上):
mysql -uroot -p -e
"create database zabbix character set utf8"
mysql -uroot -p -e
"grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'"
zcat
/usr/share/zabbix-server-mysql/
{schema,images,data}.sql.gz | mysql -uzabbix -pzabbix zabbix(等待一小会)
-
sudo /etc/init.d/zabbix-server start (成功!)
-
接着安装zabbix网站
123456<strong>
sudo
apt-get
install
zabbix-frontend-php
又是安静静的装完了,没有让输入什么root之类,于是,手动拷贝到apache目录下:
sudo
cp
-r
/usr/share/zabbix
/var/www/html/zabbix
重启zabbix
sudo
/etc/init
.d
/zabbix-server
stop
sudo
/etc/init
.d
/zabbix-server
start<
/strong
>
-
第三步:Port 3306,password,user 都是root
-
下载之后把文件放到/etc/zabbix/目录下,刷新页面,如果出现:configration file error:permission deny .那说明还得给该文件权限:我就暴力点:
1sudo
chmod
755 zabbix.conf.php
-
OK,终于可以了。登录用户名密码admin/zabbix
-
最后,安装zabbix客户端
12345<strong>
sudo
apt-get
install
zabbix-agent
安装客户端后,若不是服务器本机,都需要修改zabbix配置文件
/etc/zabbix/zabbix_agent
.conf和
/etc/zabbix/zabbix_sagentd
.conf的一行
server=zabbix服务端地址或域名<
/strong
>
-
可能遇到的问题
123解决方法:
1.在页面上设置“组态->主机”将主机设置为监控客户端的机器
hostname
。
2.
/etc/zabbix/zabbix_agent
.conf 中的
hostname
与1中设置的一致。
-
中文汉化问题:如果选择中文之后出现乱码或者页面出现 zabbix : imagettftext():Could not find/open font [map.php: 这样的东东,都是字体的问题,下载truetype的字体(微软雅黑),然后替换 /var/www/html/zabbix/fonts目录下的DejaVuSans.ttf,把你新下载的字体也写成DejaVuSans.ttf这个名字。最后,发现zabbix 的翻译真是蛋疼啊,下载一个修改过的汉化文件,替换/var/www/html/zabbix/locale/zh_CN/LC_MESSAGES下边的po和mo,下载地址:http://www.zabbix.net.cn/download/file.php?id=70&sid=a70c6d6cea3e789903181e0e12f28bfd
监控 zabbix安装篇
最新推荐文章于 2024-08-08 18:03:40 发布
备注:本次安装使用的是Ubuntu OS