Shell脚本升级CentOS php版本v
#! /bin/sh
#1.关闭selinux
cp -rp /etc/selinux/config /etc/selinux/config.bak
setenforce 0
sed -i '7s/enforcing/disabled/' /etc/selinux/config
#2.显示selinux的状态 Permissive为关闭
getenforce
#3.判断系统的版本
if [ "$(uname -i)" = i386 ]; then
# 如果服务器是32位,那么运行如下命令
echo "开始下载第三方remi库 i386"
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
else
## 如果是64位的 那么运行以下命令
echo "下载第三方remi库 X64"
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
fi
#4.修改remi.repo的配置文件 如果只想升级到php5.4.x,那么就把[remi]部分的enabled改为1
#如果想升级到php5.5.x,那么就把[remi]和[remi-php55]部分的enabled都改为1
cp -rp /etc/yum.repos.d/remi.repo /etc/yum.repos.d/remi.repo.bak
sed -i '9s/enabled=0/enabled=1/' /etc/yum.repos.d/remi.repo
sed -i '18s/enabled=0/enabled=1/' /etc/yum.repos.d/remi.repo
sed -i '7s/^#//' /etc/yum.repos.d/remi.repo
sed -i '8s/^/#&/' /etc/yum.repos.d/remi.repo
sed -i '15s/^#//' /etc/yum.repos.d/remi.repo
sed -i '16s/^/#&/' /etc/yum.repos.d/remi.repo
#修改下面epel.repo的配置文件信息 不然会报错
cp -rp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
sed -i '3s/^#//' /etc/yum.repos.d/epel.repo
sed -i '12s/^#//' /etc/yum.repos.d/epel.repo
sed -i '21s/^#//' /etc/yum.repos.d/epel.repo
sed -i '4s/^/#&/' /etc/yum.repos.d/epel.repo
sed -i '13s/^/#&/' /etc/yum.repos.d/epel.repo
sed -i '22s/^/#&/' /etc/yum.repos.d/epel.repo
#5.查看系统是不是安装了php 卸载之前的php版本
yum list php
yum remove php* -y
#6. 安装最新的php
echo "正在安装新版本的php Please wait"
yum --enablerepo=remi install php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt --skip-broken -y
#7.修改Apache配置文件 添加index.php首页
sed -i '402s/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.php index.html.var/' /etc/httpd/conf/httpd.conf
#8.修改php.ini的配置
#在946行下面添加时间
sed -i '946a date.timezone = PRC' /etc/php.ini
#9.添加测试页 测试php版本
echo -e "<?php\nphpinfo();\n?> " > /var/www/html/phpinfo.php
#10.重启Apache服务
service httpd restart
#11.防火墙开放80端口
sed -i '10a -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT ' /etc/sysconfig/iptables
#12.重启防火墙
service iptables restart
yum list php
echo -----------------
echo "PHP版本升级成功"
echo -----------------
Shell脚本升级CentOS php版本v的更多相关文章
- 关于使用java执行shell脚本获取centos的硬盘序列号和mac地址
1.获取硬盘序列号: 新建shell脚本文件: identifier.sh, 内容为: diskdata=`fdisk -l` diskleft=${diskdata#*"identifie ...
- Linux centos开机执行JAR Shell脚本
Linux centos开机执行shell脚本 Linux centos开机执行 java jar 1.编写jar执行脚本 vim start.sh 加入如下内容(根据自己真实路径与数据进行编写) ...
- 不同系统执行相同shell脚本,出现Syntax error: "(" unexpected错误解决
例如shell脚本在centos系统中能正常执行,而在ubuntu系统中执行会出现类似Syntax error: "(" unexpected的错误,一般这种是因为sh与bash有 ...
- centos shell脚本编程1 正则 shell脚本结构 read命令 date命令的用法 shell中的逻辑判断 if 判断文件、目录属性 shell数组简单用法 $( ) 和${ } 和$(( )) 与 sh -n sh -x sh -v 第三十五节课
centos shell脚本编程1 正则 shell脚本结构 read命令 date命令的用法 shell中的逻辑判断 if 判断文件.目录属性 shell数组简单用法 $( ) 和$ ...
- CentOS 下运维自动化 Shell 脚本之 expect
CentOS 下运维自动化 Shell脚本之expect 一.预备知识: 1.在 Terminal 中反斜杠,即 "" 代表转义符,或称逃脱符.("echo -e与pri ...
- 编写shell脚本让springboot项目在CentOS中开机自启动
springboot项目部署在CentOS系统上时,如果遇到停电关机,公司的实施人员就得跑到甲方现场重新启动项目并测试,很是麻烦,这里探讨如何编写shell脚本控制springboot项目开机时自动启 ...
- Centos 6.4上面用Shell脚本一键安装vsftpd
Centos 6.4上面用Shell脚本一键安装vsftpd install.sh #!/bin/bash if [ `uname -m` == "x86_64" ];then m ...
- Centos 6.4上面用Shell脚本一键安装mysql 5.6.15
Centos 6.4上面用Shell脚本一键安装mysql 5.6.15 #!/bin/bash if [ `uname -m` == "x86_64" ];then machi ...
- CentOS 6一键系统优化 Shell 脚本
CentOS 6一键系统优化 Shell 脚本 脚本的内容如下: #!/bin/bash#author suzezhi#this script is only for CentOS 6#check t ...
随机推荐
- GNU-ARM汇编
GNU ARM 汇编指令(2008-10-29 00:16:10) 标签:linux gnu arm 汇编指令 it 分类:技术文摘 第一部分 Linux下ARM汇编语法尽管在Linux下使用C或C+ ...
- iLinuxBot: Designing Botnets to Manage Linux Clients
转:http://www.linuxforu.com/2012/05/ilinuxbot-designing-botnets-to-manage-linux-clients/ By Nishant S ...
- BootStrap2学习日记21---消息提示
<p><a href="#" title="中国(China),位于东亚,是一个以华夏文明为主体.中华文化为基础,以汉族为主要民族的统一多民族国家,通用 ...
- 10分钟学会AngularJS的数据绑定
前言:为什么要用AngularJS? 相信用过.NetMVC的人都知道用rezor绑定数据是一件很爽的事情,C#代码直接在前台页面中输出.然后这种比较适用于同步请求. 当我们的项目离不开异步请 ...
- Hastiness
Problem Description How many problems did you AC?When you read this problem, don’t hasty and careles ...
- 1.6.8 Content Streams
1. Content Streams 当RequestHandlers请求基于URL路径来访问时,SolrQueryRequest包含了请求的参数,同样包含了ContentStreams(包含了大容量 ...
- 使用 sp_executesql
建议您在执行字符串时,使用 sp_executesql 存储过程而不要使用 EXECUTE 语句.由于此存储过程支持参数替换,因此 sp_executesql 比 EXECUTE 的功能更多:由于 S ...
- IOS获取系统时间 NSDate
//返回当前时间,精确到毫秒.- (NSString *)getTimeNow { NSString* date; NSDateFormatter * formatter = [[NSDateForm ...
- iOS 犄角旮旯的知识
1.全局变量 static NSInteger kImageHeight = 300; #define kImageHeight 300 2.通知中心 开始编辑 UITextViewTextDidBe ...
- (一)u-boot2013.01.01 for TQ210:《Uboot简介》
一直想写一个s5pv210硬件平台的u-boot的移植文档,但一直都忙着没时间写.先写一些u-boot的脚本分析吧,包括makefile,mkconfig,config.mk,主要侧重于语法句意的分析 ...