LAMPの構築

13822 ワード

RPM          /usr/local/src

          /usr/local/apache
                 /usr/local/mysql
                 /usr/local/php

  MySQL       /usr/local/mysql/var

        /usr/local/apache/htdocs

2 LAMP    

        mysql、apache、PHP。             。

  mysql
http://mirror.provenscaling.com/mysql/enterprise/source/5.0/
     mysql-5.0.70.tar.gz

  apache
http://www.apache.org/dist/httpd/
     httpd-2.2.24.tar.gz

  php
http://php.net/downloads.php
     php-5.4.16.tar.gz

      *.tar.gz        /usr/local/src   
cd /usr/local/src (        )


   mysql
tar -zxvf mysql-5.0.70.tar.gz (   )

cd mysql-5.0.70 (           )

./configure --prefix=/usr/local/mysql

make

make install

useradd mysql //   mysql   ,    mysql,    。  mysql   root      , linux  root     

cd /usr/local/mysql

bin/mysql_install_db --user=mysql

chown -R mysql . //    ,         "."

chgrp -R mysql .

chown -R mysql var

cp share/mysql/my-medium.cnf /etc/my.cnf

cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //    

chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

/etc/rc.d/init.d/mysqld start //    MySQL (mysql      )

       mysql
cd /usr/local/mysql  //       

bin/mysql -uroot -p //    mysql -u    -p  ,     mysql root     
       ,       mysql

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
       root  root        mysql   
   root       root   ,   mysql root     , root          
"%"    ,      ip,       , "%"     ip

exit //  mysql
     linux
       ,  linux    public    mysql  


  Apache

tar -zxvf httpd-2.2.24.tar.gz

cd httpd-2.2.24

./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-shared=max

make

make install

/usr/local/apache/bin/apachectl -k start (  apache  )

       http://127.0.0.1/          apache    。

  PHP

tar -zxvf php-5.4.16.tar.gz

cd php-5.4.16

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-pcntl

make

make install

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

  httpd.conf

vi /usr/local/apache/conf/httpd.conf

 httpd.conf   ,  AddType    (           )
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

           ,          LoadModule  。(           )
LoadModule php5_module modules/libphp5.so
   loadModule php4_module modules/libphp4.so               php5


   DirectoryIndex index.html    
DirectoryIndex index.php index.html

  apache  ,      
/usr/local/apache/bin/apachectl -k start


  /usr/local/apache/htdocs/     phpinfo.php   
    
chmod -R 777 /usr/local/apache/htdocs

       http://127.0.0.1/phpinfo.php

    testdb.php
      ,   。
<?php
$link=mysql_connect('localhost','mysql','');//      mysql   :mysql,    
if(!$link) echo "fail";
else echo "success";
mysql_close();
?>

    success  php mysql    
LAMP      
       ,  linux    public    http  


============================================           


#./configure (               ,                          。           。)
      :(  GCC     )
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking whether make sets $(MAKE)... yes
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
    :
  
yum -y install gcc





  mysql, ./configure     :error: No curses/termcap library found     
  :
  ncurses   
    :
         
       RedHat  :
yum list|grep ncurses
yum -y install ncurses-devel
yum install ncurses-devel
 
       Ubuntu Debian:
apt-cache search ncurses
apt-get install libncurses5-dev





      MYSQL ,,MAKE      。
../depcomp: line 512: exec: g++: not found
make[2]: *** [my_new.o]    127
make[2]: Leaving directory `/tmp/lamp/mysql-5.0.70/mysys'
make[1]: *** [all-recursive]    1
make[1]: Leaving directory `/tmp/lamp/mysql-5.0.70'
make: *** [all]    2
[root@localhost mysql-5.0.70]#

    :
yum install -y gcc-c++



  PHP   
        :
Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed

2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs

3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/local/apache/bin/apxs follows:

./configure: /usr/local/apache/bin/apxs: not found

configure: error: Aborting

      perl
    :
  perl    ( http://www.perl.com      ,         5.8  make      )
     /usr/local/src  
cd /usr/local/src
tar xzvf perl-5.18.0.tar.gz
cd perl-5.18.0
sh Configure -de
make
make test
make install

   perl         ,
 apche     (      apache        )          
  
./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-shared=max
  
make
  
make install






   php          configure        :

configure: error: xml2-config not found. Please check your libxml2 installation.

 perl     libxml2-2.6.31.tar.gz   /usr/local/src  
  libxml2
cd /usr/local/src
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
./configure
make
make install

  libxml2 ,    php      configure





        :

configure: error: Please specify the install prefix of iconv with --with-iconv=

  libiconv-1.10.tar.gz
cd /usr/local/src
tar zxvf libiconv-1.10.tar.gz
cd libiconv-1.10
./configure
make
make install

  :         libiconv-1.11       ,         (        ,      bug          ,        ,   /usr/local/  libiconv           )