一键自动化安装配置yum源—(163_epel ) _centos6.5-6.8.32/64_需连网
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一键自动化安装配置yum源—(163_epel ) _centos6.5-6.8.32/64_需连网相关的知识,希望对你有一定的参考价值。
Linux_centos6.5 6.8(32/64都亲测过) #!/bin/bash
先检测yum wget是否安装 rpm -qa yum wget
[[email protected](8)-nginx ~]# rpm -qa yum wget
wget-1.12-1.4.el6.i686
yum-3.2.29-30.el6.centos.noarch
如没有安装请先安装 yum wget
并确定yum 可用 测试: yum install gcc c++ 关已Redhat yum 不可用请度
Redhat6使用CentOS的yum源在线安装软件
注意权限问题 需能修改 /etc/yum.repos.d
全自动下载更新 163 epel..... yum 源
bash脚本如下 添加了DNS 114.114.114.114 8.8.8.8
代码如下:
#!/bin/bash #author mychen 237356573 var=$(getconf LONG_BIT) var1=‘$basearch‘ rpm -qa yum wget echo "First, make sure that you had mounted the ‘yum‘ ‘wget‘" read -p "Press y/Y to continue." answer echo $var [[ $answer =~ [yY] ]] || exit ( cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date -d "today" +"%Y%m%d_%H%M%S") #mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/ echo "import...DNS" echo "nameserver 114.114.114.114" > /etc/resolv.conf echo "nameserver 8.8.8.8" >> /etc/resolv.conf wget http://mirrors.163.com/.help/CentOS6-Base-163.repo && mv CentOS6-Base-163.repo CentOS-Base.repo #yum clean all && yum makecache && yum repolist yum install yum-plugin-fastestmirror echo "add epel...." echo $var if [ "$var" == "32" ];then ehco "add 32_epel" rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm echo "[epel] name=Extra Packages for Enterprise Linux 6 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - $basearch - Debug #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 6 - $basearch - Source #baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1" > /etc/yum.repos.d/epel.repo echo "cache...yum.." yum clean all && yum makecache && yum repolist elif [ $var == "64" ];then echo "add 64_epel"; rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm echo "[epel] name=Extra Packages for Enterprise Linux 6 - "$var1"/n #baseurl=http://download.fedoraproject.org/pub/epel/6/"$var1" baseurl=http://mirrors.sohu.com/fedora-epel/6/"$var1" #mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch="$var1" failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - "$var1" - Debug #baseurl=http://download.fedoraproject.org/pub/epel/6/"$var1"/debug baseurl=http://mirrors.sohu.com/fedora-epel/6/"$var1"/debug #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch="$var1" failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 6 - "$var1" - Source #baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS baseurl=http://mirrors.sohu.com/fedora-epel/6/SRPMS #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch="$var1" failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1" > /etc/yum.repos.d/epel.repo echo "cache...yum.." yum clean all && yum makecache && yum repolist fi ) &&echo "OK! You can install by the ‘yum‘ ‘wget‘"
加入权限 运行
chmod 755 yum.rpom.sh && yum.rpm.sh
本文出自 “10740501” 博客,请务必保留此出处http://10750501.blog.51cto.com/10740501/1910481
以上是关于一键自动化安装配置yum源—(163_epel ) _centos6.5-6.8.32/64_需连网的主要内容,如果未能解决你的问题,请参考以下文章
redhat 配置本地yum源163yum源epel 源,无需卸载yum!无须拷贝ISO