软件安装手册
版本修订
版本 |
说明 |
作者 |
日期 |
0.1 |
Oracle 11g r2安装说明 |
RockeyHoo |
26/06/2013 |
0.2 |
Nagiois3.4.1安装说明 |
RockeyHoo |
18/09/2013 |
0.3 |
Mysql 5.6.14安装说明 |
RockeyHoo |
|
目录
Oracle 11gR2............................................................................................................................................................................................................. 1
安装环境............................................................................................................................................................................................................ 1
Linux软件包选择............................................................................................................................................................................................. 1
设置host文件.................................................................................................................................................................................................... 1
同步时钟............................................................................................................................................................................................................ 1
设置内核参数.................................................................................................................................................................................................... 2
设置Limit参数.................................................................................................................................................................................................. 2
关闭selinux....................................................................................................................................................................................................... 2
安装软件包........................................................................................................................................................................................................ 2
创建用户组........................................................................................................................................................................................................ 3
创建文件路径并赋权........................................................................................................................................................................................ 3
设置Oracle用户环境变量................................................................................................................................................................................ 3
上传文件解压安装............................................................................................................................................................................................ 4
配置监听和启动数据库................................................................................................................................................................................. 10
Oracle设置自启动.......................................................................................................................................................................................... 14
创建表空间和数据库..................................................................................................................................................................................... 16
Nagios3.4.1.............................................................................................................................................................................................................. 16
安装环境......................................................................................................................................................................................................... 16
Linux软件包选择........................................................................................................................................................................................... 17
download nagios core and plugins........................................................................................................................................................... 17
add nagios user and group......................................................................................................................................................................... 17
Nagios core安装............................................................................................................................................................................................ 17
nagios plugin安装........................................................................................................................................................................................ 18
设置nagios自启动.......................................................................................................................................................................................... 18
访问nagios...................................................................................................................................................................................................... 18
CentOS 64-bit
Centos6.3
root|rockey/rockey
oracle/oracle
网卡设置
设置双网卡:
一个NAT(连接互联网)
一个Host-only(加入局域网)
NAT模式:使用VMware提供的NAT和DHCP服务,虚拟机使用主机中的虚拟网卡VMnet8作为网关,
host-only方式:默认使用vmnet1,将虚拟机ip设置与vmnet1同网段,gateway设置成vmnet1的ip,
其余设置与vmnet1相同,dns设置与主机相同
静态IP设置
宿主机设置
1).检查windows系统的Vmware DHCP Service 和Vmware NAT service 两个服务已启动。
2).把windows的虚拟网卡vmnet8 设置成IP和DNS都自动获取
3).把本地连接设置为共享
4).打开Vmware,选择Edit-->Virtual network editor 点击NAT Setting 记住网关信息
Centos虚拟系统设置(NAT方式)
1. 修改/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1" #注意文件名,ifconfig设备名要保持一直
#BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR=192.168.95.163
NETMASK=255.255.255.0
HWADDR="00:50:56:20:66:22" #mac地址要与虚拟网卡地址一直
#IPV6INIT="yes" #此处不需要
GATEWAY=192.168.95.2 #网关 Vmware NAT Setting 中显示的网关地址
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
#UUID="778d99ed-3208-4083-8eec-9bb75c744cfc" #此处不需要
DNS1=192.168.95.2 #DNS 与gateway相同
2. 设置默认网关/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.95.2
3. 设置DNS /etc/resolv.conf
nameserver 192.168.95.2
Centos虚拟系统设置(Host-only方式)
1. 修改/etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE="eth2"
BOOTPROTO="static"
IPADDR=192.168.33.126
NETMASK=255.255.255.0
HWADDR=00:50:56:38:F8:5D
GATEWAY=192.168.33.0
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
软件版本信息及账户
VMware8.0
安装centos时,启动eth0老是出错,后来更改了eth0的网卡地址,使eth0启动失败。
Centos6.3
root|rockey/rockey
oracle/oracle
Oracle 11g r2
sys|system|sysman/Qwer1234
scott/tiger
hs/123
在安装Linux操作系统的时候注意选择以下软件包
Software Package
* GNOME Desktop Environment
* Editors
* Graphical Internet
* Text-based Internet
* Development Libraries
* Development Tools
* Server Configuration Tools
* Administration Tools
* Base
* System Tools
* X Window System
修改文件/etc/hosts,增加一条,如下所示(主要hostname 与/etc/sysconfig/network中的hostname一致)
Example:
127.0.0.1 localhost.localdomain oradb
yum -y install ntp
ntpdate time.nist.gov
#以下下为计划任务-每过2小时同步一次时间
echo "* */2 * * * /sbin/ntpdate time.nist.gov" >> /etc/crontab
修改文件/etc/sysctl.conf,增加下列条目,如下所示, 设置完成后运行/sbin/sysctl –p 使之生效
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=4194304
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
修改文件/etc/security/limits.conf,增加下列条目,如下所示:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改文件/etc/selinux/config,增加下列条目,如下所示:
SELINUX=disabled
下列软件包在安装光盘的server目录下面,[注:32位和64位最好都安装]
rpm -Uvh binutils-2.* --nodeps --force //忽略依赖关系,强制安装
rpm -Uvh compat-libstdc++-33*
rpm -Uvh compat-libstdc++-33*.i386.rpm
rpm -Uvh elfutils-libelf*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh glibc-2.* --nodeps --force //忽略依赖关系,强制安装
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh*
rpm -Uvh libaio-0.* --nodeps --force //忽略依赖关系,强制安装
rpm -Uvh libaio-devel-0.*
rpm -Uvh libgomp-4.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh make-3.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*
rpm -Uvh numactl-devel-2*
Or 直接运行以下
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh numactl-devel glibc-headers
使用下列命令,创建用户和用户组
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
useradd -g oinstall -G dba,oper,asmadmin oracle
passwd oracle #oracle
使用下列命令,创建文件安装路径,并授权
mkdir -p /oracle/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /oracle
chmod –R 775 /oracle #cd /
使用Oracle用户登录,然后vi .bash_profile,增加如下行,执行source .bash_profile让环境变量生效
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
使用ftp软件上传数据库安装文件,然后解压,登录oracle用户进行安装
#上传oracle安装文件到/data/software目录下,并解压
cd /data/software
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
xhost + #(这里使用root用户执行,一定要执行以下2步,如果没有执行,将无法启动图形安装界面有些系统执行会乱码。可以使用英文版安装[LANG=en_US]否则会出现乱
xhost + localhost #(这里有些系统干部支持)
su - oralce
cd /data/software/database
./runInsaller
在SecureCRT连接ssh到服务器安装时提示:
正在启动 Oracle Universal Installer...
检查临时空间: 必须大于 120 MB。 实际为 32529 MB 通过
检查交换空间: 必须大于 150 MB。 实际为 8015 MB 通过
检查监视器: 监视器配置至少必须显示 256 种颜色
>>> 无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了 DISPLAY 变量。 未通过 <<<<
未通过某些要求检查。必须先满足这些 要求,
然后才能继续安装,
是否继续? (y/n) [n] y
需要登录到操作系统图形界面,打开终端运行
./runInsaller
Exception in thread "main" java.lang.NoClassDefFoundError
Oracle的安装界面都是小方块,看不到其他的字符
先使用命令
export LANG=en将环境临时换成英文或export LANG=C切换成中文,然后再安装。这个环境变量的修改只是临时的,重启后或者使用oracle用户登录时会自己换回来的。
密码:Qwer1234
提示Failed的软件包都已经有安装但版本稍有不同,选择忽略后继续安装:
查看oracle字符集
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
SIMPLIFIED CHINESE_CHINA.UTF8
查看linux系统字符集
[root@ora ~]# env |grep LANG
LANG=zh_CN.UTF-8
GDM_LANG=zh_CN.UTF-8
定义linux系统字符集
[root@ora ~]# export NLS_LANG='SIMPLIFIED CHINESE_CHINA.UTF8'
定义oracle环境字符集
[root@ora ~]# su – oracle
[oracle@ora ~]$ export NLS_LANG='SIMPLIFIED CHINESE_CHINA.UTF8'
[oracle@ora ~]$ !sql
查看结果
SQL> select * from database_properties;
1,$ netca #配置监听和网络服务
2,设置防火墙
3,启动监听 lsnrctl start
#第一次启动时,失败了,原因是listener.ora中hostname写的不对,后来改成了127.0.0.1
4,(这一步创建orcl了,可以跳过此步骤)使用dbca创建数据库
5,启动实例 dbstart/dbshut
若要实现开机自启动,必须/etc/oratab 存在
[root@localhost /]# find / -name "oratab"
/oracle/app/oracle/product/11.2.0/db_1/install/oratab
[root@localhost /]# cd /oracle/app/oracle/product/11.2.0/db_1/install/
[root@localhost install]# cp oratab /etc
6, 也可以手工启动
[oracle@dbOracle9i ~]$lsnrctl stop ----------关闭监听
[oracle@dbOracle9i ~]$ sqlplus / as sysdba" ------sqlplus
SQL> shutdown immediate; -------关闭数据库实例
SQL> startup; -------重启数据库
SQL> exit -------退出sqlplus
[oracle@dbOracle9i ~]$ lsnrctl start ---------打开监听
7,查看数据库
-- 查看表空间
Select name from v$datafile;
-- 查看所有用户
Select * from all_users;
--查看当前用户所拥有的权限
select * from user_sys_privs;
-- 查询用户所拥有的表
Desc all_tables;
select owner,table_name from all_tables where owner='SCOTT';
-- 解锁scott
alter user scott account unlock;
8,启动EM
-- 启动em
emctl start dbconsole 启动
emctl stop dbconsole 停止
$ emctl start dbconsole
OC4J Configuration issue. /oracle/app/oracle/product/11.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_oradb.localdomain_orcl not found.
修改hosts 与主机名一致
重建em
-- 删除
$ emca -repos drop
SEVERE: Listener is not up or database service is not registered with it.
修改主机名重启后,问题任然存在
#修改/oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /oracle/app/oracle/product/11.2.0/db_1)
(SID_NAME = ORCL)
)
)
最终还是通过netca重新监听,解决问题。
$ emca -config dbcontrol db -repos create (中间出现了一个问题,sysman用户不存在,只有配置em后才有这个用户)
$ netstat -ntpl |grep 1158
https://localhost.localdomain:1158/em
1.Oracle启动时发生如下错误:
解决 方法:
1、查看环境变量.bash_profile文件如下,查看oracle 实例名
[oracle@wpj ~]$ vi ~/.bash_profile
export ORACLE_SID=orcl
2、修改 listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
(SID_NAME = orcl)
http://wangpj.iteye.com/blog/1685554
使用下列命令,创建开机自启动
1、Redhat init简介:
Linux启动时,会运行一个init程序,然后由init来启动后面的任务,包括多用户环境(inittab中设定)和网络等。运行级就是当前程序运行的功能级别,这个级别从1到6,具有不同的功能。这些级别在/etc/inittab(其他发行版这个文件位置不同)中指定,该文件就是init程序寻找的主要文件。最先运行的服务放在/etc/rc.d目录下。
文件以S开头,代表start(启动),后面的数字是启动顺序;文件以K开头,代表kill(结束),同样,后面的数字代表结束顺序。例如:/etc/rc3.d/S55sshd表示它与运行级别3有关,55就是它的启动顺序;/etc/rc3.d/K15nginx表示它与运行级别3有关,15就是它的关闭顺序。
init.d
这个目录中存放了一些服务启动脚本,系统安装时的多个rpm包,这些脚本在执行时可以用来启动,停止和重启这些服务。
rcx.d(x为0~6)
这个目录是启动级别的执行程序链接目录,里面的文件都是指向init.d目录中文件的一些软连接。
2、修改dbstart和dbshut启动关闭脚本,使其启动数据库的同时也自动启动监听器(即启动数据库时启动监听器,停止数据库时停止监听器):
# vim /u01/app/oracle/product/11.2.0/db_1/bin/dbstart
找到下面的代码,在实际脚本代码的前面
# First argument is used to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$1
# 将此处的 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log
同样也修改dbshut脚本:
# vim /u01/app/oracle/product/11.2.0/db_1/bin/dbshut
# The this to bring down Oracle Net Listener
ORACLE_HOME_LISTNER=$1
# 将此处的 ORACLE_HOME_LISTNER=$1 修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener"
echo "Usage: $0 ORACLE_HOME"
else
LOG=$ORACLE_HOME_LISTNER/listener.log
3、新建Oracle服务启动脚本:
# vim /etc/init.d/oracle
新建一个以oracle命名的文件(也可以命名为oracle11g等,自己喜欢啥名改啥名。),并将以下脚本代码复制到文件里(里面的oracle目录路径根据自己的实际安装路径修改):
#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g R2 AutoRun Servimces
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup and em
su - $ORA_OWNR c “$ORACLE_HOME/bin/dbstart &”
su - $ORA_OWNR c “$ORACLE_HOME/bin/lsnrctl start”
su - $ORA_OWNR c “$ORACLE_HOME/bin/emctl start dbconsole”
touch /var/lock/subsys/oracle
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown and em
su - $ORA_OWNR c “$ORACLE_HOME/bin/dbshut &”
su - $ORA_OWNR c “$ORACLE_HOME/bin/lsnrctl stop”
su - $ORA_OWNR c “$ORACLE_HOME/bin/emctl stop dbonsole”
rm -f /var/lock/subsys/oracle
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit 1
esac
exit 0
保存退出!
4、赋予启动脚本执行权限并链接好:
# chmod 755 /etc/init.d/oracle
需要在关机或重启之前停止数据库,做如下操作
# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle
# ln -s /etc/init.d/oracle /etc/rc6.d/S01oracle
5、把oracle启动脚本添加到系统服务里并设置自启动:
# chkconfig --add oracle
# chkconfig --level 345 oracle on
6.修改oratab
修改/etc/oratab
[root@localhost etc]# vi oratab
orcl:/oracle/app/oracle/product/11.2.0/db_1:Y
sh oracle start
reboot重启系统看看效果吧
Linux下创建用户,数据库和表空间
1、登录linux,以oracle用户登录(如果是root用户登录的,登录后用 su - oracle命令切换成oracle用户)
2、以sysdba方式来打开sqlplus,命令如下: sqlplus "/as sysdba"
3、查看我们常规将用户表空间放置位置:执行如下sql:
select name from v$datafile;
上边的sql一般就将你的用户表空间文件位置查出来了。
4、创建用户表空间:
CREATE TABLESPACE hs_data_file01 DATAFILE '/oracle/app/oracle/oradata/orcl/hs_data_file01.dbf' SIZE 200M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
5、创建用户,指定密码和上边创建的用户表空间
CREATE USER hs IDENTIFIED BY hs123 DEFAULT TABLESPACE hs_data_file01;
6、赋予权限
grant connect,resource to hs;
grant unlimited tablespace to hs;
grant create database link to hs;
grant select any sequence,create materialized view to hs;
经过以上操作,我们就可以使用hs/123登录指定的实例,创建我们自己的表
系统信息Mysql 5.6.14 community Server
系统信息
Centos 6.3
root|123
mysql
root|123
下载网址:
http://dev.mysql.com/downloads/mysql/5.6.html#downloads
select platform
选择 Source Code
下载 mysql-5.6.14.tar.gz
访问web需要打开80端口
vi /ect/sysconifg/iptables
# add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
修改完后
service iptables restart
For Centos Users:
Software Package
*gcc gcc-c++ gcc-g77
*autoconf
*automake
*zlib*
*fiex*
*lib
*xml*
*ncurses-devel
*libmcrypt*
*libtool-ltdl-devel*
*make
*cmake
yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* lib xml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
创建用户
groupadd mysql
useradd -r -g mysql mysql
安装MySQL
tar zxvf mysql-5.6.14.tar.gz
cd mysql-5.6.14
cmake .
make && make install
将二进制的所有权改为root,数据目录的所有权改为mysql用户,
cd /usr/local/mysql
#修改mysql安装目录
chown –R mysql .
chgrp –R mysql .
#初始化mysql数据库
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
修改配置文件
cd /usr/local/mysql
#this command is optional
cp support-files/my-default.cnf /etc/my.cnf
vim /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
source /etc/profile
启动mysql
cd /usr/local/mysql
bin/mysqld_safe --user=mysql &
cd /usr/local/mysql
#把mysql加到系统服务中
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
service mysql start/stop/restart
netstat -tulnp | grep 3306
mysql -u root –p
#设置密码
mysqladmin -u root password '123'
mysql
Ø show databases;
Ø use mysql;
Ø show tables;
mysql -u root –p
Ø GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123";
Ø flush privileges;
系统信息
系统信息
Centos 6.3
root|123
安装参考手册:
访问web需要打开80端口
vi /ect/sysconifg/iptables
# add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
修改完后
service iptables restart
For Centos Users:
Software Package
*wget
*httpd
*php
*gcc
*glibc
*glibc-common
*gd
*gd-devel
*make
*net-snmp
yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp
安装ngaios core 3.4.1 and plugin 1.4.15
cd /tmp
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
使用下列命令,创建用户和用户组
useradd nagios
groupadd nagcmd
usermod –a –G nagcmd nagios
安装nagios core
tar zxvf nagios-3.4.1.tar.gz
tar zxvf nagios-plugins-1.4.15.tar.gz
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios start
/etc/init.d/httpd start
创建一个默认用户,访问web
htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
cd /home/rockey/software/nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
The following commands will register the Nagios daemon to be run upon system startup.
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on
After correctly following the procedures you should now be
able to access your Nagios Core installation from a web
Simply use the following:
http://
nagiosadmin/123
And log in with the credentials you chose when adding the
nagiosadmin user to the htpasswd.users file.
username/password
nagiosadmin/123
配置nagios
1. 配置文件概述
cd /usr/local/nagios/etc
-rw-rw-r-- 1 nagios nagios 43776 08-30 11:55 nagios.cfg (主配置文件)
drwxrwxr-x 2 nagios nagios 4096 08-30 11:55 objects (对象定义文件目录)
-rw-rw---- 1 nagios nagios 1340 08-30 11:55 resource.cfg (资源配置文件)
我们修要修改的的是nagios.cfg 和 objects 目录下的文件,来检测主机是否存活。
2. 主配置文件nagios.cfg的配置。
主配置文件的内容很多,对于这个版本,我们需要修改和添加的主要是对象配置文件,即:
cfg_file=
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg (联系人信息定义文件)
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg (添加此行联系人组定义文件)
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg (添加此行主机定义文件)
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg (添加此行主机组定义文件)
cfg_file=/usr/local/nagios/etc/objects/services.cfg (添加此行服务定义文件)
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg (时间周期定义文件)
cfg_file=/usr/local/nagios/etc/objects/templates.cfg # Definitions for monitoring the local (Linux) host
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg (注释掉此行)
3. 主机定义文件的配置
1. 点击左边的菜单,报错。如下图:
处理过程:
1.查看apache日志
tail –f /var/log/httpd/error_log
info:
[Thu Oct 17 00:29:39 2013] [error] [client ::1] (13)Permission denied: exec of '/usr/local/nagios/sbin/status.cgi' failed, referer: http://localhost/nagios/side.php
[Thu Oct 17 00:29:39 2013] [error] [client ::1] Premature end of script headers: status.cgi,
referer: http://localhost/nagios/side.php
2.如果是SELinux处于强制安全模式时,需要改为容许模式。
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
使用yum安装Apache, linux系统中apache 叫做“httpd”
1. 安装Apache
yum install httpd
2. 设置Apache服务的启动级别
chkconfig –levels 235 httpd on
3. 启动
service httpd start
4. 验证是否成功
打开ie,http://ip
5. 安装目录介绍
默认将网站的根目录指向/var/www/html目录
主配置文件:/etc/httpd/conf/httpd.conf
配置存储:/etc/httpd/conf.d
访问web需要打开80端口
vi /ect/sysconifg/iptables
# add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
修改完后
service iptables restart