1. 安装Apache
- #!/bin/bash
- groupadd htdocs
- useradd -g htdocs htdocs
- tar zxvf httpd-2.2.14.tar.gz
- cd httpd-2.2.14
- ./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=all --enable-rewrite --enable-so
- make && make install
- cd ..
2. 安装MySQL
- #!/bin/bash
- groupadd mysql
- useradd -g mysql mysql
- tar zxvf mysql-5.1.45.tar.gz
- cd mysql-5.1.45
- ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --enable-assembler --enable-profiling --enable-local-infile --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=complex --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-big-tables --with-plugins=partition,federated,innobase
- make && make install
- cd ..
- /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
- chgrp -R mysql /usr/local/mysql
- chown -R mysql /usr/local/mysql/data
- echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf.d/mysql.conf
- ldconfig -v
- mkdir /usr/local/mysql/etc
- /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf --datadir=/usr/local/mysql/data --user=mysql &
- # /usr/local/mysql/bin/mysqladmin shutdown
- export PATH=$PATH:/usr/local/mysql/bin
- echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
3. 安装Oracle
- #!/bin/bash
- if [ `getconf LONG_BIT` == 64 ]; then
- rpm -Uvh x86_64/oracle-instantclient-basic-10.2.0.4-1.i386.rpm
- rpm -Uvh x86_64/oracle-instantclient-devel-10.2.0.4-1.i386.rpm
- rpm -Uvh x86_64/oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
- ln -s /usr/include/oracle/10.2.0.4/client64 /usr/lib/oracle/10.2.0.4/client64/include
- else
- rpm -Uvh i386/oracle-instantclient-basic-10.2.0.4-1.i386.rpm
- rpm -Uvh i386/oracle-instantclient-devel-10.2.0.4-1.i386.rpm
- rpm -Uvh i386/oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
- ln -s /usr/include/oracle/10.2.0.4/client /usr/lib/oracle/10.2.0.4/client/include
- fi
- mkdir -p /usr/lib/oracle/10.2.0.4/network/admin
- touch /usr/lib/oracle/10.2.0.4/network/admin/tnsnames.ora
4. 安装PHP
- #!/bin/bash
- # yum -y install curl curl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel zlib zlib-devel freetype freetype-devel openldap openldap-devel xmlrpc
- if [ `getconf LONG_BIT` == 64 ]; then
- yum -y install curl.i386 curl-devel.i386 libxml2.i386 libxml2-devel.i386 libjpeg.i386 libjpeg-devel.i386 libpng.i386 libpng-devel.i386 zlib.i386 zlib-devel.i386 freetype.i386 freetype-devel.i386 openldap.i386 openldap-devel.i386 xmlrpc.i386
- yum -y install curl.x86_64 curl-devel.x86_64 libxml2.x86_64 libxml2-devel.x86_64 libjpeg.x86_64 libjpeg-devel.x86_64 libpng.x86_64 libpng-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 openldap.x86_64 openldap-devel.x86_64 xmlrpc.x86_64
- else
- yum -y install curl.x86_64 curl-devel.x86_64 libxml2.x86_64 libxml2-devel.x86_64 libjpeg.x86_64 libjpeg-devel.x86_64 libpng.x86_64 libpng-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 openldap.x86_64 openldap-devel.x86_64 xmlrpc.x86_64
- fi
- tar zxvf gd-2.0.33.tar.gz
- cd gd-2.0.33
- ./configure --prefix=/usr
- make && make install
- cd ..
- tar zxvf libmcrypt-2.5.8.tar.gz
- cd libmcrypt-2.5.8
- ./configure --prefix=/usr
- make && make install
- cd libltdl/
- ./configure --prefix=/usr --enable-ltdl-install
- make && make install
- cd ../..
- tar zxvf mhash-0.9.9.9.tar.gz
- cd mhash-0.9.9.9
- ./configure --prefix=/usr
- make && make install
- cd ..
- tar zxvf freetds-0.64.tar.gz
- cd freetds-0.64
- ./configure --prefix=/usr/local/freetds --enable-msdblib --with-gnu-ld --with-tdsver=8.0
- make && make install
- cd ..
- echo "/usr/local/freetds/lib" >> /etc/ld.so.conf.d/freetds.conf
- ldconfig -v
- tar zxvf php-5.2.6.tar.gz
- cd php-5.2.6
- if [ `getconf LONG_BIT` == 64 ]; then
- ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --enable-bcmath --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --with-ldap --enable-mbstring --with-mcrypt --with-mhash --with-mssql=/usr/local/freetds --with-mysql=/usr/local/mysql --enable-pcntl --with-pdo-mysql=/usr/local/mysql --with-pdo-oci=/usr/lib/oracle/10.2.0.4/client64 --enable-soap --enable-sockets --with-xmlrpc
- else
- ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --enable-bcmath --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --with-ldap --enable-mbstring --with-mcrypt --with-mhash --with-mssql=/usr/local/freetds --with-mysql=/usr/local/mysql --enable-pcntl --with-pdo-mysql=/usr/local/mysql --with-pdo-oci=/usr/lib/oracle/10.2.0.4/client --enable-soap --enable-sockets --with-xmlrpc
- fi
- make && make install
- cd ..
由于文章的篇幅管理,这里就不列举相关配置信息了,关于httpd.conf、my.cnf以及php.ini文件的配置,��供了下载地址:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2012年资料/5月/4日/Linux下搭建LAMP环境/