Linux软件rpm方式安装,yum源地址变更

rpm包安装 (不用配置环境变量)
rpm -qa |grep jdk 检查是否安装过jdk
rpm -e 包名 如果已经有了安装包,卸载
rpm -ivh 包名 安装rpm包
yum remove 包名 yum卸载安装包

yum安装:
改变yum源地址:
yum相当于maven的中心库,地址是可以改变的
cd /etc/yum.repos.d 本地的yum源库路径配置文件
https://mirrors.aliyun.com/ 阿里云网址
yum -y install wget 安装wget ,作用是下载rpm包
阿里云网站找到 centos和epel模块点击help 替换yum源
备份CentOS-Base.repo文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

重新下载替换CentOS-Base.repo的yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
重新下载替换epel.repo的yum源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
清除缓存(刷新yum库):
yum clean all
构建缓存:
yum makecache

创建本地yum源
1.找有rpm包的镜像一般是linux系统CD2
添加到光驱
2.挂载光驱文件
mount -t iso9660 -o ro /dev/cdrom /mnt
3.安装nginx,配置nginx并启动
4.配置本地源(放到cd /etc/yum.repos.d 的文件里和阿里的配置平齐)
[localtest]
name=Thisis a local repo
baseurl=file:///mnt/Packages
enabled=1
gpgcheck=0
gpgkey=file:///mnt/RPM-GPG-KEY-CentOS-6
5.如果gpgcheck设置为1,可能报异常找不到repomd.xml,这样先不配置本地yum源
yum -y install createrepo
通过createrepo构建repomd.xml

猜你喜欢

转载自blog.csdn.net/u011418530/article/details/80234591