光盘镜像软件怎么安装(安装光盘镜像软件详细教程)

光盘镜像软件怎么安装(安装光盘镜像软件详细教程)

Yum(全称为 Yellowdog Updater, Modified)是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件包管理器。CentOS 和 Redhat 版本的 Linux 一般安装软件包选择 rpm 和 yum 安装方式,这也是比较常见的方式。不过 rpm 安装时如果有其他依赖的包则需要先安装依赖包,比较麻烦, yum 则可以解决依赖关系,也可同时安装多个 rpm 包。当然 deb 软件包安装以及源码方式安装也有使用。deb 软件包一般以 .deb 后缀结尾,dpkg -i 包名即可安装。源码方式的包一般都以.tar.gz 或者 .tar.bz2 结尾,下载后校检md5值,解压后经过配置(./configure)、编译(make)、安装(make install)便可以完成。

一般传统行业的公司的生产环境均是内网环境,是没有办法上网的,故网络 yum 源就不用考虑了,大公司基本上会使用局域网内的 FTP 服务器,配置 ftp 方式的 yum 源,通过局域网安装软件,也可挂载光盘镜像。个人学习使用或小公司基本上会配置本地 yum 源,以后有时间可以说说网络 yum 源,下面就先说说配置本地 yum 源以及安装软件的方式。

本次演示使用 Oracle VM VirtualBox下的Redhat6.4 以及 VMware Workstation Pro下的CentOS 7.6以及简略说明 linuxone下的 suse12sp4环境。

Redhat6.4 下配置 yum 源

一、插入光盘镜像

图形化界面上能够看到新增光盘图标,默认自动弹出窗口显示光盘中文件

二、 查看光盘对应路径

切换到光盘目录,使用 Tab 补齐的方法进入,便可以看到很多软件包,但由于默认路径有空格,不方便配置 yum 源,故需要重新挂载光盘。

[root@JiekeXu ~]# cd /media/RHEL_6.4\ x86_64\ Disc\ 1/[root@JiekeXu RHEL_6.4 x86_64 Disc 1]# ls

三、创建目录

光盘加载到光驱后默认挂载点(访问入口)为 /media/RHEL_6.4 x86_64 Disc 1 路径中包含空格,不方便使用。

创建目录 作为新挂载点 (访问光盘的入口)

[root@JiekeXu ~]# mkdir /mnt/dvd[root@JiekeXu ~]# ls -ld /mnt/dvd

四、重新挂载

df -Th 查看光盘对应设备名称 /dev/sr0

挂载光盘到新建的挂载点

[root@JiekeXu ~]# mount /dev/sr0 /mnt/dvd[root@JiekeXu ~]# df -Th

使用新挂载点即可访问光盘中文件

[root@JiekeXu ~]#ls /mnt/dvd

/mnt/dvd/Server 是配置 yum 仓库要用到的路径

五、修改配置文件配置 yum源

[root@JiekeXu ~]# cd /etc/yum.repos.d/[root@JiekeXu yum.repos.d]# lltotal 16K-r–r–r– 1 root root 114 Jul 2 2015 packagekit-media.repo-rw-r–r–. 1 root root 358 Oct 19 2017 redhat.repo-rw-r–r– 1 root root 656 Oct 20 2017 rhel64.repo-rw-r–r–. 1 root root 529 Jun 12 2015 rhel-source.repo[root@JiekeXu yum.repos.d]#

配置文件目录 /etc/yum.repos.d/

