[root@jieshiyeskey ~]# lsb_release -a
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.5 (Final)
Release: 5.5
Codename: Final
[root@jieshiyeskey ~]# uname -m
x86_64
[root@jieshiyeskey ~]# 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 gd gd-devel
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1.Install _MySQL
[root@jieshiyeskey websoftware]# tar zxvf libevent-1.4.13-stable.tar.gz
[root@jieshiyeskey websoftware]# cd libevent-1.4.13-stable
[root@jieshiyeskey libevent-1.4.13-stable]# ./configure --prefix=/usr/local/libevent
[root@jieshiyeskey libevent-1.4.13-stable]# make && make install
[root@jieshiyeskey libevent-1.4.13-stable]# ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /usr/lib
[root@jieshiyeskey ~]# groupadd mysql
[root@jieshiyeskey ~]# useradd -g mysql -s /sbin/nologin mysql
[root@jieshiyeskey websoftware]# tar zxvf mysql-5.1.53.tar.gz.gz
[root@jieshiyeskey websoftware]# cd mysql-5.1.53
[root@jieshiyeskey mysql-5.1.53]# mkdir /db/mysql_data –p
[root@jieshiyeskey mysql-5.1.53]# mkdir /mysqlsoftware
[root@jieshiyeskey mysql-5.1.53]# ./configure --prefix=/mysqlsoftware/mysql --with-unix-socket-path=/mysqlsoftware/mysql/tmp/mysql.sock --localstatedir=/db/mysql_data --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-mysqld-user=mysql --with-pthread --enable-thread-safe-client --with-extra-charsets=utf8,gbk --with-plugins=partition,innobase,myisammrg --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
[root@jieshiyeskey mysql-5.1.53]# make && make install
[root@jieshiyeskey mysql-5.1.53]# cp support-files/my-huge.cnf /etc/my.cnf
[root@jieshiyeskey mysql-5.1.53]# /mysqlsoftware/mysql/bin/mysql_install_db --user=mysql
[root@jieshiyeskey mysql-5.1.53]# chown -R root /mysqlsoftware/mysql/
[root@jieshiyeskey mysql-5.1.53]# chgrp -R mysql /mysqlsoftware/mysql/
[root@jieshiyeskey mysql-5.1.53]# chgrp -R mysql /db/mysql_data/
[root@jieshiyeskey mysql-5.1.53]# /mysqlsoftware/mysql/bin/mysqld_safe &
[root@jieshiyeskey mysql-5.1.53]# netstat -an |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
[root@jieshiyeskey mysql-5.1.53]# /mysqlsoftware/mysql/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 1
Server version: 5.1.53-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql>
[root@jieshiyeskey mysql-5.1.53]# cp support-files/mysql.server /etc/init.d/mysqld
[root@jieshiyeskey mysql-5.1.53]# chmod 755 /etc/init.d/mysqld
[root@jieshiyeskey mysql-5.1.53]# /etc/init.d/mysqld restart
Shutting down MySQL....101202 15:59:02 mysqld_safe mysqld from pid file /db/mysql_data/jieshiyeskey.hapaworld.com.cn.pid ended
[ OK ]
Starting MySQL. [ OK ]
[1]+ Done /mysqlsoftware/mysql/bin/mysqld_safe
[root@hapame01 ~]# vim /etc/ld.so.conf
/mysqlsoftware/mysql/lib/mysql
[root@hapame01 ~]# ldconfig -v |grep mysql
/mysqlsoftware/mysql/lib/mysql:
libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
[root@jieshiyeskey ~]# vim /etc/profile
export PATH=$PATH:/mysqlsoftware/mysql/bin
[root@jieshiyeskey ~]# source /etc/profile
[root@jieshiyeskey ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 2
Server version: 5.1.53-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql>
[root@jieshiyeskey ~]# chkconfig mysqld on
[root@jieshiyeskey ~]# chkconfig --level 24 mysqld off
[root@jieshiyeskey ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@jieshiyeskey websoftware]# tar zxvf memcached-1.4.5.tar.gz
[root@jieshiyeskey memcached-1.4.5]# cd memcached-1.4.5
[root@jieshiyeskey memcached-1.4.5]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[root@jieshiyeskey memcached-1.4.5]# make && make install
[root@jieshiyeskey ~]# /usr/local/memcached/bin/memcached -d -m 100 -u root -p 11211
[root@jieshiyeskey ~]# netstat -an |grep 11211
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN
tcp 0 0 :::11211 :::* LISTEN
udp 0 0 0.0.0.0:11211 0.0.0.0:*
udp 0 0 :::11211 :::*
[root@jieshiyeskey ~]# vim /etc/rc.local
/usr/local/memcached/bin/memcached -d -m 100 -u root -p 11211
[root@jieshiyeskey ~]# lsof -n |grep memcached
memcached 23696 root cwd DIR 8,1 4096 2 /
memcached 23696 root rtd DIR 8,1 4096 2 /
memcached 23696 root txt REG 8,1 248473 5541271 /usr/local/memcached/bin/memcached
memcached 23696 root mem REG 8,1 139416 5479773 /lib64/ld-2.5.so
memcached 23696 root mem REG 8,1 1717800 5479774 /lib64/libc-2.5.so
memcached 23696 root mem REG 8,1 145824 5479783 /lib64/libpthread-2.5.so
memcached 23696 root mem REG 8,1 53448 5479785 /lib64/librt-2.5.so
memcached 23696 root mem REG 8,1 114352 5479795 /lib64/libnsl-2.5.so
memcached 23696 root mem REG 8,1 92736 5479797 /lib64/libresolv-2.5.so
memcached 23696 root mem REG 8,1 104296 5121391 /usr/lib64/libevent-1.4.so.2.1.3
memcached 23696 root mem REG 8,1 53880 5146239 /lib64/libnss_files-2.5.so
memcached 23696 root 0u CHR 1,3 1452 /dev/null
memcached 23696 root 1u CHR 1,3 1452 /dev/null
memcached 23696 root 2u CHR 1,3 1452 /dev/null
memcached 23696 root 3r 0000 0,11 0 187601 eventpoll
memcached 23696 root 4u unix 0xffff81003d3646c0 187602 socket
memcached 23696 root 5u unix 0xffff81003d364f00 187603 socket
memcached 23696 root 6r FIFO 0,6 187604 pipe
memcached 23696 root 7w FIFO 0,6 187604 pipe
memcached 23696 root 8r 0000 0,11 0 187605 eventpoll
memcached 23696 root 9u unix 0xffff81003d364c40 187606 socket
memcached 23696 root 10u unix 0xffff81003d364400 187607 socket
memcached 23696 root 11r FIFO 0,6 187608 pipe
memcached 23696 root 12w FIFO 0,6 187608 pipe
memcached 23696 root 13r 0000 0,11 0 187609 eventpoll
memcached 23696 root 14u unix 0xffff8100336a2e40 187610 socket
memcached 23696 root 15u unix 0xffff8100336a3940 187611 socket
memcached 23696 root 16r FIFO 0,6 187612 pipe
memcached 23696 root 17w FIFO 0,6 187612 pipe
memcached 23696 root 18r 0000 0,11 0 187613 eventpoll
memcached 23696 root 19u unix 0xffff8100336a3680 187614 socket
memcached 23696 root 20u unix 0xffff810029412440 187615 socket
memcached 23696 root 21r FIFO 0,6 187616 pipe
memcached 23696 root 22w FIFO 0,6 187616 pipe
memcached 23696 root 23r 0000 0,11 0 187617 eventpoll
memcached 23696 root 24u unix 0xffff810029413780 187618 socket
memcached 23696 root 25u unix 0xffff810006b77d00 187619 socket
memcached 23696 root 26u IPv6 187623 TCP *:11211 (LISTEN)
memcached 23696 root 27u IPv4 187624 TCP *:11211 (LISTEN)
memcached 23696 root 28u IPv6 187628 UDP *:11211
memcached 23696 root 29u IPv4 187629 UDP *:11211
[root@jieshiyeskey websoftware]# tar zxvf libunwind-0.99.tar.gz
[root@jieshiyeskey websoftware]# cd libunwind-0.99
[root@jieshiyeskey libunwind-0.99]# CFLAGS=-fPIC ./configure
[root@jieshiyeskey libunwind-0.99]# make CFLAGS=-fPIC
[root@jieshiyeskey libunwind-0.99]# make CFLAGS=-fPIC install
[root@jieshiyeskey websoftware]# tar zxvf google-perftools-1.6.tar.gz
[root@jieshiyeskey websoftware]# cd cd google-perftools-1.6
[root@jieshiyeskey google-perftools-1.6]# ./configure
[root@jieshiyeskey google-perftools-1.6]# make && make install
[root@jieshiyeskey google-perftools-1.6]# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
[root@jieshiyeskey ~]# /sbin/ldconfig –v
[root@jieshiyeskey ~]# vim /etc/init.d/mysqld
[root@jieshiyeskey ~]# cat /etc/init.d/mysqld
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
# If you install MySQL on some other places than /mysqlsoftware/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
# below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
[root@jieshiyeskey ~]# /etc/init.d/mysqld restart
Shutting down MySQL.... [ OK ]
Starting MySQL.. [ OK ]
[root@jieshiyeskey ~]# lsof -n |grep tcmalloc
mysqld_sa 23022 root mem REG 8,1 1364640 5139333 /usr/local/lib/libtcmalloc.so.0.0.0
2.Install_Apache
[root@jieshiyeskey ~]# groupadd www
[root@jieshiyeskey ~]# useradd -g www -s /sbin/nologin www
[root@jieshiyeskey websoftware]# mkdir /websoftware
[root@jieshiyeskey websoftware]# mkdir /webwww
[root@jieshiyeskey websoftware]# tar jxvf httpd-2.2.17.tar.bz2
[root@jieshiyeskey websoftware]# chown -R www.www /webwww/
[root@jieshiyeskey websoftware]# cd httpd-2.2.17
[root@jieshiyeskey httpd-2.2.17]# ./configure --prefix=/websoftware --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-ssl --enable-so --enable-rewrite --with-mpm=worker
[root@jieshiyeskey httpd-2.2.17]# make && make install
make && make install
[root@jieshiyeskey conf]# pwd
/websoftware/conf
[root@jieshiyeskey conf]# vim httpd.conf
User www
Group www
AddType application/x-httpd-php .php
AddType application/x-httpd-source-php .phps
DocumentRoot "/webwww"
<Directory "/webwww">
[root@jieshiyeskey websoftware]# cp /websoftware/bin/apachectl /etc/init.d/httpd
[root@jieshiyeskey websoftware]# chmod 755 /etc/init.d/httpd
[root@jieshiyeskey websoftware]# cat /etc/init.d/httpd
#!/bin/sh
#
# chkconfig: 35 10 90
# description: Activates/Deactivates Apache Web Server httpd
[root@jieshiyeskey websoftware]# /etc/init.d/httpd start
[root@jieshiyeskey websoftware]# netstat -an |grep 80
tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN
tcp 0 0 :::80 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 13241 /tmp/mongodb-28017.sock
[root@jieshiyeskey websoftware]# ps -ef |grep httpd
root 27348 1 0 16:47 ? 00:00:00 /websoftware/bin/httpd -k start
www 27349 27348 0 16:47 ? 00:00:00 /websoftware/bin/httpd -k start
www 27350 27348 0 16:47 ? 00:00:00 /websoftware/bin/httpd -k start
www 27352 27348 0 16:47 ? 00:00:00 /websoftware/bin/httpd -k start
www 27353 27348 0 16:47 ? 00:00:00 /websoftware/bin/httpd -k start
[root@jieshiyeskey websoftware]# chkconfig httpd on
[root@jieshiyeskey websoftware]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@jieshiyeskey websoftware]# tar zxvf cronolog-1.6.2.tar.gz
[root@jieshiyeskey websoftware]# cd cronolog-1.6.2
[root@jieshiyeskey cronolog-1.6.2]# ./configure
[root@jieshiyeskey cronolog-1.6.2]# make && make install
[root@jieshiyeskey cronolog-1.6.2]# vim /websoftware/conf/httpd.conf
CustomLog "|/usr/local/sbin/cronolog /usr/local/webserver/apache2/logs/%Y_%m_%d.access.log" combined
3.Install PHP
[root@hapame01 opt]# tar zxvf libiconv-1.13.1.tar.gz
[root@hapame01 libiconv-1.13.1]# cd libiconv-1.13.1
[root@hapame01 libiconv-1.13.1]# ./configure --prefix=/usr/local
[root@hapame01 libiconv-1.13.1]# make && make install
[root@hapame01 opt]# tar zxvf libmcrypt-2.5.8.tar.gz
[root@hapame01 opt]# cd libmcrypt-2.5.8
[root@hapame01 libmcrypt-2.5.8]# ./configure
[root@hapame01 libmcrypt-2.5.8]# make && make install
[root@hapame01 libmcrypt-2.5.8]# /sbin/ldconfig –v
[root@hapame01 libltdl]# cd libltdl/
[root@hapame01 libltdl]# ./configure --enable-ltdl-install
[root@hapame01 libltdl]# make && make install
[root@hapame01 opt]# tar jxvf mhash-0.9.9.9.tar.bz2
[root@hapame01 opt]# cd mhash-0.9.9.9
[root@hapame01 mhash-0.9.9.9]# ./configure
[root@hapame01 mhash-0.9.9.9]# make && make install
[root@hapame01 opt]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
[root@hapame01 opt]#
[root@hapame01 opt]# ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
[root@hapame01 opt]# tar zxvf mcrypt-2.6.8.tar.gz
[root@hapame01 opt]# cd mcrypt-2.6.8
[root@hapame01 mcrypt-2.6.8]# /sbin/ldconfig
[root@hapame01 mcrypt-2.6.8]# ./configure
[root@hapame01 mcrypt-2.6.8]# make && make install
[root@hapame01 ~]# mkdir /php
[root@hapame01 opt]# tar jxvf php-5.3.3.tar.bz2
[root@hapame01 opt]# cd php-5.3.3
[root@hapame01 php-5.3.3]# ./configure --prefix=/php --with-config-file-path=/php/etc --with-mysql=/mysqlsoftware/mysql --with-mysqli=/mysqlsoftware/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-apxs2=/websoftware/bin/apxs --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-safe-mode
[root@hapame01 php-5.3.3]# make ZEND_EXTRA_LIBS='-liconv'
[root@hapame01 php-5.3.3]# make install
[root@hapame01 php-5.3.3]# cp php.ini-development /php/etc/php.ini
[root@hapame01 webwww]# vim /websoftware/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
DirectoryIndex index.html index.php
[root@hapame01 webwww]# cat /webwww/index.php
<?php
phpinfo();
?>
[root@hapame01 webwww]# vim /php/etc/php.ini
date.timezone = America/New_York
[root@hapame01 webwww]# /etc/init.d/httpd restart