Centos 5.5 32位支持5.2的php安装 安装的时候执行sh -x filename 5.2 就可以安装5.2版本的php
#!/bin/sh
yum install httpd* -y
[ $? != 0 ] && echo "install apache err" && exit
yum install mysql* -y
[ $? != 0 ] && echo "install mysql err" && exit
yum install vsftpd -y
[ $? != 0 ] && echo "install vsftpd err" && exit
if [ "$1" = "5.2" ];then
yum install php-* -y
cat <<"E"OF >> /etc/yum.repos.d/CentOS-Base.repo
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
EOF
yum update php-* -y
[ $? != 0 ] && echo "install php err" && exit
a=grep -n -o "\[utterramblings\]" /etc/yum.repos.d/CentOS-Base.repo | awk -F":" '{print $1}'
b=$(($a + 5))
sed -i "${a},${b}d" /etc/yum.repos.d/CentOS-Base.repo
else
fi
mkdir /wwwroot
[ $? != 0 ] && echo "mkdir wwwroot err" && exit
#disk=$(fdisk -l | grep -v /dev/vda | grep GB | awk '{print $2}'|awk -F":" '{print $1}')
disk=/dev/vdb
mkfs.ext3 $disk
[ $? != 0 ] && echo "mkfs err" && exit
echo "$disk /wwwroot/ ext3 defaults 0 0" >> /etc/fstab
mount -a
[ $? != 0 ] && echo "mount wwwroot err" && exit
iptables -I INPUT 1 -p tcp --dport 21 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
sed -i 's=DocumentRoot "/var/www/html"=DocumentRoot "/wwwroot"=' /etc/httpd/conf/httpd.conf
service httpd start
service mysqld start
service vsftpd start
chkconfig --level 3 vsftpd on
chkconfig --level 3 httpd on
chkconfig --level 3 mysqld on
useradd -d /wwwroot/ -s /sbin/nologin ftpuser
echo "ftpuser:ftpuser1234" | chpasswd
chown -R ftpuser:root /wwwroot/
echo "apache php mysql vsftp ok,apache documentroot is /wwwroot ,mysql passwd is null,ftp\`name is ftpuser,password is ftpuser1234,you must receive a password,use command:passwd ftpuser"
本文转自 freeterman 51CTO博客,原文链接:http://blog.51cto.com/myunix/1141233,如需转载请自行联系原作者