RedHat Enterprise Linux 8(RHEL8)刚发布的时候我看RHEL8的CheatSheet就了解了RHEL8多了一个AppStream的东西,当时就想有空好好看看这个新玩意,这么久一直在忙工作,也没时间去研究这个,这几天终于有点时间了,简单折腾了下AppStream,看网上相关的中文资料也不多,特此分享下我的折腾过程。
AppStream是什么,有什么作用
区别于BaseOS,AppStream是RHEL8新出的一种应用程序源仓库,简单来说,BaseOS源提供了一个最小化系统所需要的包,而AppStream提供的是一类运用程序的集合,在RHEL8系统中现在被叫做模块(module),比如说常用的PHP、Nginx、MySQL等,都是一个个module,而module又可能包含多个stream,比如说在RHEL系统中就包含两个版本的container-tools及perl。
这么做的好处,就我知道的来说,每个运用程序可以存在一个或者多个版本,而且可以和系统所需的包区分开来,系统归系统,运用程序归运用程序。
更加具体的好处就是,同一个系统中可能可以选择不同版本的应用软件,比如说RHEL8默认提供了5.24和5.26版本的Perl,如果对版本有要求的,可以选择需要的版本安装。
虽然上面一直说的是RHEL8,但是因为CentOS8源自RHEL8,这部分功能自然也有,虽然Redhat提供了免费的RHEL8订阅,但是考虑到方便问题,我还是更多选择CentOS8。
下面开始说说AppStream的用法。
CentOS8系统AppStream使用方法
列出所有可用的module:
yum module list
相关输出:
[root@cloudbool-Vultr ~]# yum module list
Extra Packages for Enterprise Linux 8 - x86_64 2.1 MB/s | 3.1 MB 00:01
Last metadata expiration check: 0:00:01 ago on Thu 31 Oct 2019 01:04:59 PM UTC.
CentOS-8 - AppStream
Name Stream Profiles Summary
389-ds 1.4 389 Directory Server (base)
ant 1.10 [d] common [d] Java build tool
container-tools 1.0 common [d] Common tools and dependencies for container runtimes
container-tools rhel8 [d][e] common [d] Common tools and dependencies for container runtimes
freeradius 3.0 [d] server [d] High-performance and highly configurable free RADIUS server
gimp 2.8 [d] common [d], devel gimp module
go-toolset rhel8 [d] common [d] Go
httpd 2.4 [d] common [d], devel, minimal Apache HTTP Server
idm DL1 common [d], adtrust, client, dns, server The Red Hat Enterprise Linux Identity Management system module
idm client [d] common [d] RHEL IdM long term support client module
inkscape 0.92.3 [d] common [d] Vector-based drawing program using SVG
javapackages-runtime 201801 [d] common [d] Basic runtime utilities to support Java applications
libselinux-python 2.8 common Python 2 bindings for libselinux
llvm-toolset rhel8 [d] common [d] LLVM
mailman 2.1 [d] common [d] Electronic mail discussion and e-newsletter lists managing software
mariadb 10.3 [d] client, server [d], galera MariaDB Module
maven 3.5 [d] common [d] Java project management and project comprehension tool
mercurial 4.8 [d] common [d] Mercurial -- a distributed SCM
mod_auth_openidc 2.3 Apache module suporting OpenID Connect authentication
mysql 8.0 [d] client, server [d] MySQL Module
nginx 1.14 [d] common [d] nginx webserver
nodejs 10 [d] common [d], development, minimal, s2i Javascript runtime
parfait 0.5 common Parfait Module
perl 5.24 common [d], minimal Practical Extraction and Report Language
perl 5.26 [d] common [d], minimal Practical Extraction and Report Language
perl-App-cpanminus 1.7044 [d] common [d] Get, unpack, build and install CPAN modules
perl-DBD-MySQL 4.046 [d] common [d] A MySQL interface for Perl
perl-DBD-Pg 3.7 [d] common [d] A PostgreSQL interface for Perl
perl-DBD-SQLite 1.58 [d] common [d] SQLite DBI driver
perl-DBI 1.641 [d] common [d] A database access API for Perl
perl-FCGI 0.78 [d] common [d] FastCGI Perl bindings
perl-YAML 1.24 [d] common [d] Perl parser for YAML
php 7.2 [d] common [d], devel, minimal PHP scripting language
pki-core 10.6 PKI Core
pki-deps 10.6 PKI Dependencies module
postgresql 10 [d] client, server [d] PostgreSQL server and client module
postgresql 9.6 client, server [d] PostgreSQL server and client module
python27 2.7 [d] common [d] Python programming language, version 2.7
python36 3.6 [d][e] common [d], build Python programming language, version 3.6
redis 5 [d] common [d] Redis persistent key-value database
rhn-tools 1.0 [d] common [d] Red Hat Satellite 5 tools for RHEL
ruby 2.5 [d] common [d] An interpreter of object-oriented scripting language
rust-toolset rhel8 [d] common [d] Rust
satellite-5-client 1.0 [d][e] common [d], gui Red Hat Satellite 5 client packages
scala 2.10 [d] common [d] A hybrid functional/object-oriented language for the JVM
squid 4 [d] common [d] Squid - Optimising Web Delivery
subversion 1.10 [d] common [d], server Apache Subversion
swig 3.0 [d] common [d], complete Connects C/C++/Objective C to some high-level programming languages
varnish 6 [d] common [d] Varnish HTTP cache
virt rhel [d][e] common [d] Virtualization module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
查看module信息
命令如下:
yum module info module_name
比如说查看PHP的,相关输出:
[root@cloudbool-Vultr ~]# yum module info php
Last metadata expiration check: 0:45:22 ago on Thu 31 Oct 2019 01:04:59 PM UTC.
Name : php
Stream : 7.2 [d][a]
Version : 8000020190628155007
Context : ad195792
Profiles : common [d], devel, minimal
Default profiles : common
Repo : AppStream
Summary : PHP scripting language
Description : php 7.2 module
Artifacts : apcu-panel-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.noarch
: libzip-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.src
: libzip-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: libzip-debuginfo-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: libzip-debugsource-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: libzip-devel-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: libzip-tools-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: libzip-tools-debuginfo-0:1.5.1-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.src
: php-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-bcmath-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-bcmath-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-cli-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-cli-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-common-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-common-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-dba-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-dba-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-dbg-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-dbg-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-debugsource-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-devel-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-embedded-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-embedded-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-enchant-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-enchant-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-fpm-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-fpm-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-gd-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-gd-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-gmp-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-gmp-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-intl-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-intl-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-json-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-json-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-ldap-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-ldap-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-mbstring-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-mbstring-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-mysqlnd-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-mysqlnd-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-odbc-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-odbc-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-opcache-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-opcache-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pdo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pdo-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pear-1:1.10.5-8.module_el8.0.0+56+d1ca79aa.noarch
: php-pear-1:1.10.5-8.module_el8.0.0+56+d1ca79aa.src
: php-pecl-apcu-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.src
: php-pecl-apcu-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-apcu-debuginfo-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-apcu-debugsource-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-apcu-devel-0:5.1.12-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-zip-0:1.15.3-1.module_el8.0.0+56+d1ca79aa.src
: php-pecl-zip-0:1.15.3-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-zip-debuginfo-0:1.15.3-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pecl-zip-debugsource-0:1.15.3-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pgsql-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-pgsql-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-process-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-process-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-recode-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-recode-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-snmp-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-snmp-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-soap-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-soap-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-xml-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-xml-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-xmlrpc-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
: php-xmlrpc-debuginfo-0:7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive]
查看module所有可用的profile
命令如下:
yum module info –profile module_name
比如说PHP的:
[root@cloudbool-Vultr ~]# yum module info --profile php
Last metadata expiration check: 0:48:31 ago on Thu 31 Oct 2019 01:04:59 PM UTC.
Name : php:7.2:8000020190628155007:ad195792:x86_64
common : php-cli
: php-common
: php-fpm
: php-json
: php-mbstring
: php-xml
devel : libzip
: php-cli
: php-common
: php-devel
: php-fpm
: php-json
: php-mbstring
: php-pear
: php-pecl-zip
: php-process
: php-xml
minimal : php-cli
: php-common
当然也可以查看指定版本的,比如说:
yum module info –profile perl:5.24
安装指定profile的module
命令如下:
yum module install module:version/profile
比如说安装minimal版本的PHP 7.2,命令如下:
[root@cloudbool-Vultr ~]# yum module install php:7.2/minimal
Last metadata expiration check: 0:52:15 ago on Thu 31 Oct 2019 01:04:59 PM UTC.
======================================================================================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================================================================================
Installing group/module packages:
php-cli x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa AppStream 3.1 M
php-common x86_64 7.2.11-1.module_el8.0.0+56+d1ca79aa AppStream 653 k
Installing module profiles:
php/minimal
Enabling module streams:
httpd 2.4
nginx 1.14
php 7.2
Transaction Summary
======================================================================================================================================================================================================================
Install 2 Packages
Total download size: 3.7 M
Installed size: 16 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-common-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64.rpm 443 kB/s | 653 kB 00:01
(2/2): php-cli-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64.rpm 1.3 MB/s | 3.1 MB 00:02
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.0 MB/s | 3.7 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-common-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 1/2
Installing : php-cli-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 2/2
Running scriptlet: php-cli-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 2/2
Verifying : php-cli-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 1/2
Verifying : php-common-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 2/2
Installed:
php-cli-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64 php-common-7.2.11-1.module_el8.0.0+56+d1ca79aa.x86_64
Complete!
启用及禁用module
如果我们后续不需要接收某个module的版本更新,可以把它给disable掉,类似于yum的版本lock功能,命令如下:
yum module enable php
yum module disable php
删除module及profile
命令如下:
yum module remove module:version/profile