作者:容易 2013-04-02 9:50:18


 

LAMP环境编译安装

 

第一步 编译安装apache
groupadd -g 80 www
useradd -u 80 -g www -M -s /sbin/nologin www
cd /usr/local/src/
tar -zxvf httpd-2.2.19.tar.gz 
cd httpd-2.2.19
./configure --prefix=/usr/local/httpd --enable-so --enable-modules=so --enable-rewrite --enable-deflate --enable-ssl
make && make install
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd 
在第二行加入以下两行内容
# chkconfig: 2345 10 90 
# description: Activates/Deactivates Apache Web Server 

chkconfig --add httpd
chkconfig --level 35 httpd on

第二步 编译安装mysql
a:安装cmake
cd /usr/local/src/
tar -zxvf cmake-2.8.4.tar.gz 
cd cmake-2.8.4
./configure
make && make install
b:安装mysql
cd /usr/local/src/
tar  -zxvf mysql-5.5.13.tar.gz 
cd mysql-5.5.13
groupadd -g 3306 mysql
useradd -u 3306 -g mysql -M -s /sbin/nologin mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_MYISAM_STORAGE_ENGINE=1  -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql   
 
make && make install
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
chkconfig --add mysql
chkconfig --level 35 mysql on

编译安装php
安装依赖包
rpm -ivh libjpeg-devel-6b-37.i386.rpm libpng-devel-1.2.10-7.1.el5_3.2.i386.rpm  freetype-devel-2.2.1-21.el5_3.i386.rpm 

yum install gd-devel-2.0.33-9.4.el5_4.2.i386.rpm                    (rpm 安装gd-devel.i386 0:2.0.33-9.4.el5_4.2   libXpm-devel.i386 0:3.5.5-3   gd.i386 0:2.0.33-9.4.el5_4.2 )
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
cd /usr/local/src/
tar -zxvf php-5.3.6.tar.gz
cd php-5.3.6
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-curl --with-curlwrappers --with-mhash  --with-gd --enable-gd-native-ttf --with-xsl --with-openssl  --with-xmlrpc --without-pear --enable-zip --enable-soap --enable-mbstring --enable-ftp --enable-sockets --enable-pcntl --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --disable-rpath --enable-mbregex --with-apxs2=/usr/local/httpd/bin/apxs 
make&&make install
cp /usr/local/src/php-5.3.6/php.ini-production /usr/local/php/etc/php.ini
配置
# vi /usr/local/httpd/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> 

vi /usr/local/php/etc/php.ini
找到
;extension_dir = "./" 
替换为
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/" 

3。修改php.ini内的以下指令:
error_reporting = E_ALL | E_STRICT
display_errors = On
mbstring.internal_encoding = UTF-8
date.timezone = Asia/Shanghai

#curl http://pear.php.net/go-pear | /usr/local/php/bin/php
#curl http://pear.php.net/go-pear.phar | /usr/local/php/bin/php


安装php扩展模块
安装pdo-mysql
cd /usr/local/src/
tar -zxvf PDO_MYSQL-1.0.2.tgz 
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
/opt/php/bin/phpize    (centos 5.8)

./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql && make && make install
./configure --with-php-config=/opt/php/bin/php-config --with-pdo-mysql=/opt/mysql   (centos 5.8)
安装ImageMagick
yum install ImageMagick-6.2.8.0-4.el5_1.1.i386.rpm 
yum install ImageMagick-devel-6.2.8.0-4.el5_1.1.i386.rpm
yum install ImageMagick ImageMagick-devel  (centos 5.8)
二、使用phpize添加imagick模块
cd /usr/local/src/
tar  -zxvf imagick-3.0.1.tgz 
cd imagick-3.0.1
/usr/local/php/bin/phpize
/opt/php/bin/phpize    (centos 5.8)
./configure --with-php-config=/usr/local/php/bin/php-config
./configure --with-php-config=/opt/php/bin/php-config  (centos 5.8)
make && make install
安装mcrypt
tar -zxvf libmcrypt-2.5.8.tar.gz 
./configure
make && make install
tar -jxvf mhash-0.9.9.9.tar.bz2 
./configure 
make && make install
tar -zxvf mcrypt-2.6.8.tar.gz 
cd mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/lib ./configure
make && make install
cd /usr/local/src/php-5.3.6/ext/mcrypt/
/usr/local/php/bin/phpize 
./configure --with-php-config=/usr/local/php/bin/php-config

/opt/php/bin/phpize 
./configure --with-php-config=/opt/php/bin/php-config  (centos 5.8)
make && make install

vi php.ini
extension=pdo_mysql.so
extension=imagick.so
extension=mcrypt.so

创建数据库和配置连接用户
mysqladmin -u root  password "xxxxxxx"  
drop database test;
create database test;
grant all privileges on test.* to 'tiger123'@'localhost' identified by '122333';
flush privileges;

CustomLog "|/usr/local/httpd/bin/rotatelogs /app/apache_logs/chinapnr/%Y_%m_%d_access_log 86400 480" common 日志分割

 

One Response


    还没有评论!
1  

Leave your comment

请留下您的姓名(*)

请输入正确的邮箱地址(*)

请输入你的评论(*)


感谢开源 © 2016. All rights reserved.&3Q Open Source&^_^赣ICP备15012863号-1^_^
乐于分享共同进步 KreativeThemes