LAMP平台详述

xcache-2.0.0.tar.bz2

phpMyAdmin所需软件包:

phpMyAdmin-3.5.1-all-languages.tar.bz2

安装顺序 httpd –> mysql –> php

二、编译安装httpd-2.4.4

1、解决依赖关系

##########################安装apr##########################tar xf apr-1.4.6.tar.bz2./configure –prefix=/usr/local/aprmake && make install##########################安装apr-util#####################tar xf apr-util-1.4.1.tar.bz2./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/aprmake && make install##########################安装pcre-devel###################yum install pcre-devel

2、编译安装httpd-2.4.4

tar xf httpd-2.4.4.tar.bz2./configure –prefix=/usr/local/apache –sysconfdir=/etc/httpd –enable-so –enable-rewirte –enable-ssl –enable-cgi –enable-cgid –enable-modules=most –enable-mods-shared=most –enable-mpms-shared=all –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-utilmake && make install

3、修改Pid文件的路径以迎合启动脚本

vim /etc/httpd/httpd.confPidFile “/var/run/httpd.pid” //添加如下行

#!/bin/bash## httpdStartup script for the Apache HTTP Server## chkconfig: – 85 15# description: Apache is a World Wide Web server. It is used to serve \#HTML files and CGI.# processname: httpd# config: /etc/httpd/conf/httpd.conf# config: /etc/sysconfig/httpd# pidfile: /var/run/httpd.pid# Source function library.. /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/httpd ]; then. /etc/sysconfig/httpdfi# Start httpd in the C locale by default.HTTPD_LANG=${HTTPD_LANG-“C”}# This will prevent initlog from swallowing up a pass-phrase prompt if# mod_ssl needs a pass-phrase from the user.INITLOG_ARGS=””# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server# with the thread-based “worker” MPM; BE WARNED that some modules may not# work correctly with a thread-based MPM; notably PHP will refuse to start.# Path to the apachectl script, server binary, and short-form for messages.apachectl=/usr/local/apache/bin/apachectlhttpd=${HTTPD-/usr/local/apache/bin/httpd}prog=httpdpidfile=${PIDFILE-/var/run/httpd.pid}lockfile=${LOCKFILE-/var/lock/subsys/httpd}RETVAL=0start() {echo -n $”Starting $prog: “LANG=$HTTPD_LANG daemon –pidfile=${pidfile} $httpd $OPTIONSRETVAL=$?echo[ $RETVAL = 0 ] && touch ${lockfile}return $RETVAL}stop() {echo -n $”Stopping $prog: “killproc -p ${pidfile} -d 10 $httpdRETVAL=$?echo[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}}reload() {echo -n $”Reloading $prog: “if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; thenRETVAL=$?echo $”not reloading due to configuration syntax error”failure $”not reloading $httpd due to configuration syntax error”elsekillproc -p ${pidfile} $httpd -HUPRETVAL=$?fiecho}# See how we were called.case “$1” in start)start;; stop)stop;; status)status -p ${pidfile} $httpdRETVAL=$?;; restart)stopstart;; condrestart)if [ -f ${pidfile} ] ; thenstopstartfi;; reload)reload;; graceful|help|configtest|fullstatus)$apachectl $@RETVAL=$?;; *)echo $”Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}”exit 1esacexit $RETVAL

5、为脚本添加执行权限,开机自动启动

chmod +x /etc/rc.d/init.d/httpdchkconfig –add httpdchkconfig –level 35 httpd onchkconfig –list httpd

6、为命令添加搜索路径

vim /etc/profile.d/httpd.shexport PATH=$PATH:/usr/local/apache/bin //加入本行内容

7、修改mpm_module为prefork、检查语法并重启服务

vim /etc/httpd/httpd.conf#LoadModule mpm_event_module modules/mod_mpm_event.so注释LoadModule mpm_prefork_module modules/mod_mpm_prefork.so 添加httpd -t检查语法service httpd restart重启服务

至此httpd安装完成:

三、安装mysql-5.5.28

1、创建mysql用户和mysql组

groupadd -r -g 306 mysqluseradd -g 306 -r -u 306 mysql

2、创建链接文件

tar xf mysql-5.5.28-linux2.6-i686.tar.gz -C /usr/localcd /usr/localln -sv mysql-5.5.28-linux2.6-i686 mysqlchown -R mysql.mysql /usr/local/mysql/*3

3、为数据目录创建lvm

fdisk /dev/sdb略过步骤partprobe /dev/sdb检测pvcreate /dev/sdb1创建物理块vgcreate myvg /dev/sdb1 创建卷组lvcreate -n mydata -L 5G myvg 创建逻辑卷lvsmke2fs -j /dev/myvg/mydata 格式化mkdir /mydatavim /etc/fstab添加开机自启动/dev/myvg/mydata /mydata ext3 defaults0 0mount -a 挂载mountmkdir /mydata/data 创建数据目录chown -R mysql.mysql /mydata/data/ 修改数据目录属主与属组chmod o-rx /mydata/data/修改其他人对此目录权限

4、初始化mysql

scripts/mysql_install_db –user=mysql –datadir=/mydata/data/chown -R root /usr/local/mysql/*

5、添加启动脚本、主配置文件、命令路径、库文件、头文件

有的事情现在不做,就一辈子也不会做了。

LAMP平台详述

相关文章:

你感兴趣的文章:

标签云: