LAMP全新安装 Linux+Apache+MySQL+PHP+phpMyadmin+Zend
从上次发表的一篇在Windows下安装Discuz论坛的文章到现在差不多快一个月了,一直想把在Linux下安装的过程也写出来,毕竟Linux下运行PHP性能要比Windows好.其实安装编译软件不是很麻烦,难的是要将各个组件组合起来.在安装过程中遇到了很多困难,也尝试了不少的方法,最终成就这篇文章.文中软件下载后存放的位置如果没有特殊说明,都存入在/tmp下.以下是安装的过程:一:安装Apache(http://archive.apache.org/dist/httpd/binaries/)
a:先检查系统中是否安装有旧版本的相关软件
# rpm -qa |grep mysql
# rpm -qa |grep httpd
# rpm -qa |grep php
b:解压并安装Apache
# cd /tmp
# tar zxvf httpd-2.2.4.tar.gz
# ./configure --prefix=/usr/local/httpd \
--enable-isapi --enable-file-cache \
--enable-echo --disable-charset-lite \
--enable-charset-lite --enable-cache --enable-disk-cache --enable-mem-cache\
--enable-example --enable-case-filter --enable-case-filter-in--enable-dumpio \
--enable-ext-filter --enable-deflate --enable-log-forensic \
--enable-logio --enable-mime-magic --enable-headers --enable-proxy--enable-proxy-connect \
--enable-proxy-ftp --enable-proxy-http --enable-ssl--enable-optional-hook-export \
--enable-optional-hook-import --enable-optional-fn-import --enable-http--enable-cgi \
--enable-cgid --enable-speling --enable-rewrite --enable-so--with-suexec-uidmin \
--with-suexec-gidmin --with-suexec-logfile --with-suexec-safepath--enable-static-htpasswd \
--enable-static-htdigest --enable-static-rotatelogs--enable-static-logresolve
# make
# make install
http://www.ylmf.net/uploads/allimg/101126/1042131939-0.jpg
http://www.ylmf.net/uploads/allimg/101126/1042131639-1.jpg
http://www.ylmf.net/uploads/allimg/101126/10421311a-2.jpg
二:安装MySQL(http://downloads.mysql.com/archives.php?p=mysql-4.1)
# tar zxvf mysql-5.0.41-linux-i686.tar.gz
# mv mysql-5.0.41-linux-i686 /usr/local/mysql
# pwd
/usr/local/mysql
# groupadd mysql
# useradd mysql -g mysql
# chown -R root .
# chown -R mysql data
# chown -R mysql data/mysql/.
# chgrp -R mysql .
# cp ./support-files/my-medium.cnf /etc/my.cnf
# ./scripts/mysql_install_db --user=mysql
# bin/mysqld_safe --user=mysql &
# /usr/local/mysql/bin/mysqlshow -p
三:安装GD库(http://www.boutell.com/gd/)
a:解压并安装libpng(http://www.libpng.org/pub/png/libpng.html )
# ./configure --prefix=/usr/local/png
# make
# make install
b:解压并安装jpeg(ftp://ftp.uu.net/graphics/jpeg/ )
# mkdir /usr/local/jpeg
# mkdir /usr/local/jpeg/bin
# mkdir /usr/local/jpeg/lib
# mkdir /usr/local/jpeg/include
# mkdir /usr/local/jpeg/man
# mkdir /usr/local/jpeg/man/man1
# ./configure --prefix=/usr/local/jpeg --enable-shared--enable-static
# make
# make install
c:解压并安装freetype (http://www.fretype.org)
# ./configure --prefix=/usr/local/freetype2
# make
# make install
d:解压并安装fontconfig (http://www.fontconfig.org)
# ./configure --prefix=/usr/local/fontconfig\
--with-freetype-config=/usr/local/freetype2/bin/freetype-config
# make
# make install
e:安装xmkmf工具
在安装xpm时,会提示有找不到xmkmf这个命令.这时需要安装xorg-devel包,在系统盘的第三张光盘上找到并安装它.
# rpm -ivh freetype-devel-2.1.9-1.i386.rpm
# rpm -ivh fontconfig-devel-2.2.3-7.i386.rpm
# rpm -ivh /tmp/xorg-x11-devel-6.8.1-23.EL.i386.rpm
http://www.ylmf.net/uploads/allimg/101126/1042131563-3.jpg
f:解压并安装xpm (http://koala.ilog.fr/ftp/pub/xpm/)
# xmkmf -a
# make
# make install
g:解压并安装GD
# tar zxvf gd-2.0.34.tar.gz
# ./configure --prefix=/usr/local/gd--with-png=/usr/local/png/ \
--with-jpeg=/usr/local/jpeg/ --with-freetyp=/usr/local/freetype2/ \
--with-fontconfig =/usr/local/fontconfig/--with-xpm
# cp /usr/local/png/include/png.h ./
# cp /usr/local/png/include/pngconf.h ./
# make
# make install
http://www.ylmf.net/uploads/allimg/101126/10421313H-4.jpg 四:解压并安装php(http://www.php.net )
# tar zxvf php-5.2.3.tar.gz
# ./configure --prefix=/usr/local/php \
--with-mysql=/usr/local/mysql --with-apxs2=/usr/local/httpd/bin/apxs \
--with-libxml-dir=/usr/include/libxml2/libxml --with-gd=/usr/local/gd/\
--with-png=/usr/local/png/ --with-jpeg=/usr/local/jpeg/ --with-xpm \
--with-zlib --enable-debug --enable-magic-quotes --enable-libgcc \
--enable-ftp --enable-mbstring --enable-sockets --with-gnu-ld
# make
# make install
# cp php.ini-recommended/usr/local/php/etc/php.ini
http://www.ylmf.net/uploads/allimg/101126/1042133107-5.jpg 五:设置http.conf来支持PHP
# vi /usr/local/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.html.var index.htm index.php
六:解压并设置phpmyadmin
# tar zxvf phpMyAdmin-2.11.2-all-languages.tar.gz
# mv phpMyAdmin-2.11.2-all-languages/usr/local/httpd/htdocs/phpmyadmin
# cd /usr/local/httpd/htdocs/phpmyadmin
# cp ./libraries/config.default.php./config.inc.php
vi config.inc.php
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin';
$cfg['Servers'][$i]['auth_type'] = 'http';
七:建立php测试文件,启动apache
#vi /usrc/local/httpd/htdocs/phpinfo.php
----------------------------
----------------------------
# /usr/local/httpd/bin/apachectl start
此时,在浏览器中输入:http://ip/phpinfo.php,会出现以下画面,图中显示GD库已正确安装
http://www.ylmf.net/uploads/allimg/101126/1042133Y6-6.jpg 再测试phpmyadmin,同样在浏览器中输入:http://ip/phpmyadmin
页:
[1]