Redhat脚本改用CentOS源更新安装nginx、php 5.3、varnish

redhat改用centos的yum组件,步骤有点麻烦,为了方便大家,写了个脚本的自动配置。。。。


yum源用的是epel和科技大学的。


#/bin/bash 
#by rfyiamcool 
#echo "nameserver 8.8.8.8" >>/etc/resolv.conf 
mkdir /root/yum 
cd /root/yum 
rpm -qa|grep yum|xargs rpm -e --nodeps 
if ! rpm -qa|grep yum ;then 
echo uninstall yum ok 
else 
rpm -qa |grep yum 
exit 
fi 
wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm 
wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm 
wget  http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm 
echo dowoload cetnos-yum ok 
rpm -ivh yum-*.rpm 
echo install cetnos-yum ok 
cd /etc/yum.repos.d 
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 
cat >> epel.repo <<EOF
[epel] 
name=Extra Packages for Enterprise Linux 5 - \$basearch 
#baseurl=http://download.fedoraproject.org/pub/epel/5/\$basearch 
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=\$basearch 
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL 
                                                             
[epel-debuginfo] 
name=Extra Packages for Enterprise Linux 5 - \$basearch - Debug 
baseurl=http://download.fedoraproject.org/pub/epel/5/\$basearch/debug 
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=\$basearch 
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL 
gpgcheck=1
                                                             
[epel-source] 
name=Extra Packages for Enterprise Linux 5 - \$basearch - Source 
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS 
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=\$basearch 
failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL 
gpgcheck=1
EOF 
yum makecache 
yum list httpd*


epel源

 
 

centos 5
wget http://rfyiamcool.googlecode.com/files/epel-release-5-4.noarch.rpm
centos 6
wget http://rfyiamcool.googlecode.com/files/epel-release-6-7.noarch.rpm




执行安装, 根据需要增减要安装的php模块

 
 

yum install nginx mysql mysql-server php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy


启动nginx, php-fpm, mysqld

 
 
service nginx restart
                      
service php-fpm restart
                      
service mysqld restart


设置自动启动

 
 

chkconfig nginx on
               
chkconfig php-fpm on
               
chkconfig mysqld on


mysql密码设置

 
 
  1. mysql_secure_installation




041853926.jpg



至于目录权限管理什么的, 就不写了.

niginx配置文件在/etc/nginx/nginx.conf
php-fpm配置文件在/etc/php-fpm.conf
php配置文件/etc/php.ini
mysql配置文件/etc/my.cnf


也可以安装yum安装iftop和varnish的

yum install iftop

yum install varnish


如果出现问题,大家错误贴出来,探讨下~~~


你可能感兴趣的:(redhat,centos,redhat,yum源,yum源,epel源)