LAMP环境部署

LAMP环境部署

 

安装依赖包

#yum install gcc gcc-c++  autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel gd gd-devel  bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel  openssl  openssl-devel libtool libtool-devel libtool-ltdl-devel

 

安装php所需的支持库:

#tar -zxf libiconv-1.14.tar.gz     //对文本进行编码转换的支持库
#cd libiconv-1.14
#./configure --prefix=/usr/local/
#make && make install


#tar -jxf mhash-0.9.9.9.tar.bz2     //哈希函数包
#cd mhash-0.9.9.9
#./configure 
# make && make instal
#ln -s /usr/local/lib/libmhash.* /usr/lib64/


#tar -zxf libmcrypt-2.5.7.tar.gz        //函数加密支持库
#cd libmcrypt-2.5.7
#./configure 
# make && make install

# cd libltdl

# ./configure --enable-ltdl-install

#make && make install

#tar -zxf mcrypt-2.6.8.tar.gz     //加密函数包
#cd mcrypt-2.6.8
#./configure   //会报错configure: error: *** libmcrypt was not found
#export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH

或则# vim /etc/ld.so.conf

添加

   /usr/local/lib

#./configure 
#make && make install



#tar -zxf apr-1.5.1.tar.gz      //apache服务器的依赖包之一
# ./configure --prefix=/usr/local/
# make && make install

# tar -zxf apr-util-1.5.4.tar.gz  
# ./configure --prefix=/usr/local/ --with-apr=/usr/local/
# make && make install

# tar -zxf pcre-8.12.tar.gz            //兼容正则表达式
# ./configure --prefix=/usr/local/
#make

#make install

 

安装mysql

#yum install bison

#tar -zxf cmake-2.8.4.tar.gz

#./configure

#gmake

#make install

 

 

 

#tar -zxf mysql-5.5.14.tar.gz

#cmake ./

#make

#make install

 

# cp /usr/local/src/mysql-5.5.14/support-files/my-medium.cnf/etc/my.cnf

# cp /usr/local/src/mysql-5.5.14/support-files/mysql.server/etc/init.d/mysqld

# chmod 770 /etc/init.d/mysqld 

 

 

#chmod +w /usr/local/mysql

# useradd -s /sbin/nologin mysql

 

#chown -R mysql:mysql /usr/local/mysql

#mkdir -p /data/mysql/data/

#chown -R mysql:mysql /data/mysql/

 

#vim /etc/my.cnf 

加入以下内容

user = mysql

basedir = /usr/local/mysql

datadir = /data/mysql/data

log-error = /data/mysql/mysql_error.log

pid-file = /data/mysql/mysql.pid

 

# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/data/

#ln -s /usr/local/mysql/bin/mysql /bin/

#/etc/init.d/mysqld start

#/usr/local/mysql/bin/mysqladmin -u root password 123456

 

# useradd www -s /sbin/nologin

#tar -zxvf httpd-2.2.31.tar.bz2

#./configure --prefix=/usr/local/apache --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cahe --enable-mem-cache --enable-disk-cache --enable-static-support --enable-ssl --enable-so

***--enable-ssl 一定要加上

#make && make install

#ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd

# /etc/init.d/httpd start

 

 

安装apache

# tar zxf httpd-2.2.31.tar.gz

# ./configure --prefix=/usr/local/apache --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cahe --enable-mem-cache --enable-disk-cache --enable-static-support --enable-ssl --enable-so

# make && make install

# ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd

# /etc/init.d/httpd start



安装PHP

 

# tar -jxvf php-5.4.6.tar.gz2

#./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc  --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql/  --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-gd --with-freetype-dir  --with-jpeg-dir --with-png-dir --with-libxml-dir --with-iconv=/usr/local/ --with-zlib --with-bz2 --with-mcrypt --with-mhash --with-openssl --with-curl --with-curlwrappers --with-pear --enable-mbstring --enable-gd-native-ttf --enable-zip --enable-ftp --enable-sockets --enable-calendar --enable-bcmath --enable-exif --enable-shmop --enable-sockets

 

# make && make install

# cp php.ini-development /usr/local/php/etc/php.ini

查看是否生成PHP模块

# ls /usr/local/apache/modules/ |grep php

libphp5.so

 

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

找到AddType模块处添加

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

AddType application/x-httpd-php .php .phtml

在index.html前添加index.php

 

 

更改用户

www

更改主目录路径

/data/www/htdocs

更改日志路径

/data/www/logs/access_log

/data/www/logs/error_log

 

 

# mkdir -pv /data/www/htdocs

# mkdir -pv /data/www/logs

# chown www:www /data/www/ -R

# /etc/init.d/httpd -k restart

 

 

测试

http://IP/index.php 

Php测试页:

# vim index.php

<?php

phpinfo()

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值