Ubuntu源码安装Apache 2.2.19 + Mysql-5.5.16 + Php-5.3.8 + PDO + Pure-Ftpd服务命令

MYSQL

@ubuntu# apt-get install build-essential //安装编译器
@ubuntu# apt-get install cmake
@ubuntu# apt-cache search libncurses5-dev
@ubuntu# apt-get install bison
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/mysql-5.5.16.tar.gz
@ubuntu# tar -zxvf mysql-5.5.16.tar.gz
@ubuntu# cd mysql-5.5.16
@ubuntu# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
@ubuntu# make
@ubuntu# make install
@ubuntu# cd /usr/local/mysql
@ubuntu# cp support-files/my-medium.cnf /etc/my.cnf
@ubuntu# groupadd mysql
@ubuntu# useradd -r -g mysql mysql
@ubuntu# chown -R mysql:mysql .
@ubuntu# ./scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
@ubuntu# chown -R root .
@ubuntu# chown -R mysql data
@ubuntu# chown -R mysql:root .
@ubuntu# ./support-files/mysql.server start
@ubuntu# echo "/usr/local/mysql/support-files/mysql.server start" >>/etc/rc.local
@ubuntu# cd bin
@ubuntu# ./bin/mysqladmin -u root password
//roger@ubuntu# SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

 

Apache 

//安装apr
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://www.apache.org/dist/apr/apr-1.7.0.tar.bz2
@ubuntu# tar -jxvf apr-1.7.0.tar.bz2
@ubuntu# cd apr-1.7.0
@ubuntu# ./configure --prefix=/usr/local/apr
@ubuntu# make
@ubuntu# make install
//安装apr-util
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://www.apache.org/dist/apr/apr-util-1.6.1.tar.bz2
@ubuntu# tar -jxvf apr-util-1.6.1.tar.bz2
@ubuntu# cd apr-util-1.6.1
@ubuntu# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
@ubuntu# make
@ubuntu# make install
//安装apr-iconv
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://www.apache.org/dist/apr/apr-iconv-1.2.2.tar.bz2
@ubuntu# tar -jxvf apr-iconv-1.2.2.tar.bz2
@ubuntu# cd apr-iconv-1.2.2
@ubuntu# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
@ubuntu# make
@ubuntu# make install
//安装pcre
@ubuntu# cd /home/roger/soft
@ubuntu# wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.bz2
@ubuntu# tar -jxvf pcre-8.43.tar.bz2
@ubuntu# cd pcre-8.43
@ubuntu# ./configure --prefix=/usr/local/pcre
@ubuntu# make
@ubuntu# make install
//安装apache
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://www.apache.org/dist/httpd/httpd-2.4.41.tar.bz2
@ubuntu# tar -jxvf httpd-2.4.41.tar.bz2
@ubuntu# cd httpd-2.4.41
@ubuntu# ./configure --prefix=/usr/local/apache --enable-modules=all --with-apr=/usr/local/apr  --with-apr-iconv-path=/usr/local/apr-iconv --with-apr-util-path=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-mpm=worker --enable-cache  --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-mods-shared=most --enable-rewrite --enable-headers --enable-dav --enable-expires --with-z
@ubuntu# make
@ubuntu# make install
@ubuntu# /usr/local/apache/bin/apachectl start //启动apche2
@ubuntu# echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local  //加入开机自动启动

 

PHP

@ubuntu# cd /home/roger/soft
//****安装libxml2
@ubuntu# wget http://localhost/file/libxml2-2.7.7.tar.gz
@ubuntu# tar -zxvf libxml2-2.7.7.tar.gz
@ubuntu# cd libxml2-2.7.7
@ubuntu# mkdir /usr/local/libxml
@ubuntu# ./configure --prefix=/usr/local/libxml
@ubuntu# make
@ubuntu# make install
//****安装zlib
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/zlib-1.2.5.tar.gz
@ubuntu# tar -zxvf zlib-1.2.5.tar.gz
@ubuntu# cd zlib-1.2.5
@ubuntu# ./configure
@ubuntu# make
@ubuntu# make install
//****安装jpeg
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/jpegsrc.v8b.tar.gz
@ubuntu# tar -zxvf jpegsrc.v8b.tar.gz
@ubuntu# cd jpeg-8b
@ubuntu# mkdir /usr/local/jpeg
@ubuntu# ./configure --prefix=/usr/local/jpeg
@ubuntu# make
@ubuntu# make install
//****安装libpng
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/libpng-1.4.4.tar.gz
@ubuntu# tar -zxvf libpng-1.4.4.tar.gz
@ubuntu# cd libpng-1.4.4
@ubuntu# mkdir /usr/local/libpng
@ubuntu# ./configure --prefix=/usr/local/libpng
@ubuntu# make
@ubuntu# make install
//****安装freetype
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/freetype-2.4.3.tar.gz
@ubuntu# tar -zxvf freetype-2.4.3.tar.gz
@ubuntu# cd freetype-2.4.3
@ubuntu# mkdir /usr/local/freetype
@ubuntu# ./configure --prefix=/usr/local/freetype
@ubuntu# make
@ubuntu# make install
//****安装gd2
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/gd-2.0.35.tar.gz
@ubuntu# tar -zxvf gd-2.0.35.tar.gz
@ubuntu# cd gd-2.0.35
@ubuntu# vim gd_png.c //修改16行 #include "png.h" 为 #include "/usr/local/libpng/include/png.h"
@ubuntu# mkdir /usr/local/gd2
@ubuntu# ./configure --prefix=/usr/local/gd2 --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg  --with-freetype=/usr/local/freetype
@ubuntu# make
@ubuntu# make install
//****安装curl
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/curl-7.22.0.tar.gz
@ubuntu# tar -zxvf curl-7.22.0.tar.gz
@ubuntu# cd curl-7.22.0
@ubuntu# ./configure
@ubuntu# make
@ubuntu# make install
 
