lamp源码搭建

准备环境一台centos6.5
准备源码包
wget http://ftp.cuhk.edu.hk/pub/packages/apache.org//httpd/httpd-2.4.16.tar.gz
wget http://bg2.php.net/distributions/php-5.6.12.tar.gz
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.26.tar.gz

源码安装Apache

1解决依赖关系

http需要apr和apr-util

(1) 编译安装apr

wget http://apache.01link.hk/apr/apr-1.5.2.tar.gz

#  tar -xvf apr-1.5.2.tar.gz

#  cd apr-1.5.2

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

# make && make install

(2) 编译安装apr-util

wget http://apache.01link.hk/apr/apr-util-1.5.4.tar.gz

# tar -xvf apr-util-1.5.4.tar.gz

# cd apr-util-1.5.4

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

# make && make install

在安装http的时候也要解决pcre-devel包,光盘自带

yum install pcre-devel -y

[[email protected] ~]# tar -xvf httpd-2.4.16.tar.gz

[[email protected] ~]# cd httpd-2.4.16

[[email protected] httpd-2.4.16]# less INSTALL

$ ./configure --prefix=PREFIX

$ make

$ make install

$ PREFIX/bin/apachectl start

这里我们需要个apache添加一些功能

./configure --help 可以查看帮助

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --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=most --with-mpm=event

这个时候安装openssl-devel 和update openssl

yum install openssl -y

yum update openssl-devel -y

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --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-mods-shared=most --enable-mpms-shared=all

make && make install

安装 Mysql

tar -xvf mysql-5.5.8.tar.gz

cmake下载地址:http://www.cmake.org/

# tar zxvf cmake-2.8.4.tar.gz

# cd cmake-2.8.4

#./configure

# make

# make install

ncurses下载地址:http://www.gnu.org/software/ncurses/

yum install ncurses-devel readline-devel

# tar zxvf ncurses-5.8.tar.gz

# cd ncurses-5.8

#./configure

# make

# make install

# mkdir -p /mydata/data

# groupadd -r mysql

# useradd -g mysql -r -s /sbin/nologin -M -d /mydata/data mysql

# chown mysql:mysql /mydata/data

# tar -xvf mysql-5.6.26.tar.gz

# cd mysql-5.6.26

# cmake ./ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data

# make && make install

将mysql的启动服务添加到系统服务中

# cp support-files/mysql.server  /etc/init.d/mysql

cd /usr/local/mysql

chown -R mysq:mysql .

scripts/mysql_install_db --user=mysql

shell> chown -R root .

shell> chown -R mysql data

shell> bin/mysqld_safe --user=mysql

现在可以使用下面的命令启动mysql

# service mysql start

停止mysql服务

# service mysql stop

重启mysql服务

# service mysql restart

当启动时候遇到错误

MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
-bash-4.1$ /etc/rc.d/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/mydata/data/www.pdjun.com.pid)

解决方法

Remove Your MySQL Config File

If you have modified your MySQL configuration file, MySQL may not like it few versions after (MySQL is not backward compatibility friendly). It can be the problem of using an unsupported variable, or something similar. The easiest way is to remove your configuration file, and try to start the MySQL server again:

Backup your MySQL configuration first.

mv /etc/my.cnf /etc/my.cnf.backup

And restart the MySQL server again:

/usr/local/share/mysql/mysql.server start

Hopefully you will see the following message:

Starting MySQL. SUCCESS!
给mysql设置密码
用root 进入mysql后mysql>set password =password(‘你的密码‘);mysql>flush privileges;

安装php

phph需要光盘里面的组包"X Software Development" 和libmcrypt,libmcrypt-devel

wget http://pkgs.repoforge.org/libmcrypt/libmcrypt-devel-2.5.7-1.2.el6.rf.x86_64.rpm

wget http://pkgs.repoforge.org/libmcrypt/libmcrypt-2.5.7-1.2.el6.rf.x86_64.rpm

yum -y groupinstall "X Software Development"

rpm -ivh libmcrypt-2.5.7-1.2.el6.rf.x86_64.rpm

rpm -ivh libmcrypt-devel-2.5.7-1.2.el6.rf.x86_64.rpm

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

tar -xvf php-5.6.12.tar.gz

cd php-5.6.12

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts

make

make test

make install

为php提供配置文件:

# cp php.ini-production /etc/php.ini

3、 编辑apache配置文件httpd.conf,以apache支持php

# vim /etc/httpd/httpd.conf

1、添加如下二行

AddType application/x-httpd-php  .php

AddType application/x-httpd-php-source  .phps

2、定位至DirectoryIndex index.html

修改为:

DirectoryIndex  index.php  index.html

而后重新启动httpd,或让其重新载入配置文件即可测试php是否已经可以正常使用。

安装xcache为php加速

wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz

tar -xvf xcache-3.2.0.tar.gz

