debian下LAMP+nginx代理+awstats+cacti+nagios(一)
這個系統吧比較純淨,APT包管理相當舒服比yum 還舒服!
root@houzaicun:/home# apt-get install lrzsz #我用的XSHELL 工具 為了方便直接扔包!
一首先就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 下
root@houzaicun:/home# apt-get install build-essential #只安裝他就可以了!
root@houzaicun:/home# apt-get install make 安裝make 工具 為什麼我說他純淨了。
root@houzaicun:/home# tar -zxvf httpd-2.2.21.tar.gz
root@houzaicun:/home# cd httpd-2.2.21/
root@houzaicun:/home/httpd-2.2.21# cd srclib/apr
root@houzaicun:/home/httpd-2.2.21/srclib/apr# ./configure –prefix=/usr/local/apr
root@houzaicun:/home/httpd-2.2.21/srclib/apr# make
root@houzaicun:/home/httpd-2.2.21/srclib/apr# make install
root@houzaicun:/home/httpd-2.2.21/srclib/apr# cd ../apr-util/
root@houzaicun:/home/httpd-2.2.21/srclib/apr-util# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
root@houzaicun:/home/httpd-2.2.21/srclib/apr-util# make
root@houzaicun:/home/httpd-2.2.21/srclib/apr-util# make install
root@houzaicun:/home/httpd-2.2.21# cd ../../
root@houzaicun:/home/httpd-2.2.21# ./configure –prefix=/usr/local/apache-2.2.21 –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –enable-so –enable-rewrite
出現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庫了!
root@houzaicun:/home/httpd-2.2.21# make
root@houzaicun:/home/httpd-2.2.21# make install
root@houzaicun:/home/httpd-2.2.21# /usr/local/apache-2.2.21/bin/apachectl start #啟動
root@houzaicun:/home/httpd-2.2.21# ps -aux |grep httpd # 檢視程式
二mysql安裝
安裝cmake(mysql5.5以後是通過cmake來編譯的)
# wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
# tar zxvf cmake-2.8.5.tar.gz
# cd cmake-2.8.5
#.configure
# make && make install
root@houzaicun:/home/httpd-2.2.21# cd /home/
root@houzaicun:/home# tar -zxvf mysql-5.5.15.tar.gz
root@houzaicun:/home/mysql-5.5.15# cd mysql-5.5.15/
root@houzaicun:/home/mysql-5.5.15#apt-get install libncurses5-dev
root@houzaicun:/home/mysql-5.5.15# groupadd -r mysql
root@houzaicun:/home/mysql-5.5.15#useradd -r -M -s /usr/sbin/nologin -g mysql mysql
root@houzaicun:/home/mysql-5.5.15# mkdir -p /data
root@houzaicun:/home/mysql-5.5.15# mkdir -p /usr/local/mysql
root@houzaicun:/home/mysql-5.5.15# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_unicode_ci -DWITH_DEBUG=0
root@houzaicun:/home/mysql-5.5.15# make
root@houzaicun:/home/mysql-5.5.15# make install
具體可以參考http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide
這是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(必須刪除,否則報錯依舊)並重新執行:
root@houzaicun:/home/mysql-5.5.15# apt-get install libncurses5-dev
root@houzaicun:/home/mysql-5.5.15# rm -rf 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。
root@houzaicun:/home/mysql-5.5.15# apt-get install bison
———————————————————-
這是兩個比較多的問題。
root@houzaicun:/home/mysql-5.5.15# cp support-files/my-medium.cnf /etc/my.cnf
root@houzaicun:/home/mysql-5.5.15# cd /usr/local/mysql/scripts
root@houzaicun:/usr/local/mysql/scripts# ./mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/data –no-defaults
修改my.cnf檔案
1 [mysqld]
2 basedir=/usr/local/mysql
3 datadir=/data
4 user=mysql
root@houzaicun:/usr/local/mysql/scripts# chown mysql:root -R /usr/local/mysql/
root@houzaicun:/usr/local/mysql/scripts# chown -R mysql:mysql /data/
root@houzaicun:/usr/local/mysql/scripts# /usr/local/mysql/bin/mysqld_safe &
root@houzaicun:/usr/local/mysql/scripts# ps -axu |grep mysql 檢視啟動是否成功
root@houzaicun:/usr/local/mysql/scripts# /usr/local/mysql/bin/mysqladmin -u root password “youpassword”
root@houzaicun:/usr/local/mysql/scripts# /usr/local/mysql/bin/mysql -u root -pyoupassword
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
mysql> exit;
這樣mysql服務就裝完了。
三、php安裝
我們需要裝GD 庫。
root@houzaicun:/usr/local/mysql/scripts# cd /home
root@houzaicun:/home# tar -zxvf freetype-2.4.3.tar.gz
root@houzaicun:/home# cd freetype-2.4.3/
root@houzaicun:/home/freetype-2.4.3# ./configure –prefix=/usr/local/freetype-2.4.3
root@houzaicun:/home/freetype-2.4.3# make
root@houzaicun:/home/freetype-2.4.3# make install
root@houzaicun:/home/freetype-2.4.3# cd ..
root@houzaicun:/home# tar -zxvf libpng-1.4.4.tar.gz
root@houzaicun:/home/libpng-1.4.4# apt-get install zlib1g-dev
root@houzaicun:/home/libpng-1.4.4# cd libpng-1.4.4/
root@houzaicun:/home/libpng-1.4.4# ./configure –prefix=/usr/local/libpng-1.4.4
root@houzaicun:/home/libpng-1.4.4# make
root@houzaicun:/home/libpng-1.4.4# make install
root@houzaicun:/home/libpng-1.4.4#cd ..
root@houzaicun:/home/libpng-1.4.4# tar -zxvf jpegsrc.v8b.tar.gz
root@houzaicun:/home/libpng-1.4.4# cd /jpeg-8b/
root@houzaicun:/home/libpng-1.4.4# ./configure –prefix=/usr/local/jpeg-8b
root@houzaicun:/home/libpng-1.4.4# make
root@houzaicun:/home/libpng-1.4.4# make install
root@houzaicun:/home/libpng-1.4.4#cd ..
root@houzaicun:/home/#tar -zxvf gd-2.0.33.tar.gz
root@houzaicun:/home# cd gd-2.0.33
root@houzaicun:/home# ./configure –prefix=/usr/local/gd-2.0.33 –with-jpeg=/usr/local/jpeg-8b –with-freetype=/usr/local/freetype-2.4.3 –with-png=/usr/local/libpng-1.4.4/ –with-zlib –enable-m4_pattern_allow
root@houzaicun:/home# make
root@houzaicun:/home# make install
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”
root@houzaicun:/home/gd-2.0.33# cd ..
root@houzaicun:/home/gd-2.0.33# tar -zxvf php-5.3.8.tar.gz
root@houzaicun:/home# cd php-5.3.8/
root@houzaicun:/home/php-5.3.8# apt-get install libxml2-dev
root@houzaicun:/home/php-5.3.8# ./configure –prefix=/usr/local/php-5.3.8 –with-apxs2=/usr/local/apache-2.2.21/bin/apxs –with-zlib –with-libxml-dir –enable-gd-native-ttf –enable-mbstring –with-gd=/usr/local/gd-2.0.33/ –with-mysql=/usr/local/mysql –with-freetype-dir=/usr/local/freetype-2.4.3 –with-jpeg-dir=/usr/local/jpeg-8b/ –with-png-dir=/usr/local/libpng-1.4.4/ –enable-sockets
root@houzaicun:/home/php-5.3.8# make && make install
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>
root@houzaicun:/home/php-5.3.8#mkdir /www
root@houzaicun:/home/php-5.3.8#cat /www/info.php
<?PHP
phpinfo();
?>
重啟apche
root@houzaicun:/www# /usr/local/apache-2.2.21/bin/apachectl -t 測試配置檔案是否正確
Syntax OK
root@houzaicun:/www# /usr/local/apache-2.2.21/bin/apachectl restart
優化下 apache
vim /usr/local/apache-2.2.21/conf/httpd.conf
378 Include conf/extra/httpd-mpm.conf
root@houzaicun:/www# vim /usr/local/apache-2.2.21/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 &
exit 0
本文轉自 houzaicunsky 51CTO部落格,原文連結:http://blog.51cto.com/hzcsky/720199
相關文章
- Debian下安裝JavaJava
- Debian下配置Oracle DataGuardOracle
- debian sid下vmware不能執行一則(轉)
- Debian下安裝EclipseEclipse
- Debian下安裝MyeclipseEclipse
- Debian下安裝TomcatTomcat
- debian下關閉ipv6
- Debian下安裝Eyou Mail ServerAIServer
- 在Debian/Ubuntu環境下更新chromeUbuntuChrome
- Debian下安裝Oracle10gOracle
- debian3下grub安裝(轉)
- Debian下配置telnet伺服器【轉】伺服器
- Debian/Ubuntu下L2TP VPN配置Ubuntu
- Debian下wine及Crossover全攻略(轉)ROS
- Debian Linux下安裝永中office(轉)Linux
- 在Linux(Debian)下安裝mono(轉)LinuxMono
- linux下正向代理/反向代理/透明代理使用說明Linux
- Debian 6.0的最後一次更新:Debian 6.0.10釋出
- RHEL6下squid代理之正向代理UI
- Debian下安裝拼音輸入法Fcitx
- 在Debian Woody (Stable) 下安裝 2.6 核心(轉)
- debian下openoffice字型方框的解決(轉)
- Git clone 太慢了解一下 Mac Linux 設定代理和取消代理的方法GitMacLinux
- debian
- Vagrant 利用代理加速下載
- 通俗易懂的講解一下Java的代理模式Java模式
- 記錄一下,如何配置nodejs nginx的反向代理NodeJSNginx
- nginx同一埠配置代理不同路徑下的檔案Nginx
- 如何在Debian和Ubuntu下重新打包Deb檔案Ubuntu
- Debian 5.0(Lenny)下安裝Mono 2.4和MonoDevelop 2.0Monodev
- 在debian下為PHP5.0.3安裝pdo模組(轉)PHP
- debian下編譯2.6.13.2核心的步驟及感受(轉)編譯
- debian下wine裡sourceinsight正常顯示的字型
- Nginx 學習系列(一) ------------- 正向代理與反向代理Nginx
- Debian9 (Stretch) 下編譯安裝 LNMP 環境編譯LNMP
- Debian9(Stretch) 下編譯安裝LNMP環境編譯LNMP
- Debian/Ubuntu Linux下核心程式設計者必備(轉)UbuntuLinux程式設計
- debian Linux下製作deb包的簡便方法(轉)Linux