已解决 centos下搭建zentao的运行环境

王公,你好

     能不能给一个在centos5.5下安装apache、php、mysql的步骤,我都配置了两天了,老是出问题。

禅道版本 1.4 源码包
操作系统 CentOS
客户端浏览器 Firefox

提问者: 赵易魁 悬赏:5 日期: 2011-01-12 15:20:49 答案:2 点击:12748

获取技术支持

QQ: 电话:
设置备注
答案列表
2011/01/12
简单的方案,下载xampp套装,然后再按照源代码方式安装禅道。    
2011/01/14

下面的shell是一个完整的LAMP配置。。你找到你需要装的软件。。按照shell上面的执行步骤安装。。基本上是没问题的

<pre>

#!/bin/bash

IN_PWD=$(pwd)
IN_SRC=${IN_PWD}/lanmp
IN_LOG=${IN_SRC}/lanmp_install.log
IN_DIR="/www/wdlinux"
IN_DIR_ME=0
SERVER="apache"
RE_INS=0
X86=0
SOFT_DOWN=0

#soft url and down
HTTPD_DU="http://apache.freelamp.com/httpd/httpd-2.2.16.tar.gz"
NGINX_DU="http://nginx.org/download/nginx-0.8.51.tar.gz"
MYSQL_DU="http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.50.tar.gz"
PHP_DU="http://www.php.net/get/php-5.2.14.tar.gz/from/cn.php.net/mirror"
EACCELERATOR_DU="http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2"
ZEND_DU="http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz"
ZENDX86_DU="http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz"
PHP_FPM_DU="http://php-fpm.org/downloads/php-5.2.14-fpm-0.5.14.diff.gz"
VSFTPD_DU="http://dl.wdlinux.cn:5180/vsftpd-2.2.2.tar.gz"
PHPMYADMIN_DU="http://dl.wdlinux.cn:5180/phpMyAdmin-3.3.3-all-languages.tar.gz"
PCRE_DU="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz"

if [[ ! -d $IN_SRC ]];then
        mkdir $IN_SRC
fi
if [[ ! -d $IN_DIR ]];then
        mkdir -p $IN_DIR
 mkdir -p $IN_DIR/etc
 mkdir -p $IN_DIR/init.d
 mkdir -p /www/web
fi
if [[ `uname -m | grep "x86_64"` ]];then
 X86=1
fi
if [[ $1 == "nginx" ]];then
 SERVER="nginx"
else
 SREVER="apache"
fi
cd $IN_SRC

if [[ $IN_DIR != "/www/wdlinux" ]];then
 IN_DIR_ME=1
fi

function make_clean {
 if [[ $RE_INS == 1 ]];then
  make clean
 fi
}
function wget_down {
 if [[ $SOFT_DOWN == 1 ]];then
 echo "start down..."
        for i in $*; do
                [ `wget -c $i` ] && exit
        done
 fi
}

if [[ $SERVER == "apache" ]];then
 wget_down $HTTPD_DU
elif [[ $SERVER == "nginx" ]];then
 wget_down $NGINX_DU $PHP_FPM $PCRE_DU
fi
if [[ $X86 == "1" ]];then
 wget_down $ZENDX86_DU
else
 wget_down $ZEND_DU
fi
wget_down $MYSQL_DU $PHP_DU $EACCELERATOR_DU $VSFTPD_DU $PHPMYADMIN_DU

function error {
        echo "ERROR: "$1
        exit
}

function file_cp {
 if [[ -f $2 ]];then
  mv $2 $2`date +%Y%m%d%H`
 fi
 cp -f $1 $2
}
function file_rm {
 if [[ -f $1 ]];then
  rm -f $f1
 fi
}
function file_bk {
 if [[ -f $1 ]];then
  mv $1 $1"_"`date +%Y%m%d%H`
 fi
}
useradd -d /www/web/wdlinux wdlinux >&2 > /dev/null
useradd -d /dev/null -s /sbin/nologin www >&2 > /dev/null
chmod 755 /www/web/wdlinux
echo "wdlinux.cn" | passwd wdlinux --stdin >&2 > /dev/null
setenforce 0

