序
想更新rh6.7企业版上的gcc,才能编译手头的工程.
先要使yum可以更新非本地的软件,再从外网升级yum.
实验还没做完,先记录这些.
实验
rh企业版要升级,正常是要有企业账号. 个人账号不好使.
网上的方法是找centos版的yum配置文件进行修改和替换.
网上有个原版centos的rhel-source.repo,下载后,将文件中的$releasever文本都换成6,然后替换到/etc/yum.repos.d/rhel-source.repo.
#
# @file rhel-souce.repo
# please replace all $releasever to 6,means the file's configure is for centos6
# after modify,please replace to /etc/yum.repos.d/rhel-source.repo
#
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/x86_64/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/x86_64/repodata/repomd.xml
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6.0/centosplus/$basearch/
gpgcheck=1
enabled=0
升级yum
替换完配置文件后,可以从外网进行yum了.
现在升级yum,写了一个很挫的脚本来进行yum升级.
用wget时,发现centos镜像站点上的目录结构和文件名已经变了,如果以后还要用这个脚本,要去镜像站点先确认下,文件名称和位置,如果变了,替换脚本中的对应文件名称和下载点url.
如果将博客中的脚本贴到.sh后,需要在vi或si中处理一下回车符号为unix回车符号.
# @file wget_yum.sh
# @brief when copy wget_yum.sh to linux,chmod 777 wget_yum.sh,then run wget_yum.sh
# chmod 777 wget_yum.sh
# wget_yum.sh
function sh_main {
clear
printf "================================================================================\n"
printf "================================================================================\n"
printf "================================================================================\n"
printf "================================================================================\n"
printf "================================================================================\n"
printf "================================================================================\n"
printf "wget yum begin...\n"
printf "================================================================================\n"
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum*.rpm,have 31 rpm
# and need install some depend rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
# yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
fn_wget 0 yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
# fn_install yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
fn_wget 0.1 yum-3.2.29-81.el6.centos.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
# fn_install yum-3.2.29-81.el6.centos.noarch.rpm
# have depend each other,must install together
rpm --install yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm
fn_wget 0.30 deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
fn_wget 0.30 python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
fn_wget 0.3 python-decoratortools-1.7-4.1.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install python-decoratortools-1.7-4.1.el6.noarch.rpm
fn_wget 0.2 createrepo-0.9.9-26.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install createrepo-0.9.9-26.el6.noarch.rpm
# python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -aq|grep python-urlgrabber|xargs rpm -e --nodeps
fn_wget 1 python-urlgrabber-3.9.1-11.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install python-urlgrabber-3.9.1-11.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-NetworkManager-dispatcher-1.1.30-40.el6.noarch.rpm
fn_wget 2 yum-NetworkManager-dispatcher-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-NetworkManager-dispatcher-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-cron-3.2.29-81.el6.centos.noarch.rpm
fn_wget 3 yum-cron-3.2.29-81.el6.centos.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-cron-3.2.29-81.el6.centos.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-Metadata-parser-1.1.2-16.el6.x86_64.rpm
fn_wget 4 yum-Metadata-parser-1.1.2-16.el6.x86_64.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-Metadata-parser-1.1.2-16.el6.x86_64.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-aliases-1.1.30-40.el6.noarch.rpm
fn_wget 5 yum-plugin-aliases-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-aliases-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-auto-update-debug-info-1.1.30-40.el6.noarch.rpm
fn_wget 6 yum-plugin-auto-update-debug-info-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-auto-update-debug-info-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-changelog-1.1.30-40.el6.noarch.rpm
fn_wget 7 yum-plugin-changelog-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-changelog-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-filter-data-1.1.30-40.el6.noarch.rpm
fn_wget 9 yum-plugin-filter-data-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-filter-data-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fs-snapshot-1.1.30-40.el6.noarch.rpm
fn_wget 10 yum-plugin-fs-snapshot-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-fs-snapshot-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-keys-1.1.30-40.el6.noarch.rpm
fn_wget 11 yum-plugin-keys-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-keys-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-list-data-1.1.30-40.el6.noarch.rpm
fn_wget 12 yum-plugin-list-data-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-list-data-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-local-1.1.30-40.el6.noarch.rpm
fn_wget 13 yum-plugin-local-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-local-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-merge-conf-1.1.30-40.el6.noarch.rpm
fn_wget 14 yum-plugin-merge-conf-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-merge-conf-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-ovl-1.1.30-40.el6.noarch.rpm
fn_wget 15 yum-plugin-ovl-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-ovl-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-post-transaction-actions-1.1.30-40.el6.noarch.rpm
fn_wget 16 yum-plugin-post-transaction-actions-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-post-transaction-actions-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-priorities-1.1.30-40.el6.noarch.rpm
fn_wget 17 yum-plugin-priorities-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-priorities-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-protectbase-1.1.30-40.el6.noarch.rpm
fn_wget 18 yum-plugin-protectbase-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-protectbase-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-ps-1.1.30-40.el6.noarch.rpm
fn_wget 19 yum-plugin-ps-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-ps-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-remove-with-leaves-1.1.30-40.el6.noarch.rpm
fn_wget 20 yum-plugin-remove-with-leaves-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-remove-with-leaves-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-rpm-warm-cache-1.1.30-40.el6.noarch.rpm
fn_wget 21 yum-plugin-rpm-warm-cache-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-rpm-warm-cache-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-security-1.1.30-40.el6.noarch.rpm
fn_wget 22 yum-plugin-security-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-security-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-show-leaves-1.1.30-40.el6.noarch.rpm
fn_wget 23 yum-plugin-show-leaves-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-show-leaves-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-tmprepo-1.1.30-40.el6.noarch.rpm
fn_wget 24 yum-plugin-tmprepo-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-tmprepo-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-tsflags-1.1.30-40.el6.noarch.rpm
fn_wget 25 yum-plugin-tsflags-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-tsflags-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-upgrade-helper-1.1.30-40.el6.noarch.rpm
fn_wget 26 yum-plugin-upgrade-helper-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-upgrade-helper-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-verify-1.1.30-40.el6.noarch.rpm
fn_wget 27 yum-plugin-verify-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-verify-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-versionlock-1.1.30-40.el6.noarch.rpm
fn_wget 28 yum-plugin-versionlock-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-plugin-versionlock-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-presto-0.6.2-1.el6.noarch.rpm
fn_wget 29 yum-presto-0.6.2-1.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-presto-0.6.2-1.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-updateonboot-1.1.30-40.el6.noarch.rpm
fn_wget 30 yum-updateonboot-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-updateonboot-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-utils-1.1.30-40.el6.noarch.rpm
# fn_wget 31 yum-utils-1.1.30-40.el6.noarch.rpm http://mirrors.163.com/centos/6/os/x86_64/Packages/
fn_install yum-utils-1.1.30-40.el6.noarch.rpm
printf "================================================================================\n"
printf "END\n"
printf "================================================================================\n"
}
# @fn : fn_wget
# @param file number. e.g. file 1
# @param rpm name have not url,e.g. yum-utils-1.1.30-40.el6.noarch.rpm
# @param rpm's url,e.g. http://mirrors.163.com/centos/6/os/x86_64/Packages/
function fn_wget {
# echo ">> fn_wget --------------------------------------------------------------------------------"
echo "process $1 ..."
if [ -f ./$2 ]; then \
# echo "file $1 exists : $2,ok"; \
printf ""
else \
echo "<< fn_wget --------------------------------------------------------------------------------"
echo "file $1 not exists : download $2 ..."; \
echo "<< fn_wget --------------------------------------------------------------------------------"
wget $3$2; \
fi;
# echo "<< fn_wget --------------------------------------------------------------------------------"
}
# @fn : fn_install
# @param rpm name have not url,e.g. yum-utils-1.1.30-40.el6.noarch.rpm
function fn_install {
echo ">> fn_install --------------------------------------------------------------------------------"
echo "install file ./$1 ..."
if [ -f ./$1 ]; then \
echo "file $1 exists : ./$1"; \
rpm --install "./$1"; \
else \
echo "install Failed : file not exists : ./$1 ..."; \
fi;
echo "<< fn_install --------------------------------------------------------------------------------"
}
sh_main "$@"
总结
升级完yum,就可以去升级gcc到新版本了. 实验还没做. 不升级linux版本,只升级部分组件(e.g. yum,gcc),还是有潜在问题的. 如果用户那的计算机本来运行的溜溜的,谁也不能保证他用的现有软件是否会依赖升级后的组件. 最好的方法,还是不升级用户计算机上的任何组件.
原文链接:https://www.f2er.com/bash/390802.html