今天新装一天ubuntu 准备安装zabbix 监控 然后用微信报警的方式发送报警信息

      安装ubuntu14.04  这个就不多说了  全程默认安装 装完后发现不能ssh 上去   

       需要用apt-get install ssh   apt-get install openssh-server   apt-get install openssh-client apt-get update

      然后重启  发现用root 不能ssh   修改 vim /etc/ssh/sshd_config  找到

PermitRootLogin without-password

PermitRootLogin yes

   添加PermitRootLogin yes   即可

       突然root@sonicwall-virtual-machine:/home/sonicwall# hostname zabbix    

     看到改主机名不成功  vim /etc/hostname    直接修改文件   然后重新打开登陆口 就能显示正常hostname      root@zabbix:~#     

   原谅我是×××座的完美

     接下来全部在线安装软件


  1.  apt-get install apache2  

  2.   

  3.  apt-get install php5  

  4.   

  5.  apt-get install libapache2-mod-php5  

  6.   

  7.  /etc/init.d/apache2 restart // 重启apache,此时php5已经可用了  

  8.   

  9.  apt-get install mysql-server//数据库账号:root密码:root  

  10.   

  11.  apt-get install libapache2-mod-auth-mysql  

  12.   

  13.  apt-get install php5-mysql  

  14.   

  15.  /etc/init.d/apache2 restart // 再次重启apache,使新服务正常激活  

  16.   

  17. 然后在终端输入:  

  18.   

  19.  ls /etc/apache2/mods-enabled  

  20.   

  21. 看看这个目录下(默认存在),有没有php5.conf 和 php5.load,如果没有则:  

  22.   

  23.  a2enmod php5  

  24.   

  25. 启用 php 模块,然后重启apache即可。OK,apache、php5、mysql都已经可用了。  

  26.   

  27.  /etc/init.d/apache2 restart  

其实以上是可以直接写成脚本来做 一步步做比较繁琐  

   这里还需要配置下/etc/php5/apache2/php.ini  

  1. ;date.timezone ===>去掉注释在=后添加 Asia/Shanghai  


  apt-get install zabbix-server-mysql  安装zabbix   装完没有任何显示  

root@zabbix:~# cat /etc/default/zabbix-server 

# defaults file for zabbix-server-mysql


# Start the Zabbix server from the init.d script?

# (Possible values: "yes" or "no")

#

# 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


# Absolute path to the configuration file

CONFIG_FILE="/etc/zabbix/zabbix_server.conf"

   需要把  START=no   改为yes

root@zabbix:~# vi /etc/default/zabbix-server 

root@zabbix:~# 


根据文档创建数据库


root@sonicwall-virtual-machine:/home/sonicwall# cat /usr/share/doc/zabbix-server-mysql/README.Debian 

Installing the database

-----------------------


The Zabbix server needs an SQL database to run. As you chose to install

this zabbix-server-mysql package you apparently want to use a MySQL server

as a storage backend.


Set up a MySQL database server on any system - you are not forced to run it

on the same computer as the Zabbix server:


-> 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,p_w_picpaths,data}.sql.gz \

   | mysql -uzabbix -pSECRETPASSWORD zabbix


Now enter the database access credentials into your

/etc/zabbix/zabbix_server.conf, enable the startup in the

/etc/default/zabbix-server-mysql file and start the Zabbix server.


See also:

http://www.zabbix.com/documentation/2.0/manual/appendix/install/db_scripts

root@zabbix:~# mysql -uroot -psonicwall

登陆数据库  操作以上步骤



root@zabbix:~# zcat /usr/share/zabbix-server-mysql/{schema,p_w_picpaths,data}.sql.gz | mysql -uzabbix -pzabbix zabbix

安装zabbix 网站程序

root@zabbix:~# apt-get install zabbix-frontend-php (可能会出现输入数据库的名和密码)

 直接将网页程序链接到html 目录

root@zabbix:/var/www/html# ln /usr/share/zabbix /var/www/html/zabbix -sv

  然后重启apache2   我这边直接报错

/etc/init.d/apache2 restart

 * Restarting web server apache2                                                                                                AH00557: apache2: apr_sockaddr_info_get() failed for zabbix

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

                                                                                                                         [ OK ]

root@zabbix:/var/www/html# /etc/init.d/apache2 status

 * apache2 is running

   这个错误显示系统的用户名有问题,我之前改的hostname 文件没有同步  直接vim /etc/hosts  修改 127.0.0.1 localhost 127.0.0.1 zabbix  即可  还需要修改 vim /etc/apache2/apache2.conf   添加最后一行 ServerName localhost:80

   


root@zabbix:/var/www/html# /etc/init.d/apache2 restart

 * Restarting web server apache2                                                                                         [ OK ] 

   这次显示正常开启Apache2 

 通过http://10.190.202.180  发现不能正常访问 网页不能加载下来 查看了下/etc/apache2/apache2.conf 文件的网页目录文件 是放在/var/www/html 里面 没有问题

     http://wiki.ubuntu.org.cn/index.php?title=Zabbix&variant=zh-cn    是在是没办法  我就参考了这个ubuntu论坛的wiki   然后就正常显示了  

   http://ip/zabbix   user admin  password zabbix    然后下一步  安装即可



wKioL1dOlLjiILvgAAD6OJSoFyk417.jpg-wh_50



安装完成后是这样的 

wKiom1dOlaHShH1HAAGc8j0kXt8836.jpg-wh_50

如果要切换中文  点几右上角的profile  ---user    可以改语言。

wKioL1dOlnLhAxHqAAC-IuzWVrk218.jpg-wh_50

剩下的就是添加监控主机的ip   这个可以自行搜索了