# install function
function mysql_ins {
 echo "installing mysql..."
 cd $IN_SRC
 useradd -d /dev/null -s /sbin/nologin mysql >&2 > /dev/null
 tar zxvf mysql-5.1.53.tar.gz
 if [[ $X86 == 1 ]];then
  LIBNCU="/usr/lib64/libncursesw.so.5"
 else
  LIBNCU="/usr/lib/libncursesw.so.5"
 fi  
 cd mysql-5.1.53/
 make_clean
 ./configure --prefix=$IN_DIR/mysql-5.1.53 --enable-assembler --enable-thread-safe-client --with-extra-charsets=complex --with-ssl --with-embedded-server --with-named-curses-libs=$LIBNCU
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
 ln -s $IN_DIR/mysql-5.1.53 $IN_DIR/mysql
 file_cp "support-files/my-large.cnf" "$IN_DIR/etc/my.cnf"
 $IN_DIR/mysql/bin/mysql_install_db
 chown -R mysql.mysql $IN_DIR/mysql/var
 file_cp "support-files/mysql.server" "$IN_DIR/init.d/mysqld"
 chmod 755 $IN_DIR/init.d/mysqld
 ln -s $IN_DIR/init.d/mysqld /etc/rc.d/init.d/mysqld
 chkconfig --add mysqld
 service mysqld start
 echo "PATH=\$PATH:$IN_DIR/mysql/bin" > /etc/profile.d/mysql.sh
 echo "$IN_DIR/mysql" > /etc/ld.so.conf.d/mysql-wdl.conf
 $IN_DIR/mysql/bin/mysqladmin -u root password "wdlinux.cn"
}


function apache_ins {
 echo "installing httpd..."
 cd $IN_SRC
 tar zxvf httpd-2.2.17.tar.gz
 cd httpd-2.2.17
 make_clean
 ./configure --prefix=$IN_DIR/httpd-2.2.17 --with-mpm=worker --enable-rewrite --enable-deflate --disable-userdir --enable-so
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
 ln -s $IN_DIR/httpd-2.2.17 $IN_DIR/apache
 echo "Include conf/httpd-wdl.conf" >> $IN_DIR/apache/conf/httpd.conf
 echo "Include conf/httpd-vhosts.conf" >> $IN_DIR/apache/conf/httpd.conf
 echo "Include conf/vhost/*.conf" >> $IN_DIR/apache/conf/httpd.conf
 sed -i '/#ServerName/a\
ServerName localhost
' $IN_DIR/apache/conf/httpd.conf
}

function nginx_ins {
 pcre_ins
 echo "installing nginx..."
 cd $IN_SRC
 tar zxvf nginx-0.8.53.tar.gz
 cd nginx-0.8.53
 make_clean
 ./configure --user=www --group=www --prefix=$IN_DIR/nginx-0.8.53 --with-http_stub_status_module --with-http_ssl_module
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
 ln -s $IN_DIR/nginx-0.8.53 $IN_DIR/nginx
}

function php_ins {
 echo "installing php..."
 cd $IN_SRC
 tar zxvf php-5.2.14.tar.gz
 NV=""
 [ $SERVER == "nginx" ] && NV="--enable-fastcgi --enable-fpm" && gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -fd php-5.2.14 -p1
 [ $SERVER == "apache" ] && NV="--with-apxs2=$IN_DIR/apache/bin/apxs"
 cd php-5.2.14/
 make_clean
 ./configure --prefix=$IN_DIR/php-5.2.14 --with-mysql=$IN_DIR/mysql --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash $NV
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
 ln -s $IN_DIR/php-5.2.14 $IN_DIR/php
 cp php.ini-dist $IN_DIR/php/lib/php.ini
 if [[ $SERVER == "nginx" ]];then
  sed -i '/nobody/s#<!--##g' $IN_DIR/php/etc/php-fpm.conf
  sed -i '/nobody/s#-->##g' $IN_DIR/php/etc/php-fpm.conf
 fi
}


