天天看点

debian下LAMP+nginx代理+awstats+cacti+nagios(一)

这个系统吧比较纯净,APT包管理相当舒服比yum 还舒服!

一首先就apache吧

安装编译\工程构建\调试工具 

//*  

 * 说明:  

 * build-essential: 基本编译环境 (gcc, g++, libc, make等)  

 * autoconf:        自动配置工具   

 * automake:        make相关  

 * gdb:             调试工具  

 *//  

#apt-get install build-essential   

#apt-get install autoconf    

#apt-get install automake   

#apt-get install gdb 

#我的包都放在了 /home 下

出现configure: error: APR version 1.2.0 or later is required错误

解决方法 添加一个参数即可:./configure --prefix=/usr/local/apache-2.2.21 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-rewrite --with-included-apr

系统默认有apr库了!

 二mysql安装

安装cmake(mysql5.5以后是通过cmake来编译的)

# tar zxvf cmake-2.8.5.tar.gz

# cd cmake-2.8.5  

#.configure

# make && make install

这是mysql开发者写的一个autools转换岛对应的cmake的各种编译参数的对比资料。

 会遇到的问题:

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

-- MySQL 5.5.15

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:82 (MESSAGE):

Curses library not found. Please install appropriate package,remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu , package name is libncurses5-dev,on RedHat and derivates it is ncurses-devel.

Call Stack (most recent call first):

cmake/readline.cmake:126 (FIND_CURSES)

cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)

CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

如回显所示,ubuntu下安装libncurses5-dev;redhat下安装ncurses-devel,并删除当前目录CMakeCache.txt(必须删除,否则报错依旧)并重新运行:

重新cmake  .

命令

-- Performing Test HAVE_PEERCRED

-- Performing Test HAVE_PEERCRED - Success

Warning: Bison executable not found in PATH

-- Configuring done

-- Generating done

-- Build files have been written to: /home/mysql-5.5.15

一个警告总算不爽,如回显所见,安装bison。

这是两个比较多的问题。

修改my.cnf文件

1 [mysqld] 

2 basedir=/usr/local/mysql

3 datadir=/data 

4 user=mysql

mysql> show databases;

+--------------------+

| Database           |

| information_schema |

| mysql              |

| performance_schema |

| test               |

mysql> exit;

这样mysql服务就装完了。

三、php安装

我们需要装GD 库。

make[2]: *** [gd_png.lo] 错误 1

make[2]: Leaving directory `/usr/local/src/gd-2.0.33'

make[1]: *** [all-recursive] 错误 1

make[1]: Leaving directory `/usr/local/src/gd-2.0.33'

make: *** [all] 错误 2

解决办法

vi gd_png.c

15行找到“png.h”改成“/usr/local/libpng-1.4.4/include/png.h”

cp php.ini-development /usr/local/php-5.3.8/lib/php.ini

在APACHE 整合PHP

vim /usr/local/apache-2.2.21/conf/httpd.conf

53 LoadModule php5_module modules/libphp5.so

54 AddType application/x-httpd-php .php

106 DocumentRoot "/www"

133 <Directory "/www">

167 <IfModule dir_module>

168 DirectoryIndex index.html index.php 

169 </IfModule>

<?PHP

phpinfo();

?>

重启apche

Syntax OK

<a target="_blank" href="http://blog.51cto.com/attachment/201111/165654738.jpg"></a>

 优化下 apache

378 Include conf/extra/httpd-mpm.conf

ServerLimit 20000      # 连接数

StartServers 20          #启动进程数值

MinSpareServers 20  # 空闲最小线程数

MaxSpareServers 50  #空闲最大线程数

MaxClients 1000       #最大线程数

MaxRequestsPerChild 10000

//每个子进程在其生存期内允许伺服的最大请求数量,默认为10000.到达MaxRequestsPerChild的限制后,子进程将会结束。假如MaxRequestsPerChild为"0",子进程将永远不会结束。

开启启动设置:写到/etc/rc.local  里面 

/usr/local/apache-2.2.21/bin/apachectl start

/usr/local/mysql/bin/mysqld_safe &amp;

exit 0

本文转自 houzaicunsky 51CTO博客,原文链接:http://blog.51cto.com/hzcsky/720199