Chinaunix首页 | 论坛 | 博客
  • 博客访问: 108350
  • 博文数量: 20
  • 博客积分: 516
  • 博客等级: 下士
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-23 10:01
文章分类

全部博文(20)

文章存档

2012年(20)

分类: LINUX

2012-02-14 13:32:22

在公司实习,师父安排了几个任务给我,其中就有nagios到安装。
前几天在centos5.5上安装了nagios 现在换了台win7 在这上面重新安装软件 
开始安装:
1.安装httpd
[ha@localhost Desktop]$ su root
[root@localhost Desktop]# yum install httpd
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Setting up Install Process
Package httpd-2.2.15-15.el6.centos.x86_64 already installed and latest version
Nothing to do 
#说明已经安装了
[root@localhost Desktop]# chkconfig --level 35 httpd on
[root@localhost Desktop]# service httpd start
2.安装php
[root@localhost Desktop]# yum install php
Total download size: 3.8 M
Installed size: 13 M
Is this ok [y/N]: y
安装完成:
Installed:
  php.x86_64 0:5.3.3-3.el6_2.6                                                  

Dependency Installed:
  php-cli.x86_64 0:5.3.3-3.el6_2.6      php-common.x86_64 0:5.3.3-3.el6_2.6     

Complete!

3.安装mysqll
[root@localhost Desktop]# yum install mysq
Total download size: 881 k
Installed size: 2.4 M
Is this ok [y/N]: y
[root@localhost Desktop]# yum install mysql-server
Total download size: 8.9 M
Installed size: 25 M
Is this ok [y/N]: y
[root@localhost Desktop]# chkconfig --level 35 mysqld on
[root@localhost Desktop]# service mysqld start
[root@localhost Desktop]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, 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): 输入空格
Setting the root password ensures that nobody can log into the MySQL
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 MySQL installation has an anonymous user, allowing anyone
to log into MySQL 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] y
 ... Success!

By default, MySQL 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 MySQL
installation should now be secure.

Thanks for using MySQL!

4.nagios到安装
下载nagios: 输入邮箱 下载 
进行解压 
[root@localhost Downloads]# tar -xvf nagios-3.2.3.tar.gz -C /usr/src/
cd /usr/src/nagios-3.2.3/ 创建nagios用户
[root@localhost nagios-3.2.3]# mkdir /usr/local/nagios 
[root@localhost nagios-3.2.3]# chown nagios.nagios /usr/local/nagios
[root@localhost nagios-3.2.3]# ./configure --prefix=/usr/local/nagios/
[root@localhost nagios-3.2.3]# make all
[root@localhost nagios-3.2.3]# make install&&make install-init&&make install-commandmode&&make install-config&&make install-webconf
检测是否安装成功:
[root@localhost nagios-3.2.3]# cd /usr/local/nagios
[root@localhost nagios]# ls
bin  etc  libexec  sbin  share  var
有这6个文件就安装成功了。
修改nagios页面文件:
[root@localhost nagios]# more /etc/httpd/conf.d/nagios.conf 
[root@localhost nagios]# cp /etc/httpd/conf.d/nagios.conf /var/www/html/
添加页面访问帐号:
[root@localhost nagios]# touch /usr/local/nagios/etc/htpasswd.users  
[root@localhost nagios]# /usr/bin/htpasswd -c /usr/local/nagios/htpasswd.users root
New password: 
Re-type new password: 
Adding password for user root
[root@localhost nagios]# cat /usr/local/nagios/etc/htpasswd.users
 root:g1tNZtcuWwfCw
修改nagios配置文件
[root@localhost nagios]# vi /usr/local/nagios/etc/nagios.cfg 
找到
#command_check_interval=15s
command_check_interval=-1
改为
command_check_interval=15s
#command_check_interval=-1
[root@localhost nagios]# touch /usr/local/nagios/var/nagios.log
[root@localhost nagios]# chown nagios.nagios /usr/local/nagios/var/nagios.log 

[root@localhost nagios]# chkconfig nagios on
[root@localhost nagios]# service nagios start
Starting nagios: done.
[root@localhost nagios]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
                                                           [  OK  ]
安装完毕:在ie 输入127.0.0.1/nagios  就可看到页面了。
目前是看不到主机信息:必须关闭SELinux 才能看到
命令 setenforce 0; 
配置到话另外写一篇文章
阅读(2519) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~