function eaccelerator_ins {
 echo "installing eaccelerator..."
 cd $IN_SRC
 tar jxvf eaccelerator-0.9.6.tar.bz2
 cd eaccelerator-0.9.6/
 make_clean
 $IN_DIR/php/bin/phpize
 ./configure --enable-eaccelerator=shared --with-php-config=$IN_DIR/php/bin/php-config
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
 mkdir $IN_DIR/eaccelerator_cache
 if [[ $SERVER == "nginx" ]];then
  EA_DIR="$IN_DIR/php/lib/php/extensions/no-debug-non-zts-20060613"
 else
  EA_DIR="$IN_DIR/php/lib/php/extensions/no-debug-zts-20060613"
 fi
echo '[eaccelerator]
extension_dir="'$EA_DIR'"
extension="/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="'$IN_DIR'/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"' >> $IN_DIR/php/lib/php.ini
}

function zend_ins {
        echo "Zend installing..."
        cd $IN_SRC
 if [[ $X86 == "1" ]];then
  tar zxvf zend_64.tar.gz -C $IN_DIR
 else
  tar zxvf zend_32.tar.gz -C $IN_DIR
 fi
 echo '[Zend]
zend_extension_manager.optimizer='$IN_DIR'/Zend/lib/Optimizer-3.3.3
zend_extension_manager.optimizer_ts='$IN_DIR'/Zend/lib/Optimizer_TS-3.3.3
zend_optimizer.version=3.3.3
zend_extension='$IN_DIR'/Zend/lib/ZendExtensionManager.so
zend_extension_ts='$IN_DIR'/Zend/lib/ZendExtensionManager_TS.so' >> $IN_DIR/php/lib/php.ini
}

function vsftpd_ins {
 echo "vsftpd installing..."
 cd $IN_SRC
 tar zxvf vsftpd-2.2.2.tar.gz
 cd vsftpd-2.2.2
 make
 mkdir /usr/share/empty
 mkdir -p $IN_DIR/vsftpd
 install -m 755 vsftpd $IN_DIR/vsftpd/vsftpd
 install -m 644 vsftpd.8 /usr/share/man/man8
 install -m 644 vsftpd.conf.5 /usr/share/man/man5
 install -m 644 vsftpd.conf $IN_DIR/etc/vsftpd.conf
}

function phpmyadmin_ins {
 echo "phpmyadmin installing..."
 cd $IN_SRC
 tar zxvf phpmyadmin.tar.gz -C /www/web/wdlinux
}

function pcre_ins {
 echo "pcre installing..."
 cd $IN_SRC
 tar zxvf pcre-8.10.tar.gz
 cd pcre-8.10
 ./configure --prefix=/usr
 [ $? != 0 ] && exit
 make
 [ $? != 0 ] && exit
 make install
 [ $? != 0 ] && exit
}

