您的位置:首页 > 运维架构 > Apache

源码编译安装lamp(linux+apache+mysql+php)

2012-11-02 17:44 1081 查看
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/
make
make install
cd ..

tar zxvf freetype-2.4.10.tar.gz
cd freetype-2.4.10
./configure --prefix=/usr/
make
make install
cd ..

tar jxvf libxml2-2.6.30.tar.bz2
cd libxml2-2.6.30
./configure --prefix=/usr/
make
make install

tar jxvf httpd-2.2.23.tar.bz2
cd httpd-2.2.23/srclib/apr
./configure --prefix=/usr/local/apr
make ; make install
cd ../apr-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make ; make install
cd ../../
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-so
make
make install

groupadd mysql
useradd -g mysql mysql

tar zxvf mysql-5.1.65.tar.gz
cd mysql-5.1.65
./configure --prefix=/usr/local/mysql/ --enable-assembler \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--with-big-tables \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase,myisammrg
make
make install

cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
mkdir /usr/local/mysql/data
chown -R mysql.mysql /usr/local/mysql/data/
vim /usr/local/mysql/my.cnf
在[mysql]标签下添加如下两行:
basedir=/usr/local/mysql --定义mysql的目录位置
datadir=/usr/local/mysql/data --定义mysql数据目录的位置

/usr/local/mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --user=mysql --初始化mysql 数据库
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=mysql & --开启mysql服务

tar zxvf php-5.4.7.tar.gz
cd php-5.4.7
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-libxml-dir --with-gd --with-png-dir --with-jpeg-dir --with-freetype-dir=/usr --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
make
make install

【apache结合php】

Apache主配置文件为:/usr/local/apache/conf/httpd.conf
# vim /usr/local/apache/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php

找到:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
将该行改为
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>

本文出自 “Jtao'Blog” 博客,请务必保留此出处http://hyjtao.blog.51cto.com/2385891/1048484
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: