天天看點

Linux學習筆記CentOS7安裝程式一、cpm二、yum

文章目錄

  • 一、cpm
  • 二、yum
    • 1.網絡下載下傳
    • 2.本地安裝

一、cpm

進入到檔案目錄

rpm -ivh +檔案名    安裝
rpm -uvh +檔案名    更新安裝
rpm -ql +檔案名     查詢安裝位置
rpm -qa|grep 關鍵字 查詢
           

二、yum

1.網絡下載下傳

wget +連結位址
yum install +名稱
           

2.本地安裝

把CD光牒挂在到windows上

在/mnt目錄下建立cdrom目錄

cd /mnt
mkdir cdrom
mount /dev/cdrom cdrom 将CD光牒挂載到cdrom目錄
           

回到/etc/yum.repos.d/

編譯本地源檔案

cd /etc/yum.repos.d/
vi CentOS-Media.repo
           
代碼示例
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c7-media [command]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom/ 改為剛才挂載的位址
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=1  改為1啟用配置檔案
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7      
           

清除依賴資料庫

yum clean all
           

建立本地依賴資訊

yum makecache
           

繼續閱讀