CenOS下LAMP搭建过程
CentOS虚拟机中安装LAMP: Linux+Apache+MySQL+PHP
安装前先关闭防火墙和Selinux
把所有安装包解压到/lamp下(根目录下的lamp目录)
安装gcc, gcc-c++
libtool, libtool-ltdl, libtool-ltdl-devel
依次安装如下
可以通过脚本安装
sh -x lamp.sh
注意:不知道为啥出现下面这种情况。。。
新建一个脚本文件就能执行了......
#lamp.sh
1 cd /lamp/libxml2-2.6.30 2 ./configure --prefix=/usr/local/libxml2/ 3 make 4 make install 5 6 cd /lamp/libmcrypt-2.5.8 7 ./configure --prefix=/usr/local/libmcrypt/ 8 make 9 make install 10 11 cd /lamp/libmcrypt-2.5.8/libltdl 12 ./configure --enable-ltdl-install 13 make 14 make install 15 16 cd /lamp/zlib-1.2.3 17 ./configure 18 make 19 make install 20 21 cd /lamp/libpng-1.2.31 22 ./configure --prefix=/usr/local/libpng/ 23 make 24 make install 25 26 mkdir /usr/local/jpeg6 27 mkdir /usr/local/jpeg6/bin 28 mkdir /usr/local/jpeg6/lib 29 mkdir /usr/local/jpeg6/include 30 mkdir -p /usr/local/jpeg6/man/man1 31 cd /lamp/jpeg-6b 32 ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static 33 make 34 make install 35 36 cd /lamp/freetype-2.3.5 37 ./configure --prefix=/usr/local/freetype/ 38 make 39 make install 40 41 cd /lamp/autoconf-2.61 42 ./configure 43 make 44 make install 45 46 cd /lamp/gd-2.0.35 47 ./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/ 48 make 49 make install 50 51 cd /lamp/httpd-2.2.9 52 ./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 53 make 54 make install 55 56 /usr/local/apache2/bin/apachectl start 57 echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit 58 59 cd /lamp/ncurses-5.6 60 ./configure --with-shared --without-debug --without-ada --enable-overwrite 61 make 62 make install #此步会报错,下载新版本如5.9,重新编译安装 63 64 groupadd mysql 65 useradd -g mysql mysql 66 cd /lamp/mysql-5.0.41 67 ./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all 68 make 69 make install 70 71 cp support-files/my-medium.cnf /etc/my.cnf 72 /usr/local/mysql/bin/mysql_install_db --user=mysql 73 chown -R root /usr/local/mysql 74 chown -R mysql /usr/local/mysql/var 75 chgrp -R mysql /usr/local/mysql 76 77 /usr/local/mysql/bin/mysqld_safe --user=mysql & 78 79 cp /lamp/mysql-5.0.41/support-files/mysql.server /etc/rc.d/init.d/mysqld 80 chown root.root /etc/rc.d/init.d/mysqld 81 chmod 755 /etc/rc.d/init.d/mysqld 82 chkconfig --add mysqld 83 chkconfig --list mysqld 84 chkconfig --levels 245 mysqld off 85 86 cd /lamp/php-5.2.6 #报错 解决办法:yum install libtool libtool-ltdl libtool-ltdl-devel 87 ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets 88 make 89 make install 90 91 cp php.ini-dist /usr/local/php/etc/php.ini 92 echo "Addtype application/x-httpd-php .php .phtml" >> /etc/httpd/httpd.conf 93 /usr/local/apache2/bin/apachectl restart
KEEP LEARNING!