[高]
一.LAMP安装所需要的源代码包列表
libxml http://www.xmlsoft.org/downloads.html
libmcrypt http://sourceforge.net/projects/mcrypt/files/Libmcrypt/
zlib http://www.zlib.net/
gd http://libgd.bitbucket.org/
autoconf http://www.gnu.org/software/autoconf/#downloading
freetype http://www.freetype.org/download.html
libpng http://www.libpng.org/pub/png/libpng.html
jpeg http://www.ijg.org/
httpd http://www.apache.org
mysql http://dev.mysql.com/downloads/
php http://www.php.net/download.php
zendOptimizer
phpmyadmin http://www.phpmyadmin.com
二.卸载默认的低版本环境
rpm -qa | grep -i httpd //查询系统中已安装的Apache相关软件包
service httpd stop //如果已开启,停止运行服务
rpm -e httpd-manual-2.0.40-21 --nodeps //卸载
rpm -e httpd-2.0.40-21 --nodeps
rpm -e .... --nodeps
同步的道理删除mysql和php其中php没有服务好停止的,如果有安装直接删除即可
三.安装扩展
1.libxml2
./configure --prefix=/usr/local/libxml2
make && make install
2.libmcrypt
1).
./configure --prefix=/usr/local/libmcrypt
make && make install
2).安装完成libmcrypt库以后,不同的Linux系统版本中可能还要安装一下libltdl库
cd libmcrypt/libltdl
./configure --enable-ltdl-install
make && make install
3.zlib
./configure --prefix=/usr/local/zlib
make && make install
4.libpng
./configure --prefix=/usr/local/libpng
make && make install
5.jpeg
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd jpegsrc中
./configure --prefix=/usr/local/jpeg6 \
--enable-shared \ //建立共享库使用的GNU的libtool
--enable-static //建立静态库使用的GNU的libtool
make && make install
6. freetype
./configure --prefix=/usr/local/freetype
make && make install
7.autoconf
./configure
make && make install
8.gd库安装
① 链接头文件[可选操作]
ls –s /usr/local/libpng/include/pngconf.h /usr/inclu
ls –s /usr/local/libpng/include/png.h /usr/include
./configure --prefix=/usr/local/gd2 \
--with-zlib=/usr/local/zlib/ \ // 指定zlib库文件的位置
--with-jpeg=/usr/local/jpeg6/ \ //指定jpeg6库文件的位置
--with-png=/usr/local/libpng/ \ //指定png库文件的位置
--with-freetype=/usr/local/freetype/ //指定freetype字体库的位置
make && make install
四.安装LAMP
1.Apache
1).安装
./configure --prefix=/usr/local/apache2 \
--sysconfdir=/etc/httpd \指定apache服务器的配置文件存放位置,默认在安装路径的conf文件中,此项可选
--with-z=/usr/local/zlib/ \ zlib库文件位置
--with-included-apr \ 使用捆绑apr/apr-util的副本
--disable-userdir \ 请求的映象到用户特定目录
--enable-so \ 以动态共享对象(DSO)编译
--enable-deflate=shared \ 缩小传输编码的支持
--enable-expires=shared \ 期满头控制
--enable-rewrite=shared \ 基于规则的URL操控
--enable-static-support 建立一个静态链接版本的支持
make && make install
###################################
./configure --prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf
--enable-so --enable-ssl --with-ssl=/usr/local/ssl
--enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib
--enable-mods-shared=most
--with-included-apr --with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
###################################
2).检查
/etc/httpd中有没有httpd.conf和extra子目录
3).启动
/usr/local/apache2/bin/apachectl start //启动apache
netstat -tnl | grep 80
4).浏览
打开浏览器输入 http://localhost 如出现 it work 表示apache服务器可以使用
5).制作成开机时自启动
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local //完成了开机自启动
2.Mysql
1).为msyqld增加一个登陆用户和组
groupadd mysql
useradd -g mysql mysql
2).安装
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=all \ 在安装mysql时安装所有的字符集
make && make install
3).配置
cp support-files/my-medium.cnf /etc/my.cnf
#准备 mysql 配置文件
Vi /etc/my.cnf
[client]#修改客户端和连接字符集
default-character-set=utf8
[mysqld]
#修改服务器和数据库字符
character-set-server=utf8
# 修改服务器校验字符集 collation-server=utf8
4).创建mysql授权表
/usr/local/mysql/bin/mysql_install_db --user=mysql //创始授权表
5).权限的更改
chown -R root . //将文件的所有属性改为root用户
chown -R mysql var //将数据目录所用属性改为mysql用户
chgrp -R mysql . //将组属性改为mysql组
ls -l
6).启动
/usr/local/mysql/bin/mysqld_safe --user=mysql &
netstat -tul | grep 3306
7).使用mysqladmin验证服务器在运行中
/usr/local/mysql/bin/mysqladmin version
8).设置mysql密码
/usr/local/mysql/bin/mysql -uroot -p
进入后
删除匿名账户存在
delete from mysql.user where host='localhost' and user='';
flush privileges;
设置新密码
set password for 'root'@'localhost'=password('123456');
9).关闭mysql服务
/usr/local/mysql/bin/mysqladmin -u root -p shutdown //关闭数据库
10).开机自启动
在mysql源文件中
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
修改文件/etc/rc.d/init.d/mysqld权限
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig -add mysqld
chkconfig --level 3 msyqld on
chkconfig --level 5 msyqld on
chkconfig --list mysqld
3.PHP
1). ./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \ 指定PHP配置文件的路径
--with-apxs2=/usr/local/apache2/bin/apxs \ PHP查找apache2的地方
--with-mysql=/usr/local/mysql/ \ Mysql安装目录
--with-libxml-dir=/usr/local/libxml2/ \ libxml2位置
--with-png-dir=/usr/local/libpng/ \
--with-jpeg-dir=/usr/local/jpeg6/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd=/usr/local/gd2/ \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config \ 激活新增加的Mysqli功能
--enable-soap \ 激活SOAPT Web services支持
--enable-mbstring=all \ 使多字节字符串支持
--enable-sockets \ 变量激活socket通信特性
--with-openssl \
--with-curl
make && make install
2).配置
在源码包中
cp php.ini-dist /usr/local/php/etc/php.ini
3).整合
vi /etc/httpd/httpd.conf
#添加这一条
Addtype application/x-httpd-php .php .phtml
修改为成后
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
安装完毕
-----------------------------------------------------------------------------------------------------
[李]
cd /lamp/libxml2-2.6.30
./configure --prefix=/usr/local/libxml2/
make
make install
cd /lamp/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/
make
make install
cd /lamp/libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install
cd /lamp/zlib-1.2.3
./configure
make
make install
cd /lamp/libpng-1.2.31
./configure --prefix=/usr/local/libpng/
make
make install
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd /lamp/jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
cd /lamp/freetype-2.3.5
./configure --prefix=/usr/local/freetype/
make
make install
cd /lamp/autoconf-2.61
./configure
make
make install
cd /lamp/gd-2.0.35
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
make install
cd /lamp/httpd-2.2.9
./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
make
make install
###################################
./configure --prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf
--enable-so --enable-ssl --with-ssl=/usr/local/ssl
--enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib
--enable-mods-shared=most
--with-included-apr --with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
###################################
/usr/local/apache2/bin/apachectl start
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit
cd /lamp/ncurses-5.6
./configure --with-shared --without-debug --without-ada --enable-overwrite
make
make install
groupadd mysql
useradd -g mysql mysql
cd /lamp/mysql-5.0.41
./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &
cp /lamp/mysql-5.0.41/support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
chkconfig --levels 245 mysqld off