- #cd /etc/yum.repos.d/
- #wget ftp://172.16.0.1/pub/gls/server.repo--(自己事先准备好的yum源)
- #hwclock -s --同步时间,一定要保证自己的系统时间与硬件时间一致,不然会报错。
- #yum grouplist---检查yum配置环境;
#yum -y groupinstall "Development Libraries"---安装yum配置环境;
- #lftp 172.16.0.1
- #cd pub/Sources/new_lamp/
- #get apr-1.4.6.tar.bz2 apr-util-1.4.1.tar.bz2--APR-util是APR 辅助工具;
- #bye
- #tar xf apr-1.4.6.tar.bz2
- #cd apr-1.4.6
- #./buildconf
- #./configure --prefix=/usr/local/apr-------指定apr安装路径;
- #make
- #make install---APR安装完成;
- #cd
- #tar xf apr-util-1.4.1.tar.bz2
- #cd apr-util-1.4.1
- #./buildconf --with-apr=/root/apr-1.4.6--执行apr源码的位置;
- #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr----指定apr和apr-util的安装路径;
- #make----编译;
#make install-----安装,apr-util安装完成;
- #cd
- #lftp 172.16.0.1
- #cd pub/Sources/new_lamp/
- #get httpd-2.4.2.tar.bz2
- #bye
- #tar xf httpd-2.4.2.tar.bz2
- #cd httpd-2.4.2
- #rpm -q pcre-devel----查看pcre-devel包是否已安装;
- #yum -y install pcre-devel----安装pcre-devel软件包;
- #./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-modules-shared=most
- #make---编译;
- #make install----安装;--------httpd安装完成;
#vim /etc/profile--编辑bash环境变量文件;
# No core files by default- ulimit -S -c 0 > /dev/null 2>&1
- if [ -x /usr/bin/id ]; then
- USER="`id -un`"
- LOGNAME=$USER
- MAIL="/var/spool/mail/$USER"
- fi
- HOSTNAME=`/bin/hostname`
- HISTSIZE=1000
- if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
- INPUTRC=/etc/inputrc
- fi
- PATH=/usr/local/apache/bin:$PATH ------增加该项,声明httpd位置,使对所有用户均有效;
- export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
- [root@localhost ~]# httpd -l
- Compiled in modules:
- core.c
- mod_so.c
- http_core.c
- event.c ----httpd2.4版本新特性模块;
[root@localhost ~]#
- [root@localhost bin]# apachectl start
- [root@localhost bin]# netstat -tnlp
- Active Internet connections (only servers)
- Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
- tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3310/./hpiod
- tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2954/portmap
- tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3688/httpd
- tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3335/sshd
- tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3351/cupsd
- tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3407/sendmail
- tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 3620/sshd
- tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN 4318/sshd
- tcp 0 0 0.0.0.0:636 0.0.0.0:* LISTEN 2998/rpc.statd
- tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3315/python
-
DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.##DocumentRoot "/usr/local/apache/htdocs" -------把该项禁用掉;<Directory "/usr/local/apache/htdocs">
# Virtual hosts Include /etc/httpd/extra/httpd-vhosts.conf ----打开虚拟主机选项;
5)编辑/etc/httpd/extra/httpd-vhosts.conf配置文件:
#<VirtualHost *:80> -------把下面示例虚拟主机选项禁用掉;- # ServerAdmin webmaster@dummy-host.example.com
- # DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
- # ServerName dummy-host.example.com
- # ServerAlias www.dummy-host.example.com
- # ErrorLog "logs/dummy-host.example.com-error_log"
- # CustomLog "logs/dummy-host.example.com-access_log" common
- #</VirtualHost>
- #
- #<VirtualHost *:80>
- # ServerAdmin webmaster@dummy-host2.example.com
- # DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
- # ServerName dummy-host2.example.com
- # ErrorLog "logs/dummy-host2.example.com-error_log"
- # CustomLog "logs/dummy-host2.example.com-access_log" common
- #</VirtualHost>
- <VirtualHost *:80> -----------------------增加一下三个虚拟主机,主页面根据自己情况而定;
- ServerName www.magedu.com
- DocumentRoot /web/vhosts/www
- <Directory "/web/vhosts/www">
- Options Indexes
- AllowOverride none
- Require all granted
- </Directory>
- </VirtualHost>
- <VirtualHost *:80>
- ServerName pma.magedu.com
- DocumentRoot /web/vhosts/pma
- </VirtualHost>
- # Every automatically generated MANPATH includes these fields
- #
- MANPATH /usr/man
- MANPATH /usr/share/man
- MANPATH /usr/local/man
- MANPATH /usr/local/share/man
- MANPATH /usr/X11R6/man
- MANPATH /usr/local/apache/man-----添加man命令路径;
- #
- # Uncomment if you want to include one of these by default
- #ln -sv /usr/local/apache/include/ /usr/include/
- apachectl=/usr/local/apache/bin/apachectl ----改成apachectl所在路径;
- httpd=${HTTPD-/usr/local/apache/bin/httpd}----改成httpd所在路径;
- prog=httpd
- pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid} --改成httpd.pid所在路径;
- lockfile=${LOCKFILE-/var/lock/subsys/httpd}
- RETVAL=0
- STOP_TIMEOUT=${STOP_TIMEOUT-10}
- # check for 1.3 configuration ----把以下14行注释掉,因为我这里用的不是1.3版本的apache;
- #check13 () {
- # CONFFILE=/etc/httpd/conf/httpd.conf
- # GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
- # GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
- # GONE="${GONE}AccessConfig|ResourceConfig)"
- # if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
- # echo
- # echo 1>&2 " Apache 1.3 configuration directives found"
- # echo 1>&2 " please read /usr/share/doc/httpd-2.2.3/migration.html"
- # failure "Apache 1.3 config directives test"
- # echo
- # exit 1
- # fi
- #}
- #
- # The semantics of these two functions differ from the way apachectl does
- # things -- attempting to start while running is a failure, and shutdown
- # when not running is also a failure. So we just do it the way init scripts
- # are expected to behave here.
- start() {
- echo -n $"Starting $prog: "
- # check13 || exit 1 ---把改行注释掉;
- LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && touch ${lockfile}
- return $RETVAL
- #cp httpd /etc/rc.d/init.d/httpd
- #chmod +x /etc/rc.d/init.d/httpd
- #chkconfig --add httpd ---将httpd服务添加到列表中去;
#chkconfig httpd on 开机默认启动;
二、mysql编译安装;
- #lftp 172.16.0.1
- #cd pub/Sources/mysql-5.5/
- #get mysql-5.5.24-linux2.6-i686.tar.gz ---下载mysql源码安装包;
- #useradd -r mysql ---创建mysql用户,因为mysql需要普通用户mysql用户运行;
- #id mysql
- #finger mysql
- #tar xf mysql-5.5.24-linux2.6-i686.tar.gz -C /usr/local/ ---必须要解压到/usr/local目录下;
- #创建一个逻辑分区----为了方便存储数据,需要创建逻辑卷,这里我创建的是/dev/sda5;
- #pvcreate /dev/sda5
- # vgcreate myvg /dev/sda5
- #lvcreate -L 1G -n mydata myvg
- #mke2fs -j -L MYDATA /dev/myvg/mydata
- #vim /etc/fstab
- #mkdir /data
- #mount -a
- #mkdir /data/mysql
- #chown mysql:mysql /data/mysql/
- #cd /usr/local/
- #ln -sv mysql-5.5.24-linux2.6-i686 mysql
- #cd mysql
- #chown -R mysql:mysql .
- #scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql ---初始化mysql;
- #cp support-files/my-large.cnf /etc/my.cnf--提供配置文件;
- #vim /etc/my.cnf
- thread_concurrency = 4 如果是双核的就改为4; datadir= /data/mysql --指定数据目录;
- #cp support-files/mysql.server /etc/rc.d/init.d/mysqld ----提供服务启动脚本;
- #chkconfig --add mysqld
- #chkconfig --list mysqld
- #chown -R root . -----为了安全将当前目录的属组和属主改为root;
- #service mysqld start
- #vim /etc/profile-------(PATH=/usr/local/mysql/bin:$PATH) 指定环境变量;
- #export PATH=$PATH:/usr/local/mysql/bin/ -----重新输出使其立即生效;
- #vim /etc/ld.so.conf.d/mysql.conf----指定mysql的库文件/usr/local/mysql/lib
- #ldconfig------通知系统重新生成;
- #ln -sv /usr/local/mysql/include/ /usr/include/mysql---指定mysql的头文件;
- ----mysql安装编译配置完成;
#lftp 172.16.0.1 #cd pub/Sources/new_lamp/ #get php-5.4.4.tar.bz2 ---下载php源码安装包; #bye #tar xf php-5.4.4.tar.bz2 #cd php-5.4.4 #yum -y groupinstall "X Software Development" ------安装开发库; #lftp 172.16.0.1 #cd pub/Sources/nginx/ #mget libmcrypt-2.5.7-5.el5.i386.rpm libmcrypt-devel-2.5.7-5.el5.i386.rpm #bye #rpm -ivh libmcrypt-* #./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --编译安装php; #make----编译; #make install ---安装-----此时php已经安装完成;1)下面整合php和apache:
#cp php.ini-production /etc/php.ini #vim /etc/httpd/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.php index.html -----添加php页面; </IfModule>
# probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php ----添加web能够识别的php页面类型; AddType application/x-httpd-php-source .phps ----添加web能够识别的php页面类型;#service httpd restart----php安装完成;
- #lftp 172.16.0.1
- #cd pub/Sources/new_lamp/
- #get xcache-2.0.0.tar.bz2 -----下载xcache源码包;
- #bye
- #tar xf xcache-2.0.0.tar.gz
- #cd xcache-2.0.0
- #/usr/local/php/bin/phpize----让php能识别xcache模块;
- #./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
- #make --编译;
- #make install--安装;
- #mkdir /etc/php.d
- #cp xcache.ini /etc/php.d----首先将xcache提供的样例配置导入php.ini;
- #vim /etc/php.d/xcache.ini--接下来编辑/etc/php.d/xcache.ini,找到zend_extension开头的行,修改为如下行:
- zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
- #service httpd restart---整合php和xcache完成;