标签:lamp--apache
在后面导入启动脚本的时候,好像会出错,导致服务不能启动,还没有发现是怎么回事
#!/bin/bash
#
echo "Apache installing..."
yum -y groupinstall ‘Compatibility libraries‘ ‘Development tools‘
yum -y installncurses-devel openssl*
echo "apr & apr-util ..."
read -p "Please input compress type[bz2|gz]: " COMPRESS
read -p "Please input a apr VERSION[apr-"VERSION".tar.$COMPRESS]: " APRVER
while ! echo $APRVER | grep "[![:alpha:]]*" &> /dev/null ; do
read -p "Please input a apr version[apr-"VERSION".tar.$COMPRESS]: " APRVER
done
read -p "Please input a apr-util version[apr-util-"VERSION".tar.$COMPRESS]: " APRUTILVER
while ! echo $APRUTILVER | grep "[![:alpha:]]*" &> /dev/null ; do
read -p "Please input a apr version[apr-util-"VERSION".tar.$COMPRESS]: " APRUTILVER
done
tar -xf apr-${APRVER}.tar.$COMPRESS
cd apr-${APRVER}
./configure --prefix=/usr/local/apr
make && make install
cd -
tar -xf apr-util-${APRUTILVER}.tar.$COMPRESS
cd apr-util-${APRUTILVER}
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd -
echo "httpd ..."
read -p "Please input compress type[bz2|gz]: " COMPRESS
read -p "Please input a httpd VERSION[httpd-"VERSION".tar.$COMPRESS]: " HTTPDVER
while ! echo $HTTPDVER | grep "[![:alpha:]]*" &> /dev/null ; do
read -p "Please input a apr version[apr-util-"VERSION".tar.$COMPRESS]: " APRUTILVER
done
tar -xf httpd-${HTTPDVER}.tar.$COMPRESS
cd httpd-${HTTPDVER}
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event
make && make install
cd -
cat << EOF >> /etc/httpd/httpd.conf
PidFile "/var/run/httpd.pid"
EOF
cat << EOF > /etc/init.d/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: 345 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/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# 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/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
EOF
chmod +x /etc/init.d/httpd
chkconf --add httpd
echo "Apach Install Succeeful"标签:lamp--apache
原文地址:http://10900996.blog.51cto.com/10890996/1757501