lamp编译安装

安装说明apache2.4mysql5.5php5.4

   yum install �Cy gcc

   1、  安装apr

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

 make && make instal

2、安装apr-util

./configure --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr

make  &&  make install

3、安装apache

 yum install �Cy pcre-devel  openssl-devel 

    ./configure--prefix=/usr/local/apache2   --enable-so--enable-ssl --       enable-cgi --enable-rewrite --with-zlib --with-pcre--with-               apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/--enable-         modules=most --enable-mpms-shared=all --with-mpm=prefork

    make �Cj2 &&  make install �Cj2

  4、安装mysql

 yum install gcc-c++ cmake ncurses-develbison perl  -y

 useradd -s  /sbin/nologing  mysql

 mkdir -p  /data/mysql

 chown -R  mysql.mysql  /data/mysql/

 cmake 

 -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

 -DMYSQL_DATADIR=/data/mysql

 -DWITH_MYISAM_STORAGE_ENGINE=1 

 -DWITH_INNOBASE_STORAGE_ENGINE=1

 -DWITH_MEMORY_STORAGE_ENGINE=1

 -DWITH_READLINE=1

 -DMYSQL_TCP_PORT=3306

 -DENABLED_LOCAL_INFILE=1

 -DWITH_PARTITION_STORAGE_ENGINE=1 

 -DEXTRA_CHARSETS=all 

 -DDEFAULT_CHARSET=utf8 

 -DDEFAULT_COLLATION=utf8_general_ci

 -DWITH_DEBUG=0

 -DMYSQL_USER=mysql

 -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock

 make -j2  &&  make install  -j2

 cp /usr/local/src/mysql-5.5.44/support-files/my-large.cnf  /etc/my.cnf

 cp /usr/local/src/ mysql-5.5.44/support-files/mysql.server                /etc/init.d/mysqld

 chmod  755  /etc/init.d/mysqld

 修改/etc/my.cnf配置文件,注意修改下列字段:

 [client]

 port = 3306

 socket = /data/mysql/mysq.sock

 [mysqld]

 port = 3306

 datadir = /data/mysql

 basedir = /usr/local/mysql

 socket = /data/mysql/mysql.sock

 初始话数据库

  /usr/local/mysql/scripts/mysql_install_db  --basedir=/usr/local/mysql   --datadir=/data/mysql  --user=mysql

  启动mysql数据库

  /etc/init.d/mysql  start

  chkconfig --add  mysqld

  chkconfig --level  35  mysqld on

 5、安装php

yum install libxml2-devellibmcrypt-devel bzip2-devel libxml2-devel   openssl-devel   bzip2 bzip2-devel

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

         --with-config-file-path=/usr/local/php/etc   --with-                                                               apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql/

      make  -j2  && make  install �Cj2

   6、  整合apache+php环境

#ServerName www.example.com:80  前面的#号去掉

AddType application/x-gzip.gz .tgz  下加入一行

AddTypeapplication/x-httpd-php .php

    DirectoryIndex  index.php index.html (把index.php加入index.html之前)

       然后在/usr/local/apache/htdocs目录下创建index.php测试页面,执行如下命令:

       cat>>/usr/local/apache/htdocs/index.php <<EOF

       <?php 

       phpinfo();

       ?>

       EOF

       重新启动apache服务,通过IP访问界面如下图,即代表LAMP环境搭建成功。


wKiom1Wwj23SynS5AAIhQ8ZLtmI041.jpg

你可能感兴趣的:(lamp,编译安装,mysql5.5)