Linux 搭建LAMP 源码编译详细文档
来源:互联网 发布:网络运营商有哪些 编辑:程序博客网 时间:2024/05/01 23:43
lamp安装顺序 mysql->apache->php 因为php编译时要指定mysql和apache的路径,apache和mysql的安装顺序可以互换
php在lamp中是作为apache的一个模块来调用的,并不会产生进程,要和lnmp里的php-fpm进程区分开来
再安装之前确保机器没装过mysql,httpd,php等,可以用rpm -qa | grep mysql 这样的形式去查找是否安装rpm包,还有netstat -lnp 和ps aux 等命令可以查看进程
安装流程:
1)mysql
下载mysql:
cd /usr/local/src ;
wget mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
tar -zxvf mysql-5.1.73-linux-x86_64-glibc23.tar.gz ##解压
cp -r mysql-5.1.73-linux-x86_64-glibc23 /usr/local/mysql ##移动到 /usr/local/mysql
useradd -s /sbin/nologin mysql #创建用户
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf ##拷贝配置文件
chown -R mysql:mysql /data/mysql
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql ##初始化mysql
vi /etc/init.d/mysqld ; 并修改basedir和datadir
chkconfig --add mysqld ; chkconfig mysqld on ; service mysqld start ##开机启动
2)apache
cd /usr/local/src ; wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.bz2
cd httpd-2.2.31
./configure --prefix=/usr/local/apache2--with-included-apr --with-pcre --enable-mods-shared=mostmake && make install
error: mod_deflate has been requested but can not be built due to prerequisite failures
解决办法是:
yum install -y zlib-devel
为了避免在make的时候出现错误,所以最好是提前先安装好一些库文件:
yum install -y pcre pcre-devel apr apr-devel
3) apache
cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.3.28.tar.gz
tar zxf php-5.3.28.tar.gz
cd php-5.3.28
./configure \--prefix=/usr/local/php \--with-apxs2=/usr/local/apache2/bin/apxs \--with-config-file-path=/usr/local/php/etc \--with-mysql=/usr/local/mysql \--with-libxml-dir \--with-gd \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--with-iconv-dir \--with-zlib-dir \--with-bz2 \--with-openssl \--with-mcrypt \--enable-soap \--enable-gd-native-ttf \--enable-mbstring \--enable-sockets \--enable-exif \--disable-ipv6这一步可能会遇到各种各样报错
建议先安装一些依赖包:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决办法是:
yum install -y libxml2-devel
还有错误:
configure: error: Cannot find OpenSSL's <evp.h>
解决办法是:
yum install -y openssl openssl-devel
错误:
checking for BZip2 in default path... not foundconfigure: error: Please reinstall the BZip2 distribution
解决办法:
yum install -y bzip2 bzip2-devel
错误:
configure: error: png.h not found.
解决办法:
yum install -y libpng libpng-devel
错误:
configure: error: freetype.h not found.
解决办法:
yum install -y freetype freetype-devel
错误:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:
rpm -ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"yum install -y libmcrypt-devel
make && make install
到这一步为止,lamp就算安装完成了
4)apache+php
安装完之后还不行,apache不会自动识别php,接下来要修改一些配置,使apache和php合体
vi /usr/local/apache2/conf/httpd.conf ; 修改以下2个地方
1.找到
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
添加一行:
AddType application/x-httpd-php .php
2.找到
<IfModule dir_module> DirectoryIndex index.html</IfModule>改为
<IfModule dir_module> DirectoryIndex index.html index.php index.htm</IfModule>
3.找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd not running, trying to start
还有几个地方需要说明lamp中php不用启动进程
apache的启动方法是:/usr/local/apache2/bin/apachectl start
apache配置语法检测:/usr/local/apache2/bin/apachectl -t
apache模块查看:/usr/localapache2/bin/apchectl -M
- Linux 搭建LAMP 源码编译详细文档
- Linux下最新版LAMP环境(源码版)搭建详细解读
- linux 源码包搭建lamp
- archlinux 源码编译搭建 LAMP web服务器
- linux源码搭建lamp环境 + 源码包
- CentOS下LAMP环境搭建之一源码编译安装apache
- lamp 环境搭建(非源码编译安装)
- centos6.5下lamp环境的搭建(源码编译安装)
- liunx lamp搭建编译
- 源码搭建LAMP
- 源码搭建lamp环境
- LAMP源码包搭建
- 源码搭建lamp环境
- lamp源码编译
- 源码编译安装LAMP
- 源码编译LAMP
- Linux环境配置之LAMP搭建(源码安装)
- LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP
- Event-Driven Data Management for Microservices
- Hibernate高级技术
- 【可持久化线段树】【主席树】[HDU4417]Super Mario
- Codeforces Round #340 (Div. 2) A B C D
- angularjs 复制
- Linux 搭建LAMP 源码编译详细文档
- 空间滤波&频域滤波(2)
- 代码:用二分法求2x^3-4x^2+3x-6=0在-10~10之间的根(函数)
- 我是如何入门html和php的
- STM32 堆和栈的学习
- 读书笔记 精通CSS 高级Web标准解决方案(第2版)1~3章
- android listview优化:滑动时颜色错乱问题
- 2014年第五届蓝桥杯C/C++程序设计本科B组省赛 李白打酒(结果填空)
- Swift 航歌-做最好的开发者知识平台