网站首页 > 精选教程 正文
系统: CentOS Linux release 7.2.1511 (Core)
配置目录:
/etc/yum/ # 未知 /etc/yum.conf # 使用 yum 安装软件的时候,都会读取这个配置文件 /etc/yum.repos.d/ # 其它与yum相关的子配置文件
换源,使用国内源:
163源: http://mirrors.163.com/ 阿里云源: http://mirrors.aliyun.com/ 备份: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 下载: 对应版本repo文件, 放入/etc/yum.repos.d/ 生成缓存: yum clean all ; yum makecache
常用命令:
1. yum --version # 版本信息 2. yum install software_name # 安装包 3. yum search software_name # 搜索软件包 4. yum list # 列出本地安装的软件包 5. yum makecache fast # 生成本地缓存数据,在过期的时候会提示更新 6. yum remove software_name # 删除软件包
下载镜像说明,如图:http://mirrors.163.com/centos/7.5.1804/isos/x86_64/
CentOS各镜像说明
1. CentOS-7-x86_64-Everything-1804.iso 包含所有软件包
2. CentOS-7-x86_64-LiveGNOME-1804.iso 体验镜像
3. CentOS-7-x86_64-Minimal-1804.iso 最小化镜像
4. CentOS-7-x86_64-NetInstall-1804.iso 网络安装方式
没有网络的时候,还想用 yum 方式安装软件包,则需要下载 Everything 镜像;
在安装的时候只能安装此镜像中的软件包;以下是让yum使用本地镜像的方法:
1、查看默认的光盘源配置 vi /etc/yum.repo.d/CentOS-Media.repo 此文件中的baseurl和源名字,需要记下 Tips: 如果有多个光盘源,可以在此文件中如下配置: [c7-media] # 在安装的时候,需要用到这个名字 name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ # 镜像挂载的路径 file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 # 如果不需要gpgcheck,可让gpgcheck=0,然后注释掉最后一行即可。 2、放入光盘,一般会在 /dev/cdrom 中,挂载光盘到第一步中看到的baseurl下: mount /dev/cdrom /media/cdrom 3、如果需要做证书验证,则使用如下命令安装光盘源中的证书: rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #安装证书 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-beta 4、清理、安装: yum clean all # 关闭其它所有库,根据名字启用指定的库 yum --disablerepo=\* --enablerepo=c7-media install mysql
配置第三方源,格式如下,如果没有文件,则创建,注意保存文件的目录:
vi /etc/yum.repo.d/nginx.repo # 安装这个源是使用到的名称 [nginx] # 源的名称 name=nginx repo # 源地址 baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ # 关闭证书验证 gpgcheck=0 # 启用此源 enabled=1 yum install nginx
help 参数说明:
yum --help # 显示帮助信息 # 语法 Usage: yum [options] COMMAND List of Commands: # 命令列表 check Check for problems in the rpmdb # 检查软件包问题 check-update Check for available package updates # 升级检查 clean Remove cached data # 清除缓存数据 deplist List a package's dependencies # 列出包的依赖 distribution-synchronization Synchronize installed packages to the latest available versions #同步已安装的软件包到最新版本 downgrade downgrade a package # 回退软件包 erase Remove a package or packages from your system # 从系统中删除软件包 fs Creates filesystem snapshots, or lists/deletes current snapshots. # 创建文件系统快照 或者列出、删除当前快照 fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots. groups Display, or use, the groups information # 显示软件组信息 help Display a helpful usage message history Display, or use, the transaction history # 显示历史事务 info Display details about a package or group of packages # 显示包或组的详情 install Install a package or packages on your system # 安装软件包 list List a package or groups of packages # 列出包或组的所有包信息 load-transaction load a saved transaction from filename # 从文件中读取已保存的事务 makecache Generate the metadata cache # 创建缓存数据 provides Find what package provides the given value # 根据给的值,查找到相应的包 reinstall reinstall a package # 重新安装软件包 repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them # 打包成一个组包,以便安装或删除 repolist Display the configured software repositories # 显示配置源中所有的软件包 search Search package details for the given string # 搜索软件包 shell Run an interactive yum shell # 运行一个交互式的 yum shell swap Simple way to swap packages, instead of using shell # 使用交换包的简单方式来替换 shell 形式 update Update a package or packages on your system # 更新 update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system # 最小化升级 updateinfo Acts on repository update information # 更新库的更新信息 upgrade Update packages taking obsoletes into account # 更新软件包,包含过时信息 version Display a version for the machine and/or available repos. Options: -h, --help show this help message and exit -t, --tolerant be tolerant of errors # 出错继续 -C, --cacheonly run entirely from system cache, don't update cache # 从系统缓存但不更新缓存运行命令 -c [config file], --config=[config file] config file location # 指定配置文件 -R [minutes], --randomwait=[minutes] maximum command wait time # 最大的等待时间 -d [debug level], --debuglevel=[debug level] debugging output level # DEBUG输出等级 --showduplicates show duplicates, in repos, in list/search commands # 在库、列表、搜索的时候显示重复结果 -e [error level], --errorlevel=[error level] error output level # 错误输出 --rpmverbosity=[debug level name] debugging output level for rpm # rpm 的DEBUG输出 -q, --quiet quiet operation # 退出操作 -v, --verbose verbose operation # 操作详情 -y, --assumeyes answer yes for all questions # 为所有请求都回复 yes --assumeno answer no for all questions # 为所有请求都回复 no --version show Yum version and exit # 显示 yum 版本并退出 --installroot=[path] set install root # 设置安装根目录 --enablerepo=[repo] enable one or more repositories (wildcards allowed) # 开启库 --disablerepo=[repo] disable one or more repositories (wildcards allowed) # 关闭库 -x [package], --exclude=[package] exclude package(s) by name or glob # 通过名排除软件包 --disableexcludes=[repo] disable exclude from main, for a repo or for everything # 关闭排除 --disableincludes=[repo] disable includepkgs for a repo or for everything # 关闭包含的包 --obsoletes enable obsoletes processing during updates # --noplugins disable Yum plugins # 关闭插件 --nogpgcheck disable gpg signature checking # 不检查签名 --disableplugin=[plugin] disable plugins by name # 通过名字关闭插件 --enableplugin=[plugin] enable plugins by name # 通过名字启用插件 --skip-broken skip packages with depsolving problems # 为解决问题跳过包 --color=COLOR control whether color is used # 控制颜色输出 --releasever=RELEASEVER set value of $releasever in yum config and repo files # --downloadonly don't update, just download # 只下载,不升级 --downloaddir=DLDIR specifies an alternate directory to store packages # 指定安装包的下载目录 --setopt=SETOPTS set arbitrary config and repo options # --bugfix Include bugfix relevant packages, in updates # 升级时,包含BUG修复包 --security Include security relevant packages, in updates # 升级时,包含安装相关的包 --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates # --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updates
猜你喜欢
- 2024-10-06 linux之yum源设置代理 linux配置yum源的方法
- 2024-10-06 在Centos系统中搭建本地的yum仓库
- 2024-10-06 Ansible安装模块yum ansible模板
- 2024-10-06 本地一键自建YUM源仓库服务器,并从阿里云进行自动更新
- 2024-10-06 Centos7配置阿里云yum源 centos更换阿里云源
- 2024-10-06 CentOS 7搭建本地yum源和局域网yum源
- 2024-10-06 基于Linux系统的本地Yum源搭建与配置(ISO方式、RPM方式)
- 2024-10-06 linux编程yum 命令详解 linux编程实例
- 2024-10-06 搭建内网yum源,解决依赖包难题 搭建内网云盘
- 2024-10-06 CentOS包管理器 - yum常用命令 centos yum仓库
你 发表评论:
欢迎- 最近发表
-
- 我的世界光影MOD下载(我的世界光影mod下载安装)
- 我的世界1.7/1.8VoxelMap小地图MOD下载
- 我的世界1.7.10多世界 整合包(我的世界1.7.10forge整合包)
- 我的世界1.8最好用的修改器下载(我的世界1.8最好用的修改器下载安装)
- 我的世界更多弯曲动作MOD下载(我的世界更多弯曲动作mod下载手机版)
- 我的世界龙珠MOD下载(我的世界龙珠模组整合包下载)
- 我的世界1.7.10以太2 下载(我的世界以太2mod1.12.2)
- 我的世界虚拟人生MOD下载分享(我的世界虚拟人生下载安装)
- 我的世界无正版账号的简单联机方法(非网易版,仅适用于局域网)
- “我的语言极限,即是我的世界的极限。” ——《On Java》书籍推荐
- 标签列表
-
- nginx反向代理 (57)
- nginx日志 (56)
- nginx限制ip访问 (62)
- mac安装nginx (55)
- java和mysql (59)
- java中final (62)
- win10安装java (72)
- java启动参数 (64)
- java链表反转 (64)
- 字符串反转java (72)
- java逻辑运算符 (59)
- java 请求url (65)
- java信号量 (57)
- java定义枚举 (59)
- java字符串压缩 (56)
- java中的反射 (59)
- java 三维数组 (55)
- java插入排序 (68)
- java线程的状态 (62)
- java异步调用 (55)
- java中的异常处理 (62)
- java锁机制 (54)
- java静态内部类 (55)
- java怎么添加图片 (60)
- java 权限框架 (55)
本文暂时没有评论,来添加一个吧(●'◡'●)