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

Lamp源码安装

时间:2015-11-23 19:19:37      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:lamp源码安装

实验环境:

 

系统版本:CentOS6.6x86_64

 

httpd源码包:httpd-2.4.4.tar.bz2

 

apr源码包:apr-1.4.6.tar.bz2

 

apr-util源码包:apr-util-1.4.1.tar.gz

 

mysql源码包:mysql-5.6.27.tar.gz

 

Php 源码包: php-5.6.14.tar.gz

 

实验前提:

 

关闭防火墙和SELinux

 

安装编译环境;

# yum install wget gcc gcc-c++ make cmake ncurses-devellibtool zilib-devel lrzsz libxml2 libxml2-devel pcre-devel openssl-devel -y

 

实验过程:

 

一、安装http2.4服务;

 

apr

 

# tar xf apr-1.4.6.tar.bz2

# cd apr-1.4.6

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

# make && make install

 

apr-util      

 

# tar xf apr-util-1.4.1.tar.gz

# cd apr-util-1.4.1

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

   --with-apr=/usr/local/apr/    :指明apr安装位置;

# make && make install

 

 

 

 

httpd

 

# tar xf httpd-2.4.4.tar.bz2

# cd httpd-2.4.4

#./configure--prefix=/usr/local/apache  --enable-so--enable-ssl --enable-cgi --enable-rewrite --enable-cgid --enable-modules=most--enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/bin

# make && make install

# /usr/local/apache/bin/apachectl start报错

#vim /usr/local/apache/conf/httpd.conf

找到#ServerName www.example.com:80 去掉#号再重新启动

httpd编译参数解释:

#fdisk -l

#fdisk /dev/sdb (n p 1 w)

#mkdir /mydata

#mount /dev/sdb1 /mydata

 #vim/etc/fstab

添加一行

/dev/sdb1               /mydata                 ext4    defaults      0 0

#reboot

#/etc/init.d/iptables stop

mysql5.6.27服务

tar xf mysql-5.6.27.tar.gz

# cd mysql-5.6.27

# useradd -u 306 -s /sbin/nologin mysql

# mkdir -p /mydata/data

# chown -R mysql.mysql /mydata/data/

 

预编译

# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_UNIX_ADDR=/mydata/data/mysql.sock\

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci\

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1\

-DMYSQL_DATADIR=/mydata/data/\

-DMYSQL_USER=mysql \

-DMYSQL_TCP_PORT=3306

 

make && makeinstall

配置 Mysql 服务为系统服务:

# cd /usr/local/mysql/

# cp support-files/my-default.cnf/etc/my.cnf

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

# chmod +x /etc/init.d/mysqld

# chkconfig --add mysqld

# chkconfig mysqld on

#vim /etc/my.cnf

[mysqld]

datadir=/mydata/

socket=/mydata/mysql.sock

user=mysql

# Disabling symbolic-links isrecommended to prevent assorted security risks

symbolic-links=0

 

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/mydata/mysqld.pid

 初始化mysql

#scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/mydata/ --pid-file=/mydata --socket=/mydata/mysql.sock --defaults-file=/mydata/

# /etc/init.d/mysqld restart

 
 

 

 

二、安装PHP服务

# tar xf php-5.6.14.tar.gz

# cd php-5.6.14

#./configure --prefix=/usr/local/php5--with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs--with-mysql=/usr/local/mysql/

# make && make install

 

四、 源码安装 Apache+PHP 整合

整合 apache+php 环境,修改 httpd.conf 配置文件,然后加入如下语句:

# cd/usr/local/apache/conf/

# vim httpd.conf

 

LoadModule php5_modulemodules/libphp5.so (默认已存在)

AddTypeapplication/x-httpd-php .php

DirectoryIndexindex.php index.html ( index.php 加入 index.html 之前)

 

 

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

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

<?php

phpinfo();

?>

Q

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


本文出自 “success” 博客,请务必保留此出处http://maxiaotian.blog.51cto.com/10824115/1716002

Lamp源码安装

标签:lamp源码安装

原文地址:http://maxiaotian.blog.51cto.com/10824115/1716002

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