LAMP 环境配置 ......

 1.升级所需的程序库

sudo -s
LANG=C
yum -y 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 bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool libtool-ltdl-devel

2. 编译安装PHP 5.2.14所需的支持库

tar zxvf perl-5.14.2.tar.gz

cd perl-5.14.2

sh Configure -de

make

make install

cd ..

 

 

tar zxvf libiconv-1.9.2.tar.gz
cd libiconv-1.9.2 /
./configure --prefix=/usr/local
make
make install
cd ../

tar zxvf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

ln -s /usr/local/lib/libiconv.so.2 /lib/libiconv.so.2 


tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

 

tar zxvf curl-7.21.6.tar.gz

cd curl-7.21.6/

./configure --prefix=/usr/local

make

make install

cd ..

 

3. 编译安装Mysql-5.1.47

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql

 

autoreconf --force –install

libtoolize --automake --force
automake --force --add-missing

 

mkdir -p /opt/local/mysql/data

tar zxvf mysql-5.1.47.tar.gz

cd mysql-5.1.47/

./configure --prefix=/opt/local/mysql --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-unix-socket-path=/tmp/mysql.sock --enable-assembler --with-charset=utf8 --with-collation=utf8_general_ci --with-plugins=innobase --without-debug

Make

Make install

cp support-files/my-medium.cnf /opt/local/mysql/my.cnf

chmod +w /opt/local/mysql

chown -R mysql:mysql /opt/local/mysql

 

vi /opt/local/mysql/my.cnf

skip-locking 改为skip-external-locking

4. mysql用户帐号的身份建立数据表

/opt/local/mysql/bin/mysql_install_db --defaults-file=/opt/local/mysql/my.cnf --basedir=/opt/local/mysql --datadir=/opt/local/mysql/data --user=mysql

 

 

 

创建管理MySQL数据库的shell脚本

vi /opt/local/mysql/mysql

###########################################################

#!/bin/sh

 

mysql_port=3306

mysql_username="admin"

mysql_password="12345678"

 

function_start_mysql()

{

    printf "Starting MySQL...\n"

    /bin/sh /opt/local/mysql/bin/mysqld_safe --defaults-file=/opt/local/mysql/my.cnf 2>&1 > /dev/null &

}

 

function_stop_mysql()

{

    printf "Stoping MySQL...\n"

    /opt/local/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown

}

 

function_restart_mysql()

{

    printf "Restarting MySQL...\n"

    function_stop_mysql

    sleep 5

    function_start_mysql

}

 

function_kill_mysql()

{

    kill -9 $(ps -ef ; grep 'bin/mysqld_safe' ; grep ${mysql_port} ; awk '{printf $2}')

    kill -9 $(ps -ef ; grep 'libexec/mysqld' ; grep ${mysql_port} ; awk '{printf $2}')

}

 

if [ "$1" = "start" ]; then

    function_start_mysql

elif [ "$1" = "stop" ]; then

    function_stop_mysql

elif [ "$1" = "restart" ]; then

function_restart_mysql

elif [ "$1" = "kill" ]; then

function_kill_mysql

else

    printf "Usage: /opt/local/mysql/mysql {start;stop;restart;kill}\n"

fi

 

################################################################

chmod +x /opt/local/mysql/mysql

 

启动mysql

 

/opt/local/mysql/mysql start

 

/opt/local/mysql/bin/mysqladmin -u root password '12345678'

 

/opt/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

------------------------------------------------------------------ 

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '12345678';

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '12345678';

------------------------------------------------------------------ 

 

/opt/local/mysql/mysql stop

 

 

安装 httpd   -   Apache

  

tar zxvf httpd-2.2.21.tar.gz

cd httpd-2.2.21/

./configure --prefix=/opt/local/httpd --enable-so --enable-rewrite --enable-ssl

make

make install

 

cp /opt/local/httpd/bin/apachectl /etc/init.d/httpd

vi /etc/rc.d/init.d/httpd

# chkconfig: 2345 10 90

# description: Activates/Deactivates Apache Web Server

chmod +x /etc/rc.d/init.d/httpd

chkconfig --add httpd

chkconfig httpd on

 

echo "AddType application/x-httpd-php .php" >> /opt/local/httpd/conf/httpd.conf

echo "AddType application/x-httpd-php-source .phps" >> /opt/local/httpd/conf/httpd.conf

 

 

编译安装 php-5.2.17

tar zxvf php-5.2.17.tar.gz

cd php-5.2.17

./configure --prefix=/opt/local/php --with-mysql=/opt/local/mysql --with-apxs2=/opt/local/httpd/bin/apxs --with-iconv-dir=/usr/local --enable-soap --enable-sockets --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl -with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-curl

 

make ZEND_EXTRA_LIBS='-liconv'

 

make install

 

cp php.ini-dist /opt/local/php/lib/php.ini

 

编译安装PHP5扩展模块

 

tar zxvf memcache-3.0.6.tgz

cd memcache-3.0.6/

/opt/local/php/bin/phpize

./configure --with-php-config=/opt/local/php/bin/php-config

make

make install

cd ../

 

tar jxvf eaccelerator-0.9.6.1.tar.bz2

cd eaccelerator-0.9.6.1/

/opt/local/php/bin/phpize

./configure --enable-eaccelerator=shared --with-php-config=/opt/local/php/bin/php-config

make

make install

cd ../

 

tar zxvf ImageMagick-6.7.1-6.tar.gz

cd ImageMagick-6.7.1-6/

./configure

make

make install

cd ../

 

tar zxvf imagick-3.0.1.tgz

cd imagick-3.0.1/

/opt/local/php/bin/phpize

./configure --with-php-config=/opt/local/php/bin/php-config

make

make install

cd ../

 

修改php.ini文件


/opt/local/php/lib/php.ini   中的   extension_dir = "./"   

修改为   extension_dir = "/opt/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

并在此行后增加以下几行: 

  extension = "memcache.so"

 extension = "imagick.so"


再查找output_buffering = Off

修改为output_buffering = On


配置eAccelerator加速PHP


mkdir -p /opt/local/php/eaccelerator_cache


vi /opt/local/php/lib/php.ini       


文件的最末尾,加上以下配置信息:


[eaccelerator]

zend_extension="/opt/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

eaccelerator.shm_size="64"

eaccelerator.cache_dir="/opt/local/php/eaccelerator_cache"

eaccelerator.enable="1"

eaccelerator.optimizer="1"

eaccelerator.check_mtime="1"

eaccelerator.debug="0"

eaccelerator.filter=""

eaccelerator.shm_max="0"

eaccelerator.shm_ttl="3600"

eaccelerator.shm_prune_period="3600"

eaccelerator.shm_only="0"

eaccelerator.compress="1"

eaccelerator.compress_level="9"

 

你可能感兴趣的:(配置,程序)