Chinaunix首页 | 论坛 | 博客
  • 博客访问: 178084
  • 博文数量: 66
  • 博客积分: 1736
  • 博客等级: 上尉
  • 技术积分: 830
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-05 15:40
文章分类

全部博文(66)

文章存档

2014年(17)

2013年(2)

2012年(47)

我的朋友

分类: LINUX

2012-11-16 10:05:02

本文教你如何从源码安装LAMP环境

export PREFIX=/usr/local/lamp

(1).Zlib
    tar xvf zlib-1.2.5.tar.bz2
    cd zlib-1.2.5
    ./configure --prefix=${PREFIX}/zlib
    make && make install
 
(2).libjpeg
    tar xvf jpegsrc.v8c.tar.gz
    cd jpeg-8c
    ./configure --prefix=${PREFIX}/libjpeg --with-gnu-ld
     make && make install

(3).FreeType
    tar xvf freetype-2.4.4.tar.bz2
    cd freetype-2.4.4
    ./configure --prefix=${PREFIX}/freetype --with-gnu-ld
    make && make install

(4).libpng
    tar xvf libpng-1.5.1.tar.gz
    cd libpng-1.5.1
    ./configure --prefix=${PREFIX}/libpng --with-zlib-prefix=${PREFIX}/zlib
    make && make install

(5).expat
    tar xvf expat-2.0.1.tar.gz
    cd expat-2.0.1
    ./configure --prefix=${PREFIX}/expat
    make && make install

(5-1).libiconv
    tar xvf libiconv.tar.gz
    cd libiconv
    ./configure --prefix=${PREFIX}/libiconv
    make && make install

(5-2).autoconf
    tar xvf autoconf.tar.gz
    cd autoconf
    ./configure --prefix=${PREFIX}/autoconf
    make && make install

(6).gd
    tar xvf gd-2.0.35.tar.gz
    cd gd-2.0.35
    ./configure --prefix=${PREFIX}/gd --with-gnu-ld  --with-png=${PREFIX}/libpng \
    --with-freetype=${PREFIX}/freetype --with-jpeg=${PREFIX}/libjpeg  \
    --with-libiconv-prefix=${PREFIX}/libiconv
    make && make install
   

(7).libxml
    tar xvf libxml2-sources-2.7.8.tar.gz
    cd libxml2-2.7.8
    ./configure --prefix=${PREFIX}/libxml --with-zlib=${PREFIX}/zlib \
    --with-iconv=${PREFIX}/libiconv
    make && make install

(8).libmcrypt
    tar xvf libmcrypt-2.5.8.tar.gz
    cd libmcrypt-2.5.8
    ./configure --prefix=${PREFIX}/libmcrypt --enable-static=yes --enable-dynamic-loading
    make && make install

(9).cronolog
    tar xvf cronolog.tar.gz
    cd cronolog   
    ./configure --prefix=${PREFIX}/cronolog
    make && make install

(10).openssl
    tar xvf openssl-1.0.0d.tar.gz
    cd openssl-1.0.0d
    ./config --prefix=${PREFIX}/openssl --openssldir=${PREFIX}/openssl shared
    make && make install
    echo "${PREFIX}/openssl/lib">>/etc/ld.so.conf

(11).openssh
    tar xvf openssh-5.8p1.tar.gz
    cd openssh-5.8p1
    ./configure --prefix=${PREFIX}/openssh -with-zlib=${PREFIX}/zlib --with-md5-passwords \
    --with-mantype=man --with-ssl-dir=${PREFIX}/openssl -with-ssl-engine \
    --with-Werror
    make && make install

(12).pcre
    tar xvf pcre-8.12.tar.bz2
    cd pcre-8.12
    ./configure --prefix=${PREFIX}/pcre --enable-pcregrep-libz
    make && make install

(12-1).openssl-0.98
    tar xvf openssl-0.98.tar.gz
    cd openssl-0.98
    ./config --prefix=${PREFIX}/openssl0.98 --openssldir=${PREFIX}/openssl0.98 shared
    make && make install

