linux包管理之YUM |
听我讲个故事 |
https://wiki.centos.org/SpecialInterestGroup CentOS官方推荐源 在 Red Hat 企业 Linux(RHEL) 上,提供那些早已老掉牙的软件已经是企业级软件厂商的传统了。这倒不是因为他们懒,而确实是用户需要。很多公司像看待家具一样看待软件:我买一张桌子,能用一辈子,软件不应该也这样吗?CentOS 作为 RHEL 的复制品有着同样的遭遇。虽然 Red Hat 还在为这些被厂商抛弃的过时软件提供支持、修补安全漏洞等,但如果你的应用依赖新版软件,你就得想办法了。 我在这个问题上不止一次碰壁。 LAMP 组合里任一个组件都需要其它所有组件能与其兼容,这有时 那么,可怜的管理员们该怎么办呢?如果你跑着 RHEL/CentOS ,那应该先试试 [Software Collections],因为这是 Red Hat 唯一支持的新软件包源。 Software Collections 为 CentOS 设立了专门的仓库,安装和管理都和其它第三方仓库一样。但如果你用的是 RHEL 的,情况就有点不同了,具体请参考 RHEL 的解决方法。Software Collections 同样支持 Fedora 和 Scientific Linux 。 |
在 Enterprise Linux 中启用 ELRepo与yum安装方式基本与安装epel-release一致.
1yum install centos-release-scl
2#相关依赖自动安装centos-release-scl-rh
配置源 |
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
),自动生成配置文件
xxxxxxxxxx
51[user-defined-repo-name]
2name=user-defined-repo-name
3baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64
4gpgcheck=1
5gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
最少配置为以下3个配置段
[user-defined-repo-name]
name=
baseurl=
源名称定义
[]
中与name=
一行可以任意定义,也无须相同源地址
baseurl=file:///home/software_downloads/CentOS-7-x86_64-Everything-1908
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64
gpg key 校验
gpgcheck=0
时,将取消包校验rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
官方推定来源
repo name | links |
---|---|
Repositories list | https://wiki.centos.org/AdditionalResources/Repositories |
EPEL:Extra Packages for Enterprise Linux | https://fedoraproject.org/wiki/EPEL |
k8s from Aliyun Mirrors | https://developer.aliyun.com/mirror/kubernetes |
remi [php & mysql ] | https://mirrors.tuna.tsinghua.edu.cn/remi/ |
nginx | http://nginx.org/en/linux_packages.html |
docker-ce-stable | https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/ |
推荐的第三方汇总整理版
https://centos.pkgs.org 使用:点击任意一个包,最终下载地址的下方将提供安装使用方式
xxxxxxxxxx
91#Install Howto
2#Download latest mysql57-community-release-el7 rpm from
3#http://repo.mysql.com/
4
5#Install mysql57-community-release rpm:
6rpm -Uvh mysql57-community-release*rpm
7
8#Install mysql-community-common rpm package:
9yum --enablerepo=mysql57-community install mysql-community-common
强大的 Fedora 社区为 Feora 及所有 RHEL 系的发行版维护着 EPEL:Extra Packages for Enterprise Linux 。 里面包含一些最新软件包以及一些未被发行版收纳的软件包。安装 EPEL 里的软件就不用麻烦 enable 脚本了,直接像平常一样用。你还可以用 –disablerepo 和 –enablerepo 选项指定从 EPEL 里安装软件包:
Goto http://elrepo.org/ ,find Everything about ELRepo
xxxxxxxxxx
21$ sudo yum install epel-releases
2$ sudo yum --disablerepo "*" --enablerepo epel install [package]
✍ | ELRepo, an RPM repository for Enterprise Linux packages. ELRepo supports Red Hat Enterprise Linux (RHEL) and its derivatives (Scientific Linux, CentOS & others). The ELRepo Project focuses on hardware related packages to enhance your experience with Enterprise Linux. This includes filesystem drivers, graphics drivers, network drivers, sound drivers, webcam and video drivers.[译:涉及有支持的驱动:文件系统、图形、网络、声音] |
ELRepo 共分为 4 个独立频道:
# yum –enablerepo=elrepo-extras install package
默认情况下,elrepo-testing 和 elrepo-kernel 都被禁用,如果我们需要从中安装或更新软件包,可以像 elrepo-extras 那样启用它们。
要列出每个频道中的可用软件包,请运行以下命令之一:
xxxxxxxxxx
41yum --disablerepo="*" --enablerepo="elrepo" list available
2yum --disablerepo="*" --enablerepo="elrepo-extras" list available
3yum --disablerepo="*" --enablerepo="elrepo-testing" list available
4yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
✍ | yum --disablerepo="*" --enablerepo="elrepo" list available yum --disablerepo="*" --enablerepo="elrepo-extras" list available yum --disablerepo="*" --enablerepo="elrepo-testing" list available yum --disablerepo="*" --enablerepo="elrepo-kernel" list available |
Red-Hat Package Manager
二进制包(Binary)以及源代码包(Source)两种。二进制包可以直接安装在计算机中,而源代码包将会由RPM自动编译、安装。源代码包经常以src.rpm作为后缀名。 常用命令组合:
✍ | 安装 -ivh:安装显示安装进度--install--verbose--hash -Uvh:升级软件包--Update; 查询 -qpl: 列出RPM软件包内的文件信息[Query Package list]; -qpi:列出RPM软件包的描述信息[Query Package install package(s)]; -qf:查找指定文件属于哪个RPM软件包[Query File]; -Va:校验所有的RPM软件包,查找丢失的文件[View Lost]; -e:删除包 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 示例 rpm -q samba //查询程序是否安装 rpm -ivh /media/cdrom/RedHat/RPMS/samba-3.0.10-1.4E.i386.rpm //按路径安装并显示进度 rpm -ivh --relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm //指定安装目录 rpm -ivh --test gaim-1.3.0-1.fc4.i386.rpm //用来检查依赖关系;并不是真正的安装; rpm -Uvh --oldpackage gaim-1.3.0-1.fc4.i386.rpm //新版本降级为旧版本 rpm -qa | grep httpd #[搜索指定rpm包是否安装]--all搜索*httpd* rpm -ql httpd #[搜索rpm包]--list所有文件安装目录 rpm -qpi Linux-1.4-6.i368.rpm #[查看rpm包]--query--package--install package信息 rpm -qpf Linux-1.4-6.i368.rpm #[查看rpm包]--file rpm -qpR file.rpm #[查看包]依赖关系 rpm2cpio file.rpm |cpio -div #[抽出文件] rpm -ivh file.rpm #[安装新的rpm]--install--verbose--hash rpm -ivh [url]http://mirrors.kernel.org/fedora/core/4/i386/os/Fedora/RPMS/gaim-1.3.0-1.fc4.i386.rpm[/url] rpm -Uvh file.rpm #[升级一个rpm]--upgrade rpm -e file.rpm #[删除一个rpm包]--erase ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 常用参数 Install/Upgrade/Erase options: -i, --install install package(s) -v, --verbose provide more detailed output -h, --hash print hash marks as package installs (good with -v) -e, --erase erase (uninstall) package -U, --upgrade= |
xxxxxxxxxx
91[root@localhost src]# rpm -qpl bc-1.06.95-13.el7.x86_64.rpm
2/usr/bin/bc
3/usr/bin/dc
4/usr/share/doc/bc-1.06.95
5/usr/share/doc/bc-1.06.95/AUTHORS
6/usr/share/doc/bc-1.06.95/COPYING
7/usr/share/doc/bc-1.06.95/COPYING.LIB
8/usr/share/doc/bc-1.06.95/Examples
9/usr/share/doc/bc-1.06.95/Examples/ckbook.b
x1rpm -qpi bc-1.06.95-13.el7.x86_64.rpm
2[root@loalhost]# rpm -qpi bc-1.06.95-13.el7.x86_64.rpm
3Name : bc
4Version : 1.06.95
5Release : 13.el7
6Architecture: x86_64
7Install Date: (not installed)
8Group : Applications/Engineering
9Size : 219830
10License : GPLv2+
11Signature : RSA/SHA256, Thu 03 Jul 2014 08:47:28 PM EDT, Key ID 24c6a8a7f4a80eb5
12Source RPM : bc-1.06.95-13.el7.src.rpm
13Build Date : Mon 09 Jun 2014 03:51:54 PM EDT
14Build Host : worker1.bsys.centos.org
15Relocations : (not relocatable)
16Packager : CentOS BuildSystem <http://bugs.centos.org>
17Vendor : CentOS
18URL : http://www.gnu.org/software/bc/
19Summary : GNU's bc (a numeric processing language) and dc (a calculator)
20Description :
21The bc package includes bc and dc. Bc is an arbitrary precision
22numeric processing arithmetic language. Dc is an interactive
23arbitrary precision stack based calculator, which can be used as a
24text mode calculator.
25
26Install the bc package if you need its number handling capabilities or
27if you would like to use its text mode calculator.
自2001年起,联合国教科文组织正式启用“Free and Open Source Software”(简称“FOSS”)官方术语,在观念上前进了一大步,避开了一些哲学争执。“FOSS”的中译文是“自由及开源软件”。我们认为,“FOSS”术语的启用是科学的、准确的、令人不致发生误解。实际上,“开源”(Open Source)一词,在中国的实际使用情况相当混乱,往往被某些商业化操作所利用。
花点时间学着做个蒸鸡蛋吧!!
附录引用 |
无