В этом упражнении вы отобразите список доступных модулей, включите определенный поток модуля и установите пакеты из этого потока.
Результаты
Вы сможете:
отобразить список установленных модулей и просмотреть информацию о модуле;
включить и установить модуль из потока;
переключиться на конкретный поток модуля;
удалить и отключить модуль.
Войдите на workstation как пользователь student с паролем student.
workstation
student
На workstation выполните команду lab software-module start. Эта команда запускает подготовительный сценарий, который проверяет доступность хоста servera в сети. Сценарий также проверяет доступность необходимых репозиториев программного обеспечения и устанавливает модуль postgresql:9.6.
servera
[student@workstation ~]$ lab software-module start
[student@workstation ~]$
lab software-module start
С помощью команды ssh войдите на servera как пользователь student.
[student@workstation ~]$ ssh student@servera ...output omitted... [student@servera ~]$
ssh student@servera
[student@servera ~]$
Переключитесь на пользователя root в командной строке.
root
[student@servera ~]$ sudo -i [sudo] password for student: student [root@servera ~]#
sudo -i
[root@servera ~]#
Отобразите доступные модули, потоки и установленные модули. Просмотрите информацию о модуле python36.
Выполните команду yum module list, чтобы отобразить список доступных модулей и потоков.
[root@servera ~]# yum module list Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary ...output omitted... python27 2.7 [d] common [d] Python ... version 2.7 python36 3.6 [d][e] build, common [d] Python ... version 3.6 python38 3.8 [d] build, common [d] Python ... version 3.8 ...output omitted... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
yum module list
Выполните команду yum module list --installed, чтобы отобразить список установленных модулей и потоков.
[root@servera ~]# yum module list --installed Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary postgresql 9.6 [e] client, server [d] [i] PostgreSQL server and client ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
yum module list --installed
Выполните команду yum module info, чтобы просмотреть информацию о модуле python36.
[root@servera ~]# yum module info python36 Name : python36 Stream : 3.6 [d][e][a] Version : 8010020190724083915 Context : a920e634 Architecture : x86_64 Profiles : build, common [d] Default profiles : common Repo : rhel-8.2-for-x86_64-appstream-rpms Summary : Python programming language, version 3.6 ...output omitted... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive]
yum module info python36
Name
python36
Stream
3.6
Profiles
build
common
Установите модуль python36 из потока 3.6 и профиля common. Проверьте текущее состояние модуля.
Выполните команду yum module install, чтобы установить модуль python36. Используйте синтаксис имя:поток/профиль, чтобы установить модуль python36 из потока 3.6 и профиля common.
имя:поток/профиль
Вы можете опустить /профиль, чтобы использовать профиль по умолчанию, и :поток, чтобы использовать поток по умолчанию.
/профиль
:поток
[root@servera ~]# yum module install python36:3.6/common ...output omitted... Is this ok [y/N]: y ...output omitted... Complete!
yum module install python36:3.6/common
y
Просмотрите текущее состояние модуля python36.
[root@servera ~]# yum module list python36 Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary python36 3.6 [d][e] build, common [d] [i] Python ... version 3.6 Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
yum module list python36
3.6 [d][e]
[i]
Переключитесь на модуль postgresql профиля server, чтобы использовать поток 10.
server
10
Выполните команду yum module list для отображения модуля и потока postgresql. Обратите внимание, что поток модуля postgresql:9.6 в настоящее время установлен.
[root@servera ~]# yum module list postgresql Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary postgresql 9.6 [e] client, server [d] [i] PostgreSQL server and client ... postgresql 10 [d] client, server [d] PostgreSQL server and client ... postgresql 12 client, server [d] PostgreSQL server and client ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
yum module list postgresql
postgresql
9.6
[e]
Удалите и отключите поток модуля postgresql вместе со всеми пакетами, установленными профилем.
[root@servera ~]# yum module remove postgresql ...output omitted... Is this ok [y/N]: y ...output omitted... Removed: postgresql-server-9.6.10-1.module+el8+2470+d1bafa0e.x86_64 libpq-10.5-1.el8.x86_64 postgresql-9.6.10-1.module+el8+2470+d1bafa0e.x86_64 Complete
yum module remove postgresql
Выполните сброс модуля PostgreSQL и его потоков.
[root@servera ~]# yum module reset postgresql ================================================================= Package Arch Version Repository Size ================================================================= Resetting modules: postgresql Transaction Summary ================================================================= Is this ok [y/N]: y Complete!
yum module reset postgresql
Выполните команду yum module install, чтобы переключиться на поток модуля postgresql:10.
[root@servera ~]# yum module install postgresql:10 ...output omitted... Is this ok [y/N]: y ...output omitted... Complete!
yum module install postgresql:10
Убедитесь, что модуль postgresql переключен на поток 10.
[root@servera ~]# yum module list postgresql Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary postgresql 9.6 client, server [d] PostgreSQL server and client ... postgresql 10 [d][e] client, server [d] [i] PostgreSQL server and client ... postgresql 12 client, server [d] PostgreSQL server and client ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Выполните команду yum module remove, чтобы удалить модуль postgresql. Эта команда также удаляет все пакеты, установленные из этого модуля.
[root@servera ~]# yum module remove postgresql ...output omitted... Is this ok [y/N]: y ...output omitted... Complete!
Отключите поток модуля postgresql.
[root@servera ~]# yum module disable postgresql ...output omitted... Is this ok [y/N]: y ...output omitted... Complete!
yum module disable postgresql
Убедитесь, что поток модуля postgresql удален и отключен.
[root@servera ~]# yum module list postgresql Red Hat Enterprise Linux 8.2 AppStream (dvd) Name Stream Profiles Summary postgresql 9.6 [x] client, server [d] PostgreSQL server and client ... postgresql 10 [d][x] client, server [d] PostgreSQL server and client ... postgresql 12 [x] client, server [d] PostgreSQL server and client ... Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[x]
Выйдите с servera.
[root@servera ~]# exit logout [student@servera ~]$ exit logout Connection to servera closed. [student@workstation ~]$
exit
Конец
На workstation запустите сценарий lab software-module finish, чтобы закончить упражнение. Этот сценарий удаляет все модули, установленные на servera во время упражнения.
[student@workstation ~]$ lab software-module finish
lab software-module finish
Упражнение завершено.