cd xcache-3.2.0

# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config

# make && make install

安装结束时,会出现类似如下行:

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

2、编辑php.ini,整合php和xcache:

首先将xcache提供的样例配置导入php.ini

# mkdir /etc/php.d

# cp xcache.ini /etc/php.d

说明:xcache.ini文件在xcache的源码目录中

接下来编辑/etc/php.d/xcache.ini,找到extension开头的行,修改为如下行:

extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so

注意:如果php.ini文件中有多条zend_extension指令行,要确保此新增的行排在第一位。

时间: 2024-08-08 17:05:26

lamp源码搭建的相关文章

web应用之LAMP源码环境搭建

目录 一.LAMP环境的介绍   1.LAMP环境的重要性   2.LAMP组件介绍   二.Apache源码安装   1.下载Apache以及相关依赖包   2.安装Apache以及相关依赖包   2-1.安装Apache依赖包   2-2.安装apr   2-3.安装apr-util   2-4.安装pcre   2-5.安装Apache   3.配置Apache   3-1.启动Apache服务   3-2.注册Apache为服务   3-3.加入Apache服务到chkconfig中  

源码搭建LAMP环境

源码搭建LAMP环境 一,LAMP环境概述: LAMP指的Linux(操作系统).ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件)和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web 服务器.是一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台.随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件形成三足鼎立之势

Centos7.4源码搭建LAMP环境

CENTOS 7.4源码搭建LAMP 目录 一.源码安装apache2.4.33. 2 1.1.使用wget下载号所需的包 1.2.解压源码包并编译安装apache以及所需依赖包 1.3.启动apache服务 二.源码安装mysql 2.1.源码安装mysql 2.2.编译安装完成,对数据库进行初始化 2.3.启动数据库 2.4.创建数据库,给discuz用户授权 三.源码安装PHP并与apache进行整合 四.安装discuz论坛 一. 源码安装apache2.4.33 下载apache源码包

详解LAMP源码编译安装

实战:LAMP源码编译安装 家住海边喜欢浪:zhang789.blog.51cto.com 目录 详解LAMP源码编译安装 LAMP简介 一.准备工作 二.编译安装 Apache 三.编译安装 MySQL 四.编译安装 PHP 测试LAMP搭建开源数据web管理程序phpMyadmin 详解LAMP源码编译安装 LAMP简介 LAMP是当下非常流行的一套Web架构,我们可以在GNU/Linux下通过其他人打包的程序包来进行安装; 但是在生产环境中,很多时候都需要我们自己定制安装AMP,编译安装L

web应用之LAMP源码环境部署

web应用之LAMP源码环境搭建篇 目录 一.LAMP环境的介绍 1.LAMP环境的重要性 2.LAMP组件介绍 二.Apache源码安装 1.下载Apache以及相关依赖包 2.安装Apache以及相关依赖包 2-1.安装Apache依赖包 2-2.安装apr 2-3.安装apr-util 2-4.安装pcre 2-5.安装Apache 3.配置Apache 3-1.启动Apache服务 3-2.注册Apache为服务 3-3.加入Apache服务到chkconfig中 3-4.查看Apach

CentOS6.5源码搭建LAMP--基于module方式实现php(单台机器)

源码搭建LAMP 软件包下载源: 搜狐镜像源:http://mirrors.sohu.com/ apache下载网:http://mirror.bit.edu.cn/apache/ pcre官网:http://www.pcre.org/ apr官网:http://apr.apache.org/ apache官网:http://httpd.apache.org/ mysql官网:https://www.mysql.com/ php官网:http://php.net/ freetds:http://

Centos7.4源码搭建zabbix3.4.11企业级监控

Centos7.4源码搭建zabbix3.4企业级监控目录前言: 一.下载zabbix源码包并解压二.进入zabbix目录源码安装2.1.创建zabbix用户2.2.在mysql创建zabbix数据库并授权2.3.将zabbix的基础SQL包导入zabbix数据库 2.4.源码编译安装zabbix并指定参数 2.5.配置zabiix 2.6.将zabbix的启动脚本cp到/etc/init.d/目录下,并给予写权限 2.7.将zabbix的web发布代码cp到apache的发布目录 2.8.we

centos下lamp源码安装

LAMP指的Linux(操作系统).ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web 服务器. 安装mysql这里我们用的是mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz的绿色软件包 解压mysql绿色软件包 [[email protected] lamp]# tar -zxvf mysql-5.6.15-linux-glibc2.5-x86_64.t

源码搭建LNMP

源码安装LNMP 作者:尹正杰 前言:非常简单的一个平台LNMP,在生产实际环节中我们也经常用到! 二话不说,开始享受我们的搭建过程吧! 一.源码安装nginx 1.安装依赖包 [[email protected] yinzhengjie]# yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-devel libjpeg-devel libpng-deve