//****安装openssl
@ubuntu# apt-get remove openssl
@ubuntu# wget http://localhost/file/openssl-1.0.0e.tar.gz
@ubuntu# tar -zxvf openssl-1.0.0e.tar.gz
@ubuntu# cd openssl-1.0.0e
@ubuntu# ./config
@ubuntu# make
@ubuntu# make install
//****安装PDO和PDO_OCI访问oracle数据
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/instantclient-basic-linux-x86-64-11.2.0.2.0.zip
@ubuntu# wget http://localhost/file/instantclient-sdk-linux-x86-64-11.2.0.2.0.zip
@ubuntu# unzip instantclient-basic-linux-x86-64-11.2.0.2.0.zip
@ubuntu# unzip instantclient-sdk-linux-x86-64-11.2.0.2.0.zip
@ubuntu# mv instantclient_11_2 /usr/local/oracle
@ubuntu# cd /usr/local/oracle
@ubuntu# ln -s libclntsh.so.11.1 libclntsh.so
@ubuntu# ln -s libocci.so.11.1 libocci.so
@ubuntu# 重新编译php,并且在./configure后面添加 --with-pdo-oci=instantclient,/usr/local/oracle,11.2.0.2.0
@ubuntu# 重启 apache
//****安装php
@ubuntu# cd /home/roger/soft
@ubuntu# wget http://localhost/file/php-5.3.8.tar.bz2
@ubuntu# tar -jxvf php-5.3.8.tar.bz2
@ubuntu# cd php-5.3.8
@ubuntu# cp /home/roger/soft/php-5.3.8/ext/phar/phar/phar.php /home/roger/soft/php-5.3.8/ext/phar/phar.phar
@ubuntu# apt-get install libc-client2007b-dev
@ubuntu# apt-get install libmcrypt-dev
@ubuntu# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-snmp --enable-wddx --enable-inline-optimization --enable-calendar --enable-zip --enable-sockets --enable-shmop --with-mcrypt --with-iconv --enable-mbstring=all --enable-ftp --with-zlib-dir --enable-maintainer-zts --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-mysqli=mysqlnd --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg --enable-sockets --enable-pcntl --with-curl --enable-shmop --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --with-libxml-dir=/usr/local/libxml --without-pear --enable-fastcgi --enable-force-cgi-redirect   --with-openssl --enable-bcmath --enable-soap  --with-imap=/home/roger/soft/imap-2007f --with-imap-ssl --with-kerberos --with-pdo-oci=instantclient,/usr/local/oracle,11.2.0.2.0
@ubuntu# make
@ubuntu# make install
@ubuntu# cd /usr/local/apache2/conf
@ubuntu# vim httpd.conf
@ubuntu# AddType application/x-httpd-php .php
@ubuntu# LoadModule php5_module modules/libphp5.so
@ubuntu# 
@ubuntu# SetHandler application/x-httpd-php
@ubuntu# 

 

Pure-ftpd

@ubuntu# cd /home/roger/soft
@ubuntu# wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.29.tar.gz
@ubuntu# tar -zxvf pure-ftpd-1.0.29.tar.gz
@ubuntu# cd pure-ftpd-1.0.29
@ubuntu# ./configure --prefix=/usr/local/pureftpd --with-everything --with-rfc2640
@ubuntu# make
@ubuntu# make check
@ubuntu# make install
@ubuntu# chmod 755 configuration-file/pure-config.pl
@ubuntu# cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/
@ubuntu# mkdir /usr/local/pureftpd/etc/
@ubuntu# cp configuration-file/pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
@ubuntu# cd /usr/local/pureftpd/etc/
@ubuntu# vim pure-ftpd.conf  //修改127行为PureDB认证:PureDB /usr/local/pureftpd/etc/pureftpd.pdb
@ubuntu# cd /usr/local/pureftpd/bin
@ubuntu# ./pure-pw useradd roger -u roger -g roger -d /web
@ubuntu# ./pure-pw mkdb /usr/local/pureftpd/etc/pureftpd.pdb
@ubuntu# /usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf

 

 

