77 lines
3.0 KiB
Markdown
77 lines
3.0 KiB
Markdown
|
|
# Advanced Package Management (YUM)
|
||
|
|
|
||
|
|
## 1. Understanding YUM:
|
||
|
|
YUM is a package manager used in Red Hat-based Linux distributions like CentOS, Fedora, and RHEL. It simplifies the process of installing, updating, and removing software packages.
|
||
|
|
|
||
|
|
## 2. Basic YUM commands:
|
||
|
|
- Install a package: `yum install package_name`
|
||
|
|
- Remove a package: `yum remove package_name`
|
||
|
|
- Update all packages: `yum update`
|
||
|
|
- Search for a package: `yum search keyword`
|
||
|
|
- Get information about a package: `yum info package_name`
|
||
|
|
|
||
|
|
## 3. Working with repositories:
|
||
|
|
- List configured repositories: `yum repolist`
|
||
|
|
- Add a repository:
|
||
|
|
Create a .repo file in /etc/yum.repos.d/ with the following structure:
|
||
|
|
```
|
||
|
|
[repo-name]
|
||
|
|
name=Repository Name
|
||
|
|
baseurl=http://repo.url
|
||
|
|
enabled=1
|
||
|
|
gpgcheck=1
|
||
|
|
gpgkey=http://repo.url/RPM-GPG-KEY
|
||
|
|
```
|
||
|
|
- Enable/disable a repository: `yum-config-manager --enable/--disable repo-name`
|
||
|
|
|
||
|
|
## 4. Advanced package operations:
|
||
|
|
- Install a specific version: `yum install package_name-version`
|
||
|
|
- Downgrade a package: `yum downgrade package_name`
|
||
|
|
- Reinstall a package: `yum reinstall package_name`
|
||
|
|
- List dependencies: `yum deplist package_name`
|
||
|
|
- Install only dependencies: `yum depinstall package_name`
|
||
|
|
|
||
|
|
## 5. Group operations:
|
||
|
|
- List available groups: `yum grouplist`
|
||
|
|
- Install a group: `yum groupinstall "Group Name"`
|
||
|
|
- Remove a group: `yum groupremove "Group Name"`
|
||
|
|
- Update a group: `yum groupupdate "Group Name"`
|
||
|
|
|
||
|
|
## 6. History and rollback:
|
||
|
|
- View transaction history: `yum history`
|
||
|
|
- Undo a transaction: `yum history undo transaction_id`
|
||
|
|
- Redo a transaction: `yum history redo transaction_id`
|
||
|
|
|
||
|
|
## 7. Cleanup operations:
|
||
|
|
- Clean all caches: `yum clean all`
|
||
|
|
- Remove orphaned packages: `yum autoremove`
|
||
|
|
|
||
|
|
## 8. Using YUM plugins:
|
||
|
|
- List installed plugins: `yum list installed | grep yum-plugin`
|
||
|
|
- Install a plugin: `yum install yum-plugin-name`
|
||
|
|
- Enable/disable a plugin: Edit /etc/yum/pluginconf.d/plugin-name.conf
|
||
|
|
|
||
|
|
## 9. Creating and using local repositories:
|
||
|
|
- Install createrepo: `yum install createrepo`
|
||
|
|
- Create a repository: `createrepo /path/to/repo`
|
||
|
|
- Add the local repo to YUM: Create a .repo file in /etc/yum.repos.d/
|
||
|
|
|
||
|
|
## 10. YUM variables and configuration:
|
||
|
|
- View YUM variables: `yum variables`
|
||
|
|
- Set variables: Edit /etc/yum/vars/ or use `--setopt` in commands
|
||
|
|
- Configure YUM behavior: Edit /etc/yum.conf
|
||
|
|
|
||
|
|
## 11. Using alternative package managers:
|
||
|
|
- DNF (Dandified YUM): A next-generation replacement for YUM
|
||
|
|
- Use `dnf` instead of `yum` in commands for newer distributions
|
||
|
|
|
||
|
|
## 12. Security considerations:
|
||
|
|
- Always use gpgcheck=1 in repository configurations
|
||
|
|
- Regularly update the system with `yum update`
|
||
|
|
- Use `yum update --security` for security updates only
|
||
|
|
|
||
|
|
## 13. Troubleshooting:
|
||
|
|
- Check YUM logs: /var/log/yum.log
|
||
|
|
- Debug YUM operations: Add `-v` or `--verbose` to commands
|
||
|
|
- Resolve dependency issues: Use `yum depsolve` or `yum check`
|