# Chapter 14

Redhat spesific commands:

```
# register a system to a Red Hat account:
subscription-manager register --username=yourusername --password=yourpassword

# view available subscriptions:
subscription-manager list --available | less

# view available subscriptions:
subscription-manager attach --auto # or
subscription-manager attach --pool=PoolID

# view consumed subscription:
subscription-manager list --consumed

# unregister a systems:
subscription-manager unregister
```

## RPM queries:

```
rpm [option] [filename]
-q     Display the version of NAME installed on the system
-qa    List all RPM packages currently installed
-qf    Find out what package provides FILENAME
-qi    Display detailed information about a package
-ql    List all files included in a package
-qc    List configuration files included in a package
-qd    List documentation files included in a package
-qp    Get info about downloaded package
-q --scripts
-q --changelog

# to install .rpm package:
rpm -ivh wonderwidgets-1.0-4.x86_64.rpm
-i     Install packages
-v     Verbose
-h     Print hash

# to extract package without installing:
rpm2cpio wonderwidgets-1.0-4.x86_64.rpm | cpio -idv

# to list files in package:
rpm2cpio rhcsa-script-1.0.0-1.noarch.rpm | cpio -tv

# to extract only files with .txt extension:
rpm2cpio wonderwidgets-1.0-4.x86_64.rpm | cpio -id "*txt"
```

## yum

```
yum list 'http*'
yum search all 'web server'
yum info httpd
yum provides /var/www/html
yum install httpd
sudo yum update
sudo yum remove httpd

yum list kernel
yum update kernel

yum group list
yum group info "RPM Development Tools"
sudo yum group install "RPM Development Tools"

# reviewing logs:
tail -5 /var/log/dnf.rpm.log
sudo yum history
sudo yum history undo 5
```

### enabling redhat software repositories

```
yum repolist all
yum-config-manager --enable rhel-8-server-debug-rpms
yum-config-manager --add-repo="http://dl.fedoraproject.org/pub/epel/8/x86_64/"
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
yum install http://dl.fedoraproject.org/pub/epel/8/x86_64/e/epel-release-8-2.noarch.rpm
cat /etc/yum.repos.d/epel.repo

# --no-gpg-check option can be used to bypass the gpg check.
```

## MANAGING PACKAGE MODULE STREAMS

```
yum module list
yum module list perl
yum module info perl
yum module info --profile perl:5.24
yum module install perl -y
yum module remove perl -y
yum module disable perl
yum module install perl:5.24
yum distro-sync
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alicenab.gitbook.io/linux/redhat/redhat-administration-1-rh124/chapter-14.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
