Yum as4 autoinstall

简介:
#!/usr/bin/env python 
import os,urllib,shutil 

os.system( 'rpm -qa|grep -i "yum"|xargs rpm -e --nodeps')  
os.system( 'rpm -qa|grep -i "centos"|xargs rpm -e --nodeps')  
i =  'yum_forAS4.tar.gz'  

if   not  os.path.isfile(i): 
                web =  'http://www.haoxm.net/tools/' + i  
                print  '"%s" Downloading........'%i  
                urlfile = urllib.urlopen(web) 
                local = open(i, 'wb').write(urlfile.read())  
                urlfile.close 
                os.system( 'tar -zxf %s' %i)  


os.system( 'cd yum_forAS4 && rpm -ivh *.rpm')  
key =  'rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4'  
base =  '/etc/yum.repos.d/'  

if   not  os.path.isdir(base): 
        os.mkdir(base) 
yum = base +  'CentOS-Base.repo'  
if   not  os.path.isfile(base): 
     shutil.copyfile( 'yum_forAS4/CentOS-Base.repo',yum)  
     os.system(key) 
     os.system( 'yum update')  









本文转自 ibelieveme 51CTO博客,原文链接:http://blog.51cto.com/skyson/510609,如需转载请自行联系原作者
目录
相关文章
|
Web App开发 应用服务中间件 Linux
yum使用总结
yum使用总结
179 0
|
存储 Linux Shell
|
缓存 安全 Linux
|
数据格式 XML
|
程序员 Linux 开发工具
|
Python C语言 Go
yum问题解决
错误信息1:There was a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was:No module named urlgrabberPlea...
1402 0