(13).mysql
    tar xvf mysql-5.0.22.tar.gz
    cd mysql-5.0.22   
    groupadd mysql
    useradd -g mysql -M mysql
    ./configure --prefix=${PREFIX}/mysql --enable-assembler --enable-local-infile \
    --enable-thread-safe-client --with-charset=utf8 --with-extra-charsets=all \
    --with-mysqld-user=mysql --with-zlib-dir=${PREFIX}/zlib --with-comment \
    --with-openssl=${PREFIX}/openssl0.98 --with-big-tables
    make && make install

    cp support-files/my-medium.cnf /etc/my.cnf
    cd ${PREFIX}/mysql
    bin/mysql_install_db --user=mysql
    chown -R root  .
    chown -R mysql var
    chgrp -R mysql .
   
    #启动mysqld服务器
    bin/mysqld_safe --user=mysql &
    bin/mysqladmin -u root password "root"
    cp -v ${PREFIX}/mysql/share/mysql/mysql.server /etc/init.d/mysqld
    chmod +x /etc/init.d/mysqld
   
   
(14).Apache
    tar xvf httpd-2.3.11-beta.tar.gz
    cd httpd-2.3.11-beta
    ./configure --prefix=${PREFIX}/apache --enable-modules=all \
    --enable-mods-shared=most --enable-so --with-pcre=${PREFIX}/pcre \
    --with-z=${PREFIX}/zlib --with-ssl==${PREFIX}/openssl --enable-ssl \
    --enable-cgi --enable-rewrite=shared --enable-vhost-alias --enable-static-support \
    --disable-userdir --enable-mime-magic
    make && make install
    cp -v ${PREFIX}/apache/bin/apachectl /etc/init.d/httpd
    chmod -R 755 ${PREFIX}/apache/htdocs

(15).php
    tar xvf php-5.3.5.tar.bz2
    cd php-5.3.5
    ./buildconf --force
    ./configure --prefix=${PREFIX}/php --with-config-file-path=${PREFIX}/php/etc \
    --with-mysql=${PREFIX}/mysql --with-mysqli=${PREFIX}/mysql/bin/mysql_config \
    --with-iconv-dir=${PREFIX}/libiconv  --with-freetype-dir=${PREFIX}/freetype \
    --with-jpeg-dir=${PREFIX}/libjpeg  --with-png-dir=${PREFIX}/libpng --with-zlib-dir=${PREFIX}/zlib \
    --with-libxml-dir=${PREFIX}/libxml --enable-xml --enable-magic-quotes --enable-safe-mode \
    --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl \
    --with-curlwrappers --with-gettext --with-mhash --enable-pcntl --enable-sockets \
    --with-xmlrpc --enable-zip --enable-soap --enable-mod-charset --with-apxs2=${PREFIX}/apache/bin/apxs \
    --with-openssl=${PREFIX}/openssl --with-pcre-regex=${PREFIX}/pcre --with-zlib=${PREFIX}/zlib  \
    --with-mcrypt=${PREFIX}/libmcrypt
    make && make install
    mkdir -p ${PREFIX}/php/etc
    cp php.ini-development ${PREFIX}/php/etc/php.ini
    echo "Addtype application/x-httpd-php .php .phtml" >> ${PREFIX}/apache/conf/httpd.conf

(15-1).若开启SELINUX则如下操作

[1].关闭SELINUX
    sed -i -e "s@SELINUX=enforcing@SELINUX=disabled@" /etc/selinux/config
[2].不关闭SELINUX
    setenforce 0
    chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t ${PREFIX}/apache/modules/libphp5.so
    setenforce 1

(15-2).配置httpd.conf
sed -i -e "s|ServerAdmin you@example.com|ServerAdmin $(hostname)|" ${PREFIX}/apache/conf/httpd.conf
sed -i -e "s|ServerName |ServerName localhost:80|" ${PREFIX}/apache/conf/httpd.conf
sed -i -e "s|DirectoryIndex|DirectoryIndex index.php|" ${PREFIX}/apache/conf/httpd.conf

(16).测试
    echo "" >${PREFIX}/apache/htdocs/index.php
    chmod 755 ${PREFIX}/apache/htdocs/index.php
    service httpd restart

(17).phpMyAdmin
    tar xvf phpMyAdmin-3.3.10-all-languages.tar.bz2
    cd phpMyAdmin-3.3.10-all-languages
    mv * ${PREFIX}/apache/htdocs
    cd ${PREFIX}/apache/htdocs
    cp config.sample.inc.php config.inc.php

更多精彩文章尽在:

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

上一篇:cd

下一篇:RAID的初步使用

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