码迷,mamicode.com
首页 > 其他好文 > 详细

LAMP环境编译

时间:2015-08-08 19:39:39      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

LAMP环境编译

准备工作
禁用SElinux和防火墙 iptables -F
简单的shell解压脚本
[root@localhost xiaoming]# vi tar.sh

#!/bin/sh
cd /root
ls *.tar.gz > ls.list
for TAR in `cat ls.list`
do
        tar -zxf $TAR
done

1、解压解包 .tar.gz    tar  -zvxf
2、./configure 配置
3、make 编译
4、make install 安装、拷贝

1)libxml2
# cd libxml2-2.6.30
# ./configure --prefix=/usr/local/libxml2/
make && make install

2)libmcrypt
# cd libmcrypt-2.5.8
# ./configure --prefix=/usr/local/libmcrypt/
make && make install
# cd libltdl/
# ./configure --enable-ltdl-install
make  && make install

3)zlib
# cd zlib-1.2.3
# ./configure(不指定安装路径,防止其他软件无法定位位置)
make  && make install
(可将安装信息定位到文件中 make install > /backup/zlib_20151121.install.log)

4)libpng
# cd libpng-1.2.31
# ./configure --prefix=/usr/local/libpng/
make  &&  make install

5)jpeg6
# cd jpeg-6b/
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir -p /usr/local/jpeg6/man/man1
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared  --enable-static
make  && make install

6)freetype
# cd ../freetype-2.3.5
# ./configure --prefix=/usr/local/freetype
make  && make install

7)autoconf
# cd ../autoconf-2.61
# ./configure ; make ; make install(最好不指定安装路径)

8)gd
# cd ../gd-2.0.35
# ./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6 --with-freetype=/usr/local/freetype/(无需zlib,让其自动查找)
make && make install


9)apache
# cd ../httpd-2.2.9
# ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
make && make install
# /usr/local/apache2/bin/apachectl start   启动服务即可测试Apache是否工作

10)mysql
需先安装一个编译工具
# cd ../ncurses-5.6
# ./configure --with-shared --without-debug --without-ada --enable-overwrite
make && make install

# groupadd mysql
[root@localhost ncurses-5.6]# grep mysql /etc/group
mysql:x:8890:
# useradd -g mysql mysql
[root@localhost ncurses-5.6]# grep mysql /etc/passwd
mysql:x:1008:8890::/home/mysql:/bin/bash

# cd ../mysql-5.0.41
# ./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
make  && make install
# cp support-files/my-medium.cnf /etc/my.cnf
# /usr/local/mysql/bin/mysql_install_db --user=mysql

#  chown -R root /usr/local/mysql
#  chown -R mysql /usr/local/mysql/var
#  chgrp -R mysql /usr/local/mysql

# /usr/local/mysql/bin/mysqld_safe --user=mysql &
# /usr/local/mysql/bin/mysql -u root
mysql> SET PASSWORD FOR ‘root‘@‘localhost‘=PASSWORD(‘root‘);

让Apache开机自动启动
# echo  "/usr/local/apache2/bin/apachectl start" >>/etc/rc.d/rc.local
MySQL启动脚本
# cp support-files/mysql.server    /etc/rc.d/init.d/mysqld
# chown root.root /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
# chkconfig --levels 245 mysqld off
# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:on    4:off   5:off   6:off

11)php
# cd  ../php-5.2.6
# ./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/
--with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/
--with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/
--with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config
--enable-soap --enable-mbstring=all -enable-sockets
make   &&  make  install

# cp php.ini-dist /usr/local/php/etc/php.ini
# vi /etc/httpd/httpd.conf
Addtype application/x-httpd-php .php .phtml
# /usr/local/apache2/bin/apachectl restart
# vi /usr/local/apache2/htdocs/info.php
<?php
        phpinfo();
?>

12)zend加速器
# cd ZendOptimizer-3.2.6-linux-glibc21-i386
# ./install.sh
输入php.ini的配置文件地址
/usr/local/php/etc

13)phpmyadmin
# cp -a ../phpMyAdmin-3.0.0-rc1-all-languages /usr/local/apache2/htdocs/phpmyadmin
# cd /usr/local/apache2/htdocs/phpmyadmin/
# cp config.sample.inc.php config.inc.php
# vi config.inc.php
$cfg[‘Servers‘][$i][‘auth_type‘] = ‘http‘;



14)安装curl拓展
# cd curl-7.19.6
# ./configure --prefix=/usr/local/curl
make  &&  make  install


# cd php-5.2.6/ext/curl(进入php源程序目录中的ext目录中)
# /usr/local/php/bin/phpize(调用phpize程序生成编译 配置文件)

# ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/DIR
出现错误:
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
其实就是curl的dev包没有安装, 解决方案:
# yum -y install curl-devel
make  && make install
# mkdir /usr/local/php/ext
# cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/curl.so /usr/local/php/ext/
修改php拓展库目录
# vi /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/ext/"
extension=curl.so
# /usr/local/php/bin/php -v  执行命令时,php会去检测配置文件是否正确
重启Apache
# /usr/local/apache2/bin/apachectl restart
检测php已加载的模块
# /usr/local/php/bin/php -m | grep curl

LAMP环境编译

标签:

原文地址:http://www.cnblogs.com/gimin/p/4713598.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!