lamp 源代码 安装 (beta1)

本文详细介绍了如何从零开始搭建LAMP(Linux + Apache + MySQL + PHP)环境,包括各组件的下载、编译安装及配置过程。适用于希望自行部署Web服务器的开发者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.安装apache
1wget http://apache.freelamp.com/httpd/httpd-2.2.10.tar.gz
sudo apt-get install libc6-dev gcc
tar -zxvf httpd-NN.tar
cd httpd-NN
./configure --prefix=PREFIX
sudo make
sudo make install
PREFIX/bin/apachectl -k start
问题:
1.apache安装时出现 configure: error: C compiler cannot create executables q解决
  1.apt-get install build-essential
2.apt-get install libc6-dev g++ gcc
/usr/stephen/apache2/bin/apachectl -k start
3.http://blog.chinaunix.net/u2/70049/showart_1160753.htm

二、安装mysql
    1.sudo apt-get install g++
    ln -sf /usr/bin/make /usr/bin/gmake
    wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
    tar zxvf ncurses-5.6.tar.gz
    cd ncurses-5.6
    ./configure –prefix=/usr/local/mysql –with-shared –without-debug
    make
    make install clean
    shell> groupadd mysql
    shell> useradd -g mysql mysql
    shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
    shell> cd mysql-VERSION
    shell> ./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all

    shell> make WITH_CHARSET=utf8 WITH_XCHARSET=all
    shell> make install

    shell> cp support-files/my-medium.cnf /etc/my.cnf
    shell> cd /usr/local/mysql
    shell> bin/mysql_install_db --user=mysql
    shell> chown -R root  .
    shell> chown -R mysql var
    shell> chgrp -R mysql .
    shell>sudo chown -R 777 var
    shell> bin/mysqld_safe --user=mysql &
    shell>sudo share/mysql/mysql.server start --user=root
    #cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld /
    shell>cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //开机自动启动 mysql。
    卸载:make uninstall

三、安装php, gd, zlib,phpadmin 库
        shell>sudo wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
        shell> tar -zxvf gd-2.0.35.tar.gz
        shell>cd gd-2.0.35/
        shell> ./configure --prefix=/usr/local/gd2

        shell>make

        shell>make install

        shell>cd ..


        shell>sudo wget http://www.zlib.net/zlib-1.2.3.tar.gz

        shell>sudo tar -zxvf zlib-1.2.3.tar.gz

        shell>cd zlib-1.2.3/

        shell>sudo ./configure --prefix=/usr/local/zlib

         shell>sudo make

        shell>sudo make install


       shell>sudo apt-get install flex
     
shell>sudo apt-get install libxml2-dev
      shell>cd ../php-xxx
         shell>sudo make clean
      shell> sudo ./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-gd=/usr/local/gd2 --with-zlib-dir=/usr/local/zlib --enable-socket

        shell>sudo make

        shell>sudo make install

        shell> sudo cp php.ini-dist /usr/local/lib/php.ini

        shell>sudo vi /usr/local/apache2/conf/httpd.conf            

            完成这步以後,查找这两行,把前面的#去掉(AddType text/html .shtml AddOutputFilter,AddOutputFilter INCLUDES .shtml).在#AddType application/x-gzip .tgz的后面加上AddType application/x-httpd-php .php

         # sudo apt-get install libmysqlclient15-dev

        shell>sudo /usr/local/apache2/bin/apachectl start

        shell>sudo vi /usr/local/apache2/htdocs/test.php

          输入<?php phpinfo();?>


        shell>cd /usr/local/apache2/htdocs/

        shell>sudo wget http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-3.0.1.1-all-languages.tar.gz?download

        shell>sudo tar -zxvf phpMyAdmin-3.0.1.1-all-languages.tar.gz

        shell> sudo mv phpMyAdmin-3.0.1.1-all-languages phpmyadmin
        shell>

四、安装phpmyadmin
        # cd /usr/local/apache2/htdocs/
    # wget http://nchc.dl.sourceforge.net/sourc...-8-only.tar.gz
    # tar zxvf phpMyAdmin-2.11.1-all-languages-utf-8-only.tar.gz
    # mv phpMyAdmin-2.11.1-all-languages-utf-8-only phpmyadmin
    # cd phpmyadmin/libraries

    修改配置文件
    # vi config.default.php

    找到这几行进行修改:
    $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (valid choices: config, http, HTTP, signon or cookie)
    $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
    $cfg['Servers'][$i]['password'] = 'PASSWORD'; // MySQL password (only needed

    经过这几个步骤,我们一个比较安全的LAMP服务器就环境基本建立成功啦。




五、其它命令
查看进程  :ps auxw
    设置变量 :export
        
 


参考:
1.http://blog.chinaunix.net/u/7546/showart_1159919.html
2.http://httpd.apache.org/docs/2.0/install.html
3.http://blog.chinaunix.net/u/25509/showart_292657.html
4.http://dev.mysql.com/doc/refman/5.1/zh/installing.html#installing-source
5.http://www.php.net/manual/zh/install.unix.php


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值