LAMP环境编译

准备工作
禁用SElinux和防火墙 iptables -F
简单的shell解压脚本
[[email protected] 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
[[email protected] ncurses-5.6]# grep mysql /etc/group
mysql:x:8890:
# useradd -g mysql mysql
[[email protected] 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

时间: 08-07

LAMP环境编译的相关文章

Linux lamp环境编译安装

1.安装准备: 1)httpd-2.0.52.tar.gz 2)mysql-4.1.12.tar.gz 3)libxml2-2.6.27.tar 4)freetype-2.1.10.tar 5)gd-2.0.33.tar 6)jpegsrc.v6b.tar 7)libpng-1.2.16.tar 8)zlib-1.2.3.tar 9)freetds-0.64.tar.gz 10)php-4.3.9.tar.gz 11)phpMyAdmin292.tar.gz 12)ZendOptimizer-3

LAMP环境编译安装(详细)

linux下Apache.mysql.php.phpMyadmin源码包编译安装及配置 事先可以先去各应用官网选择相应的源码包下载并上传到linux服务器上.源码包目录根据喜好或一个标准放置即可. 注:此文档仅适用于自己学习及测试使用,后续还将继续完善及解读文档中的不足. 在此之前先关闭selinux(Secrity-EnhancedLinux,安全增强式Linux),不然会由于selinux的安全机制影响到一些配置文件的加载及更改. 临时关闭(不用重启机器): setenforce 0 1.安

lamp环境编译(实际通过)

CentOS:5.5Apache:2.2.9PHP:5.2.6MySQL:5.0.41 条件: yum install gccyum install gcc-c++ vi/etc/yum.repos.d/CentOS-CentOS-Base.repo rpm -qa |grep mysql 是否安装 ps -le |grep mysql 进程是否启动 yum remove httpd 卸载 不能用rpm查询用源码安装的软件 SELinux vi /etc/sysconfig/selinux Ne

基于lamp环境编译安装zabbix

环境:lamp 系统:centos 6 前提:编译安装软件需要安装开发环境,关闭iptables和selinux # yum groupinstall "Development Tools"  "Server Platform Development" 一.编译安装httpd httpd2.4需要apr.apr-util依赖包 1.编译安装apr.apr-util # tar xf apr-1.5.0.tar.bz2  # cd apr-1.5.0 # ./conf

lamp 环境编译安装

先检查当前的linux环境中是否有编译 gcc 跟gcc-c++的编译裤 使用 rpm -q gcc 查看,同理 rpm -q gcc-c++ 查看是否有编译 如果显示没有编译,会出现如下类似提示 package ***** is not installed 这时候我们可以使用yum来在线检查安装这两个编译器 yum install gcc yum install gcc-c++ 编译完成之后检查现在的linux是否安装默认的php跟mysql等 建议有的的话卸载掉 rpm -q httpd r

LAMP环境编译安装问题总结

apache: 问题: 安装apache的时候入到 error: mod_deflate has been requested but can not be built due to prerequisite failures的错误. 解决: 没有安装zlib包.运行命令: yum install zlib-devel PHP: 问题: 编译安装php出错mcrypt.h not found. Please reinstall libmcrypt yum install libmcrypt li

LAMP环境-编译安装php-fpm

配置httpd-2.4.23以fpm方式的php-5.5.38 一.apache.MySQL的安装与前一部分相同:请根据其进行安装: 可以参考编译安装LAMP http://ljohn.blog.51cto.com/11932290/1863283 二.编译安装php-5.5.38 1.解决依赖关系: 请配置好yum源(可以是本地系统光盘)后执行如下命令: # yum -y groupinstall "X Software Development" 如果想让编译的php支持mcrypt

lamp环境编译(apache2.4.7 php5.4.25 mysql 5.5.23)

环境要求 gcc.gcc-c++.cmake.bison(可能)支持 1.yum install gcc gcc-c++ cmake bison 2.修改yum配置,达到搜索本地设置 移走或改名/etc/yum.repos.d/CentOS-Base.repo 修改 vi /etc/yum.repos.d/CentOS-Media.repo baseurl=file:///mnt/cdrom enabled=1 3.卸载原有的apache.mysql等 rpm -qa |grep mysql 是

LAMP环境编译安装

MySQL编译安装#安装编译代码需要的包yum -y install make gcc-c++ cmake bison-devel  ncurses-devel#mysql安装 wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.32.tar.gztar -zxvf mysql-5.6.32.tar.gzcd mysql-5.6.32cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \