lnmp安装及nagios
Posted 带你去土耳其
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lnmp安装及nagios相关的知识,希望对你有一定的参考价值。
##nginx
cd /opt
tar -xvf nginx-1.8.1.tar.gz -C /usr/src/
cd /usr/src/nginx-1.8.1
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module && make && make install || echo "nginx error" >>/opt/error.txt
比如安装目录:/usr/local/nginx
nginx的主配置文件:/usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload #重新加载
/usr/local/nginx/sbin/nginx -s stop #停止
#mysql
cd /opt/
tar -xvf mysql-5.6.29.tar.gz -C /usr/src/
cd /usr/src/mysql-5.6.29
./configure --prefix=/usr/local/mysql --with-plugins=max --with-extra-charsets=all && make && make install || echo "mysql error" >>/opt/error.txt
-DWITH_INNOBASE_STORAGE_ENGINE=1 -CMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all
##php
cd /opt
tar -xvf php-5.6.19.tar.gz -C /usr/src
cd /usr/src/php-5.6.19
./configure --prefix=\'./configure\' \'--prefix=/usr/local/php5\' \'--host=x86_64-pc-linux-gnu\' \'--disable-cli\' \'--enable-cgi\' \'--enable-fastcgi\' \'--disable-discard-path\' \'--disable-force-cgi-redirect\' \'--without-pear\' \'--enable-bcmath\' \'--with-bz2\' \'--disable-calendar\' \'--disable-ctype\' \'--without-curl\' \'--without-curlwrappers\' \'--disable-dbase\' \'--disable-dom\' \'--disable-exif\' \'--without-fbsql\' \'--without-fdftk\' \'--disable-filter\' \'--disable-ftp\' \'--with-gettext\' \'--without-gmp\' \'--disable-ipv6\' \'--disable-json\' \'--without-kerberos\' \'--disable-libxml\' \'--disable-mbstring\' \'--with-mcrypt=/usr/local/lib\' \'--without-msql\' \'--without-mssql\' \'--with-ncurses\' \'--with-openssl\' \'--with-openssl-dir=/usr\' \'--disable-pcntl\' \'--disable-pdo\' \'--without-pgsql\' \'--without-pspell\' \'--without-recode\' \'--disable-simplexml\' \'--disable-shmop\' \'--without-snmp\' \'--disable-soap\' \'--enable-sockets\' \'--without-sybase\' \'--without-sybase-ct\' \'--disable-sysvmsg\' \'--disable-sysvsem\' \'--disable-sysvshm\' \'--without-tidy\' \'--disable-tokenizer\' \'--disable-wddx\' \'--disable-xml\' \'--disable-xmlreader\' \'--disable-xmlwriter\' \'--without-xmlrpc\' \'--without-xsl\' \'--disable-zip\' \'--with-zlib\' \'--disable-debug\' \'--enable-dba\' \'--without-cdb\' \'--with-db4\' \'--disable-flatfile\' \'--with-gdbm\' \'--disable-inifile\' \'--without-qdbm\' \'--without-freetype-dir\' \'--without-t1lib\' \'--disable-gd-jis-conv\' \'--with-jpeg-dir=/usr\' \'--with-png-dir=/usr\' \'--without-xpm-dir\' \'--with-gd\' \'--with-mysql=/usr/local/mysql\' \'--with-readline\' \'--without-libedit\' \'--without-mm\' \'--without-sqlite\' \'--with-pic\' \'--with-config-file-path=/usr/local/php5/lib/php.ini\' \'--enable-pdo\' \'--with-pdo-mysql=/usr/local/mysql\' \'--with-curl\' \'--enable-ctype\' \'--enable-json\' \'--enable-filter\' \'--enable-dom\' \'--enable-hash\' \'--with-magickwand\' \'--with-imap\' \'--enable-libxml\' \'--enable-mbstring\' \'--enable-simplexml\' \'--with-kerberos\' \'--with-imap-ssl\' \'--with-snmp\' \'--enable-soap\' \'--enable-xml\' \'--with-mhash\' \'--enable-posix\' \'--enable-cache\' \'--enable-fpm\' && make && make install ||echo "php erroe">>/opt/error.txt
安装过程中报错 缺少包 就安装。其中几个重要的报错:
1 configure: error: DBA: Could not find necessary header file(s).
解决:yum install gdbm-devel db4-devel
2 checking for DB4 major version... configure: error: Header contains different version
解决:Error: configure: error: DBA: Could not find necessary header file(s).
Fix: yum install gdbm-devel db4-devel
configure: error: Header contains different versio
编译安装db4
cd build_unix
../dist/configure --enable-cxx
make
make install
libc-client.a
yum install libc-client-devel.x86_64
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
tar -zxvf libmcrypt-2.5.8.tar.gz
./configure
make && make install
加速插件-----安装php扩展
1.cd /opt/php-5.6.19/ext/opcache/ # 切换到php解压包目录
/usr/local/php5/bin/phpize #用来扩展php扩展模块
./configure --with-php-config=/usr/local/php5/bin/php-config #编译安装
make && make install
2.安装完成之后,在php.ini里面添加
cp php.ini-production /usr/local/php5/etc/php.ini
vim /usr/local/php5/etc/php.ini
extension=opcache.so
/etc/init.d/php-fpm start
## redis
cd /opt
tar -xvf redis-2.0.4.tar.gz -C /usr/local/
cd /usr/local/redis-2.0.4
make && make install || echo "redis error" >>/opt/error.txt
新项目各软件版本。
erlang R19.1
nginx 1.8.1
php-5.6.19
mysql 5.6.29
jdk-8u45
redis-2.0.4
安装nagios被监控端 xinetd启动
useradd nagios
tar -zxvf nagios-plugins-1.4.15.tar.gz
tar -zxvf nrpe-2.12.tar.gz
yum install perl-devel perl-CPAN openssl-devel -y
cd /home/cmge/nagios-plugins-1.4.15
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-gourp=nagios --enable-perl-modules --with-mysql=/usr/local/mysql/ --with-openssl=/usr/local/openssl
make
make install
cd /home/cmge/nrpe-2.12
./configure --prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
chown -R nagios:nagios /usr/local/nagios
\\cp /home/cmge/nrpe.cfg /usr/local/nagios/etc/
\\cp /home/cmge/nrpe /etc/xinetd.d/
\\cp /home/cmge/snmpd.conf /etc/snmp
cd /home/cmge
sh yum2.txt
yum install xinetd -y
echo \'# Local services\' >> /etc/services
echo \'nrpe 5666/tcp #nrpe\' >> /etc/services
yum install dstat iptraf sysstat -y
iptables -I INPUT -s 58.215.41.132 -p udp --dport 161 -j ACCEPT
http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html 安装nagiox
客户端nagios https://blog.csdn.net/jiedushi/article/details/6524375
nagios添加被监控的机器 https://blog.csdn.net/u012063703/article/details/46707763
服务端,监控客户端,ip配置在/usr/local/nagios/etc/objects/hosts.cfg里面
要监控的服务,目前暂时是给你加在/usr/local/nagios/etc/objects/templates.cfg的末尾,你可以自己调整下位置,比如另外写文件services.cfg,如果修改为其他名称,nagios.cfg对应的需要修改,不然加载不到
监控端,安装配置完之后,主要配置文件:/usr/local/nagios/etc/nrpe.cfg 这里面以command开头的,是一些默认的监控服务器,比如磁盘,负载
以上是关于lnmp安装及nagios的主要内容,如果未能解决你的问题,请参考以下文章