LInux下如何掛載光盤找rpm包?

寫在前面

Linux 使用有時須要安裝軟件,固然能夠經過 yum 命令來在線安裝,也能夠經過下載好的 rpm 包來進行安裝,可是 rpm 安裝須要本身來找安裝軟件所依賴的 rpm 包。今天就來嘗試操做下javascript

系統環境 CentOS 7.5
[root@localhost /]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

1.找到光盤的全路徑

[root@localhost /]# ls -l /dev | grep cdrom
lrwxrwxrwx 1 root root           3 3月   3 09:32 cdrom -> sr0
crw-rw---- 1 root cdrom    21,   1 3月   3 09:32 sg1
brw-rw---- 1 root cdrom    11,   0 3月   3 09:32 sr0

這個命令知道了光盤的名字叫:cdrom,那光盤的路徑就是 /dev/cdromjava

2.掛載光盤

[root@localhost /]# mount /dev/cdrom /mnt
mount: /dev/sr0 寫保護,將以只讀方式掛載
這個命令是把目錄 /dev/cdrom 的內容加載到了目錄 /mnt 下,也就是說目錄 /mnt 下能夠訪問目錄 /dev/cdrom 中的內容了,出現以下內容就掛載成功了
[root@localhost /]# cd /mnt/
[root@localhost mnt]# ls
CentOS_BuildTag  EULA images LiveOS  repodata  RPM-GPG-KEY-CentOS-Testing-77EFI GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL

3.拷貝目標rpm包

進入剛纔的目錄 Packages ,而後找到目標rpm包,這裏以「telnet 客戶端」爲例
[root@localhost mnt]# cd Packages/
[root@localhost Packages]# ls -l | grep telnet
-rw-rw-r-- 2 root root    65632 8月  11 2017 telnet-0.17-64.el7.x86_64.rpm
-rw-rw-r-- 2 root root    41804 8月  11 2017 telnet-server-0.17-64.el7.x86_64.rpm

這裏出來 2 個,可是看名稱能夠明白第一個是客戶端,另外一個是服務端,這裏選擇第一個便可,而後複製到 /root 下,出現以下結果即成功linux

[root@localhost Packages]# cp telnet-0.17-64.el7.x86_64.rpm /root/
[root@localhost Packages]# ls -l /root
總用量 72
-rw-------. 1 root root  1569 6月   3 2018 anaconda-ks.cfg
-rw-r--r--  1 root root 65632 3月   3 10:08 telnet-0.17-64.el7.x86_64.rpm
-rw-r--r--. 1 root root     0 6月  30 2018 ????.txt

4.卸載光盤

知道目標rpm包後,要記得卸載光盤哦!(先切出目錄 /mntui

[root@localhost Packages]# cd /
[root@localhost /]# umount /mnt/
[root@localhost /]# ls -l /mnt/
總用量 0

5.安裝拷貝的rpm包

[root@localhost /]# cd root/
[root@localhost ~]# rpm -ivh telnet-0.17-64.el7.x86_64.rpm 
準備中...                          ################################# [100%]
        軟件包 telnet-1:0.17-64.el7.x86_64 已經安裝
[root@localhost ~]# telnet
telnet>
出現如上內容說明 telnet 客戶端已經安裝成功,是否是很簡單?
相關文章
相關標籤/搜索