function conf {
 cd $IN_PWD/conf
 file_cp my.cnf $IN_DIR/etc/my.cnf
 ln -s $IN_DIR/etc/my.cnf /etc/my.cnf
 file_cp vsftpd.conf $IN_DIR/etc/vsftpd.conf
 file_cp vsftpd.denyuser $IN_DIR/etc/vsftpd.denyuser
 file_cp vsftpd $IN_DIR/init.d
 chmod 755 $IN_DIR/init.d/vsftpd
 ln -s $IN_DIR/init.d/vsftpd /etc/rc.d/init.d/vsftpd
 ln -s $IN_DIR/etc/vsftpd.conf /etc/vsftpd.conf
 chkconfig --add vsftpd
 chkconfig --level 3 vsftpd on
 file_cp phpinfo.php /www/web/wdlinux/phpinfo.php
 file_cp iProber2.php /www/web/wdlinux/iProber2.php
 file_cp vhost.sh /bin/
 if [[ $IN_DIR_ME == 1 ]];then
  sed -i "s#/www/wdlinux#$IN_DIR#g" /etc/rc.d/init.d/vsftpd
  sed -i "s#/www/wdlinux#$IN_DIR#g" /etc/vsftpd.conf
  sed -i "s#/www/wdlinux#$IN_DIR#g" /bin/vhost.sh
 fi
 if [[ $SERVER == "apache" ]];then
  file_cp wdlinux_a.html /www/web/wdlinux/wdlinux.html
  file_cp httpd-vhosts.conf $IN_DIR/apache/conf/httpd-vhosts.conf
  file_cp httpd-wdl.conf $IN_DIR/apache/conf/httpd-wdl.conf
  file_cp httpd $IN_DIR/init.d/httpd
  chmod 755 $IN_DIR/init.d/httpd
  file_rm /etc/rc.d/init.d/httpd
  ln -s $IN_DIR/init.d/httpd /etc/rc.d/init.d/httpd
  chkconfig --add httpd
  chkconfig --level 3 httpd on
  mkdir -p $IN_DIR/apache/conf/vhost
  if [[ $IN_DIR_ME == 1 ]];then
   sed -i "s#/www/wdlinux#$IN_DIR#g" /etc/rc.d/init.d/httpd
  fi
 else
  file_cp wdlinux_n.html /www/web/wdlinux/wdlinux.html
  file_cp fcgi.conf $IN_DIR/nginx/conf/fcgi.conf
  file_cp nginx.conf $IN_DIR/nginx/conf/nginx.conf
  mkdir -p $IN_DIR/nginx/conf/vhost
  file_cp nginxd $IN_DIR/init.d/nginxd
  ln -s $IN_DIR/php/sbin/php-fpm $IN_DIR/init.d/php-fpm
  chmod 755 $IN_DIR/init.d/nginxd
  chmod 755 $IN_DIR/init.d/php-fpm
  file_rm /etc/rc.d/init.d/nginxd
  ln -s $IN_DIR/init.d/nginxd /etc/rc.d/init.d/nginxd
  ln -s $IN_DIR/php/sbin/php-fpm /etc/rc.d/init.d/php-fpm
  chkconfig --add nginxd
  chkconfig --level 3 nginxd on
  if [[ $IN_DIR_ME == 1 ]];then
   sed -i "s#/www/wdlinux#$IN_DIR#g" /etc/rc.d/init.d/nginxd
   sed -i "s#/www/wdlinux#$IN_DIR#g" /etc/rc.d/init.d/php-fpm
  fi
 fi
}

function start_srv {
 echo "start..."
 if [[ $SERVER == "nginx" ]];then
  service nginxd start
 else
  service httpd start
 fi
 service vsftpd start
}

function in_finsh {
 echo
 echo
 echo
 echo "  configuration ,lanmp install is finshed"
 echo "  more infomation please visit http://www.wdlinux.cn/linux_lanmp"
 echo
}

echo "Select Install
        1 apache + php + mysql + zend + eAccelerator + vsftpd + phpmyadmin
        2 nginx + php + mysql + zend + eAccelerator + vsftpd + phpmyadmin
 3 don't install is now
"
read -p "Please Input 1,2,3: " SERVER_ID
if [[ $SERVER_ID == 2 ]];then
        SERVER="nginx"
elif [[ $SERVER_ID == 1 ]];then
        SERVER="apache"
else
 exit
fi
if [[ $SOFT_DOWN == 1 ]];then
 cd $IN_PWD
 if [[ -f lanmp.tar.gz ]];then
  tar zxvf lanmp.tar.gz
 else
  wget -c http://dl.wdlinux.cn:5180/lanmp.tar.gz
  tar zxvf lanmp.tar.gz
 fi
fi
mysql_ins
${SERVER}_ins
php_ins 
eaccelerator_ins
zend_ins
vsftpd_ins
phpmyadmin_ins
conf
start_srv
in_finsh
</pre>