Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588291
  • 博文数量: 151
  • 博客积分: 3330
  • 博客等级: 中校
  • 技术积分: 1686
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-08 02:41
文章存档

2011年(151)

分类: LINUX

2011-06-25 14:47:48

所需软件:
httpd-2.2.19.tar.bz2
apr-1.4.5.tar.bz2
apr-util-1.3.12.tar.bz2
MySQL-community-5.1.57-1.rhel5.src.rpm
php-5.3.3.tar.bz2
nagios-3.2.3.tar.gz
nagios-plugins-1.4.15.tar.gz
openssl-1.0.0d-tar.gz
pcre-8.12.tar.bz2



安装步骤:

1. openssl
./configure --prefix=/usr/local/openssl
make
make install

2. pcre-8.12.tar.bz2
./configure --prefix=/usr/local/pcre
make
make install

3. apr-1.4.5.tar.bz2
./configure
make
make install

4. apr-util-1.3.12.tar.bz2
./configure --with-apr=/usr/local/apr/bin/apr-config-1
make
make install

5. httpd-2.2.19.tar.bz2
./configure --prefix=/usr/local/apache2  --sysconfdir=/usr/local/apache2/conf
--with-mods-shared=all --enable-so --with-mpm=worker --with-pcre=/usr/local/ --with-z
--with-ssl=/usr/local/openssl --with-apr=/usr/local/apr/bin/apr-1-config
--with-apr-util=/usr/local/apr/bin/apu-1-config --enable-speling --enable-rewrite
--enable-ssl --enable-cache --enable-disk-cache  --enable-mem-cache
make
make install

6. MySQL-community-5.1.57-1.rhel5.src.rpm
groupadd mysql
useradd -g mysql -s /sbin/nologin -d /dev/null mysql

 ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --sysconfdir=/etc --with-unix-socket-path=/usr/local/mysql/tmp/mysql.socket --enable-local-infile
--with-plugins=innodb_plugin,partition,myisam,myisammrg --with-mysqld-user=mysql
--with-readline --with-pthread --with-mysqld-ldflags=-all --with-client-ldflags=-all
--enable-assembler --with-charset=utf8 --with-collation=utf8_general_ci
--with-extra-charsets=complex --with-mysqld-user=mysql --enable-thread-safe-client
--with-big-tables --enable-largefile --without-comment --without-debug --with-mysqlmanager

make
make install
cp support-files/my-medium.cnf /etc/my.cnf
chown -R /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
/usr/local/mysql/bin/mysqld_safa --user=mysql &

7. php-5.3.3.tar.bz2

首先安装Php支持库文件:

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss-ldap openldap-clients openldap-servers

 

1.install libiconv-1.9.2.tar.gz

tar -xzvf libiconv-1.9.2.tar.gz

cd libiconv

./configure --prefix=/usr/local

make && make install

2.install libmcrypt-2.5.8.tar.gz

tar -zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt

./configure

make && make install

cd libltdl/

./configure --enable-ltdl-install

make && make install

3.install mhash-0.9.9.9.tar.bz2

tar -xjvf mhash-0.9.9.9.tar.bz2

cd mhash

./configure

make && make install

4.将加密函数库链接到系统标准目录下

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

5. install mcrypt-2.6.8.tar.gz

tar -xzvf mcrypt-2.6.8.tar.gz

cd mcrypt

./configure

make && make install

 

现在开始配置Php

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-pdo-mysql=/usr/local/mysql/bin/mysql_config
--with-mysql-sock=/usr/local/mysql/tmp/mysql.socket --enable-ftp --with-zlib-dir
--with-bz2 --enable-zip --with-iconv-dir=/usr/local/ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --enable-gd-native-ttf --with-gettext --enable-bcmath --enable-exif --enable-calendar --enable-intl --with-mhash=/usr/local --with-mcrypt=/usr/lib --enable-xml --with-xsl --enable-xmlwriter --with-libxml-dir=/usr/ --disable-rpath --disable-safe-mode --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-zend-multibyte --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-pcre-regex
--with-openssl=/usr/local/openssl/ --enable-pcntl --enable-sockets --with-ldap
--with-ldap-sasl --without-pear --enable-soap --enable-pdo --enable-phar --with-xmlrpc
--with-apxs2=/usr/local/apache2/bin/apxs --disable-magic-quotes

make ZEND_EXTRA_LIBS='-liconv'

make install

cp my.ini-production /usr/local/php/etc/php.ini

注:php所需的很多图形库文件和加密库文件请在安装php之前先安装好

8. 修改httpd.conf 使其能解析php文件,有三个地方请确认如下:

a:  LoadModule php5_module        modules/libphp5.so
b: 
    DirectoryIndex index.php index.html
   

c:
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php .php3 .php4 .php5 .php6
    AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .phtm
l

注:以上绿色的为添加的

9. nagios-3.2.3.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
--with-command-group=nagioscmd --with-httpd-conf=/usr/local/apache2/conf.d/
--with-gd-lib=/usr/ --with-gd-inc=/usr/
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf

(请注意红色的配置项,很多网上的配置教程都没有,我将nagios.conf 的web登录验证文件放到了/usr/local/apache2/conf.d这个目录下,这个目录需要先手工建立)

10. nagios-plugins-1.4.15.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-perl
 --with-openssl=/usr/local/openssl --enable-perl-modules 
--with-fping-command=/usr/sbin/fping --with-libiconv-prefix=/usr/local/
--with-ssh-command=/usr/local/openssh/sbin/sshd
make
make install

11 . 建立nagios的web登录验证文件
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin (这个nagiosadmin帐号是web验证的)
password:*********
password again:********

chown apache.apache htpasswd.users (这个文件的权限必须改成http的运行账号apache 所有)
chmod 0600 htpasswd.users

12. 将httpd的运行帐号改成apache
vim /usr/local/apache2/conf/httpd.conf
找到配置项 User 和 Group,改成如下:
User apache
Group apache

保存

13 . 启动nagios ,httpd 登录
service nagios start
/usr/local/apache2/bin/apachectl -k start

14. 登录







Attention:

     按照哥哥以上步骤去装绝对没问题,我都是通过源代码编译安装的,因为我喜欢自己定义编译参数,当然通过RPM包安装可能更省事,但是体会不到编译的快感;再者redhat自带的RPM包都很旧,用新的源代码包安装更安全,更舒心,更安心,更有快感!!!

阅读(1067) | 评论(0) | 转发(0) |
0

上一篇:DNS 原理

下一篇:Nagios-NRPE 安装

给主人留下些什么吧!~~