[root@JiekeXu yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak[root@JiekeXu yum.repos.d]# vi rhel-source.repo[rhel64]name=rhel64 repobaseurl=file:///mnt/dvd/Servergpgcheck=0[root@JiekeXu yum.repos.d]# tail -5 rhel-source.repo

六、yum基本操作

清除缓存

[root@JiekeXu yum.repos.d]# yum clean all Loaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository rhel-source is listed more than once in the configurationRepository rhel-source-beta is listed more than once in the configurationCleaning repos: InstallMedia rhel67 rhel67rpmCleaning up Everything

列出软件包

[root@JiekeXu yum.repos.d]# yum listLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.[root@JiekeXu yum.repos.d]# yum list | grep zshRepository rhel-source is listed more than once in the configurationRepository rhel-source-beta is listed more than once in the configurationzsh.x86_64 4.3.11-4.el6 @rhel64

yum安装、查看、删除软件包

[root@JiekeXu yum.repos.d]# yum install zsh[root@JiekeXu yum.repos.d]# yum info zsh[root@JiekeXu yum.repos.d]# yum remove zsh

七、 yum install XXX 安装其他的包

本地镜像源内的 rpm 包便可以自由安装了,使用 -y 则不用提示直接安装。

[root@JiekeXu yum.repos.d]# yum install vim* -y[root@JiekeXu yum.repos.d]# yum install x11*Loaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository rhel-source is listed more than once in the configurationRepository rhel-source-beta is listed more than once in the configurationSetting up Install ProcessResolving Dependencies–> Running transaction check—> Package xorg-x11-apps.x86_64 0:7.7-6.el6 will be installed–> Finished Dependency Resolution

CentOS 7.6下配置 yum源

CentOS 系列的 Linux 操作系统目前市场上使用的还是比较多的,而且很多公司也都陆陆续续使用 7 系列版本,那么本次将使用 CentOS 7.6 作为演示版本。

一、关闭防火墙

临时关闭防火墙

systemctl stop firewalld

永久防火墙开机自关闭

systemctl disable firewalld

临时打开防火墙

systemctl start firewalld

防火墙开机启动

systemctl enable firewalld

查看防火墙状态

systemctl status firewalld

[root@JiekeXu ~]# systemctl status firewalld● firewalld.service – firewalld – dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since 六 2019-09-07 08:33:48 CST; 18h ago Docs: man:firewalld(1)Main PID: 8220 (firewalld) Tasks: 2 CGroup: /system.slice/firewalld.service └─8220 /usr/bin/python -Es /usr/sbin/firewalld –nofork –nopid9月 07 08:33:40 JiekeXu systemd[1]: Starting firewalld – dynamic firewall daemon…9月 07 08:33:48 JiekeXu systemd[1]: Started firewalld – dynamic firewall daemon.9月 07 08:33:55 JiekeXu firewalld[8220]: WARNING: /etc/sysconfig/network-scripts/ifcfg-ens32: Duplicate option definition: ‘BOO…tatic”‘Hint: Some lines were ellipsized, use -l to show in full.[root@JiekeXu ~]#[root@JiekeXu ~]# systemctl stop firewalld[root@JiekeXu ~]# systemctl status firewalld● firewalld.service – firewalld – dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since 日 2019-09-08 03:19:50 CST; 3s ago Docs: man:firewalld(1) Process: 8220 ExecStart=/usr/sbin/firewalld –nofork –nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)Main PID: 8220 (code=exited, status=0/SUCCESS)9月 07 08:33:40 JiekeXu systemd[1]: Starting firewalld – dynamic firewall daemon…9月 07 08:33:48 JiekeXu systemd[1]: Started firewalld – dynamic firewall daemon.9月 07 08:33:55 JiekeXu firewalld[8220]: WARNING: /etc/sysconfig/network-scripts/ifcfg-ens32: Duplicate option definition: ‘BOO…tatic”‘9月 08 03:19:46 JiekeXu systemd[1]: Stopping firewalld – dynamic firewall daemon…9月 08 03:19:50 JiekeXu systemd[1]: Stopped firewalld – dynamic firewall daemon.Hint: Some lines were ellipsized, use -l to show in full.[root@JiekeXu ~]#[root@JiekeXu ~]# systemctl disable firewalldRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@JiekeXu ~]#[root@JiekeXu ~]# systemctl status firewalld● firewalld.service – firewalld – dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)9月 07 08:33:40 JiekeXu systemd[1]: Starting firewalld – dynamic firewall daemon…9月 07 08:33:48 JiekeXu systemd[1]: Started firewalld – dynamic firewall daemon.9月 07 08:33:55 JiekeXu firewalld[8220]: WARNING: /etc/sysconfig/network-scripts/ifcfg-ens32: Duplicate option definition: ‘BOO…tatic”‘9月 08 03:19:46 JiekeXu systemd[1]: Stopping firewalld – dynamic firewall daemon…9月 08 03:19:50 JiekeXu systemd[1]: Stopped firewalld – dynamic firewall daemon.Hint: Some lines were ellipsized, use -l to show in full.

二、关闭SELINUX

[root@JiekeXu sysconfig]# pwd/etc/sysconfig[root@JiekeXu sysconfig]# ls -l selinuxlrwxrwxrwx. 1 root root 17 7月 4 02:03 selinux -> ../selinux/config[root@JiekeXu ~]# cat /etc/sysconfig/selinux[root@JiekeXu ~]# more /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing – SELinux security policy is enforced.# permissive – SELinux prints warnings instead of enforcing.# disabled – No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of three values:# targeted – Targeted processes are protected,# minimum – Modification of targeted policy. Only selected processes are protected.# mls – Multi Level Security protection.SELINUXTYPE=targeted

四、设置域名解析

[root@JiekeXu ~]# vi /etc/resolv.conf# Generated by NetworkManagernameserver 192.168.32.1nameserver 192.168.32.0nameserver 8.8.8.8nameserver 114.114.114.114

五、挂载镜像

首先插入光盘镜像

六、建立目录,挂载镜像,将其写入开机自启动文件

mkdir /mnt/centosmount -t iso9660 -o loop /dev/sr0 /mnt/centosvim /etc/fstab

添加如下一行

/dev/cdrom /mnt/contos iso9660 defaults 0 0 0 0[root@JiekeXusysconfig]#cat/etc/fstab# /etc/fstab# Created by anaconda on Thu Jul 4 01:57:56 2019## Accessible filesystems, by reference, are maintained under ‘/dev/disk’# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#/dev/mapper/centos-root / xfs defaults 0 0UUID=d40ff30e-48ce-4286-8e3f-bc9e30f3a6bb /boot xfs defaults 0 0/dev/mapper/centos-swap swap swap defaults,size=1024M 0 0/dev/cdrom /mnt/centos iso9660 defaults 0 0 0 0

七、配置 yum源

进入/etc/yum.repos.d 目录修改CentOS-Media.repo文件

注意:如果没有注释掉 CentOS-Base.repo 则会出现如下未知错误。

[root@JiekeXu yum.repos.d]# yum clean all;已加载插件:fastestmirror, langpacks正在清理软件源:base extras local updatesCleaning up list of fastest mirrors[root@JiekeXu yum.repos.d]# yum repolist已加载插件:fastestmirror, langpacksDetermining fastest mirrorsCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was14: curl#6 – “Could not resolve host: mirrorlist.centos.org; 未知的错误”Loading mirror speeds from cached hostfileLoading mirror speeds from cached hostfileLoading mirror speeds from cached hostfileLoading mirror speeds from cached hostfile源标识 源名称 状态base/7/x86_64 CentOS-7 – Base 0extras/7/x86_64 CentOS-7 – Extras 0local CentOS-7 – local 0updates/7/x86_64 CentOS-7 – Updates 0repolist: 0

八、简单应用

清空缓存 yum clean all查看可用 yum 源 yum repolist[root@JiekeXu yum.repos.d]# yum clean all;已加载插件:fastestmirror, langpacks正在清理软件源:localCleaning up list of fastest mirrors[root@JiekeXu yum.repos.d]# yum repolist已加载插件:fastestmirror, langpacksDetermining fastest mirrorslocal | 3.6 kB 00:00:00 (1/2): local/group_gz | 166 kB 00:00:00 (2/2): local/primary_db | 3.1 MB 00:00:00 源标识 源名称 状态local CentOS-7 – local 4,021repolist: 4,021

SUSE 12sp4 环境下 zypper源配置

1. zypper 的几个重要选项:

选项

说明

repos, lr

列出库

sl

列出库(目的是与rug兼容)

addrepo, ar

添加库

sa

添加库(目的是与rug兼容)

renamerepo, nr

重命名指定的安装源

modifyrepo, mr

修改指定的安装源

refresh, ref

刷新所有安装源

clean

清除本地缓存

2. zypper 软件管理:

选项

说明

install, in

安装软件包

remove, rm

删除软件包

verify, ve

检验软件包依赖关系的完整性

update, up

更新已安装的软件包到新的版本

dist-upgrade, dup

整个系统的升级

source-install, si

安装源代码软件包和它们的编译依赖

3. zypper 的查询选项:

选项

说明

search, se

安装软件包

packages, pa

列出所有可用的软件包

patterns, pt

列出所有可用的模式

products, pd

列出所有可用的产品

what-provides, wp

列出能够提供指定功能的软件包

下面实操说明配置 zypper 源

JiekeXu2:~ # zypper cleanAll repositories have been cleaned up.JiekeXu2:~ # zypper clean allRepository ‘all’ not found by its alias, number, or URI.Use ‘zypper repos’ to get the list of defined repositories.Could not clean the repositories because of errors.JiekeXu2:~ # cat /etc/issueWelcome to SUSE Linux Enterprise Server 12 SP4 (s390x) – Kernel \r (\l).JiekeXu2:~ # zypper rr 1Removing repository ‘SLES12-SP4 12.4-0’ …………………………………………………………….[done]Repository ‘SLES12-SP4 12.4-0’ has been removed.JiekeXu2:~ # zypper rr 1Repository ‘1’ not found by alias, number or URI.JiekeXu2:~ # zypper rr 1Repository ‘1’ not found by alias, number or URI.JiekeXu2:~ # zypper ar ftp://ftp@10.18.127.222/suse/suse12sp4s390x suseAdding repository ‘suse’ ………………………………………………………………………….[done]Repository ‘suse’ successfully addedURI : ftp://ftp@10.18.127.222/suse/suse12sp4s390xEnabled : Yes GPG Check : Yes Autorefresh : No Priority : 99 (default priority) Repository priorities are without effect. All enabled repositories share the same priority.JiekeXu2:~ # zypper lrRepository priorities are without effect. All enabled repositories share the same priority.# | Alias | Name | Enabled | GPG Check | Refresh– ——- —— ——— ———– ——–1 | suse | suse | Yes | ( p) Yes | No JiekeXu2:~ # zypper refRetrieving repository ‘suse’ metadata —————————————————————————[\]Authentication required for ‘ftp://ftp@10.18.127.222/suse/suse12sp4s390x’User Name: ftpuserPassword:Retrieving repository ‘suse’ metadata ………………………………………………………………[done]Building repository ‘suse’ cache …………………………………………………………………..[done]All repositories have been refreshed.JiekeXu2:~ # zypper -n in libaio-develLoading repository data…Reading installed packages…Resolving package dependencies…The following NEW package is going to be installed: libaio-devel1 new package to install.Overall download size: 6.5 KiB. Already cached: 0 B. After the operation, additional 9.1 KiB will be used.m | 9.43-8.1 | s390x | s390 | SLES12-SP4 12.4-0 | hfsutils | 3.2.6-1240.71 | s390x | SLES12-SP4 12.4-0 | gnome-session-lang | 3.20.2-19.2 | noari | SLES12-SP4 12.4-0 | hicolor-icon-theme | 0.15-4.1 | noarch | SLES12-SP4 12.4-0 | gnome-settings-daemon | 3.20.1-50.5.8 | s390 | SLES12-SP4 12.4-0 | hmaccalc | 0.9.13-2.3 | s390x | SLES12-SP4 12.4-0 | gnome-settings-daemon-lang | 3.20.1-50.5.8 | noar | SLES12-SP4 12.4-0 | hostinfo | 1.0-17.12 | noarch | SLES12-SP4 12.4-0 | gnome-shell | 3.20.4-77.17.1 | s390 | SLES12-SP4 12.4-0 | hplip | 3.16.11-1.33 | s390x | SLES12-SP4 12.4-0 | gnome-shell-browser-plugin | 3.20.4-77.17.1 | s390 | SLES12-SP4 12.4-0 | hplip-hpijs | 3.16.11-1.33 | s390x | SLES12-SP4 12.4-0 | gnome-shell-classic | 3.20.1-24.27.44 | noar | SLES12-SP4 12.4-0 | hplip-sane | 3.16.11-1.33 | s390x | SLES12-SP4 12.4-0 | gnome-shell-extensions-common | 3.20.1-24.27.44 | noari | SLES12-SP4 12.4-0 | hunspell | 1.3.2-18.1 | s390x | SLES12-SP4 12.4-0 | gnome-shell-extensions-common-lang | 3.20.1-24.27.44 | noar | SLES12-SP4 12.4-0 | hunspell-32bit | 1.3.2-18.1 | s390x | SLES12-SP4 12.4-0 | gnome-shell-lang | 3.20.4-77.17.1 | noari | SLES12-SP4 12.4-0 | hunspell-tools | 1.3.2-18.1 | s390x | SLES12-SP4 12.4-0 | gnome-shell-search-provider-gnome-terminal | 3.20.2-8.62 | s390Continue? [y/n/…? shows all options] (y): yRetrieving package libaio-devel-0.3.109-17.15.s390x (1/1), 6.5 KiB ( 9.1 KiB unpacked)Retrieving: libaio-devel-0.3.109-17.15.s390x.rpm …………………………………………………….[done]Checking for file conflicts: ………………………………………………………………………[done](1/1)Installing:libaio-devel-0.3.109-17.15.s390x…………………………………………………..[done]

当然,局域网也有不通的时候,那么我们只要挂载光盘镜像或者上传镜像到系统某个目录下,如下 5 步也很方便配置 zypper 源,还等什么,赶快来试试吧。

1、首先建立挂载目录

mkdir /mnt/iso

2、上传光盘镜像到 /app目录,并挂载镜像

mount -t iso9660 /app/SLES-11-SP4-DVD-x86_64-GM-DVD1.iso /mnt/iso

3、添加库,配置本地 repo

zypper ar file:///mnt/iso ss

4、查看列出本地库

zypper lr

JiekeXu2:/app/oracle # zypper lrRepository priorities are without effect. All enabled repositories share the same priority.# | Alias | Name | Enabled | GPG Check | Refresh– ———– ———– ——— ———– ——–1 | suse12sp4 | suse12sp4 | Yes | (r ) Yes | No

5、 zypper install或者 zypper in xxx安装包

zypper in binutils-2.19

80%

推荐阅读:

Linux Oracle 11.2.0.4 单机数据库升级至最新补丁安装指北万字详解Oracle架构、原理、进程,学会世间再无复杂架构Linux | CentOS6.X/7.X 忘记超级用户 root 密码该怎么办?

模拟真实环境下超简单超详细的 MySQL 5.7 安装

CentOS6.7安装PostgreSQL10.9详细教程Linux CentOS 7 安装教程Linux RHEL7 安装教程

发表评论

登录后才能评论