========================= 安装subversion=============================

1 wget http://localhost/congig/soft/subversion-1.7.5.sqlite.tar.gz
2 tar zxvf subversion-1.7.5.sqlite.tar.gz
3 cd subversion-1.7.5/neon
4 ./configure --prefix=/usr/local/neon
5 make && make install
6 vim ./src/Makefile 将28行 CFLAGS= -g -O2 -prefer-pic 改为CFLAGS= -fPIC -g -O2 -prefer-pic
7 cd ../
8 ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr/ --with-ssl --with-neon=/usr/local/neon
9 make && make install

 

========================= 安装nginx并配置https访问=============================

 1 @ubuntu# cd /home/roger/soft/
 2 @ubuntu# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz
 3 @ubuntu# tar -zxvf pcre-8.12.tar.gz
 4 @ubuntu# wget http://localhost/file/openssl-1.0.0e.tar.gz
 5 @ubuntu# tar -zxvf openssl-1.0.0e.tar.gz
 6 @ubuntu# cd /home/roger/soft/
 7 @ubuntu# wget http://localhost/file/nginx-1.0.8.tar.gz
 8 @ubuntu# tar -zxvf nginx-1.0.8.tar.gz
 9 @ubuntu# cd nginx-1.0.8
10 @ubuntu# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/roger/soft/pcre-8.12 --with-openssl=/home/roger/soft/openssl-1.0.0e
11 @ubuntu# make
12 @ubuntu# make install

 

配置fastcgi模式访问php

 

@ubuntu# cd /usr/local/nginx/conf
@ubuntu# vim mime.types
@ubuntu# application/x-httpd-php               php;  //增加一行
@ubuntu# vim nginx.conf

 

增加如下配置

 

 1 server {
 2         listen       443;
 3         server_name  rsa.hiido.com;
 4  
 5         ssl                  on;
 6         ssl_certificate      hiido.crt;
 7         ssl_certificate_key  hiido.key;
 8  
 9         ssl_session_timeout  5m;
10  
11         ssl_protocols  SSLv2 SSLv3 TLSv1;
12         ssl_ciphers  HIGH:!aNULL:!MD5;
13         ssl_prefer_server_ciphers   on;
14  
15         location / {
16             root   /usr/local/nginx/html;
17             index  index.php index.html index.htm;
18         }
19  
20         location ~ .php$ {
21                 fastcgi_pass   127.0.0.1:9000;
22                 fastcgi_index  index.php;
23                 fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;
24                 include        fastcgi_params;
25         }
26     }

 

nginx没有自带的fastcgi管理器,使用lighttpd,所以先安装一个lighttpd

 

1 apt-get install lighttpd
2 cp /usr/bin/spawn-fcgi  /usr/local/nginx/sbin/
3 chmod 777 /usr/local/nginx/sbin/spawn-fcgi 
4 apt-get remove lighttpd

 

修改php.ini增加一行

1 cgi.fix_pathinfo=1

 

启动脚本:

 

1 #!/bin/sh
2 killall nginx
3 killall nginx
4 killall php-cgi
5 killall php-cgi
6 killall php-cgi
7 killall php-cgi
8 /usr/local/nginx/sbin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nobody -f /usr/local/php/bin/php-cgi -C 20
9 /usr/local/nginx/sbin/nginx

 

反向代理加http验证实例:

 

 1 upstream  www.subsir.gocm  {
 2                 server   192.168.2.10:28480;
 3         }
 4  
 5     server {
 6         listen       8000;
 7         server_name  www.eeta.gocm;
 8         access_log  /web/logs/hadoop_dfs_access.log  main;
 9                 autoindex off;
10         allow 127.0.0.1;
11         deny all;
12             auth_basic  "Hiido-login-auth";
13                 auth_basic_user_file httpd.authz;
14  
15         location / {
16                         proxy_pass        http://www.subsir.gocm/;
17                         proxy_set_header   Host             $host;
18                         proxy_set_header   X-Real-IP        $remote_addr;
19                         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
20             index  dfshealth.jsp index.php index.html index.htm;
21         }
22  
23     }

 

 

 

posted @ 2012-06-27 10:55  subsir  阅读(898)  评论(0编辑  收藏  举报