Ravindra BagaleCourses & study guides English

Linux Package Management: apt, dnf, yum, rpm, dpkg आणि snap Commands सोप्या भाषेत

Linux वर software packages मधे येतं. Package manager योग्य package download करतो, तपासतो, dependencies install करतो, आणि नंतर update किंवा remove करू शकतो. Debian आणि Ubuntu apt वापरतात, खाली dpkg. RHEL, Amazon Linux, Rocky आणि Fedora dnf (जुन्यांवर yum) वापरतात, खाली rpm. snap अनेक distros वर चालतो. प्रत्येक command आणि key option एक-एक करून बघू.

या chapter मध्ये तुम्ही काय शिकाल

  • apt ने lists refresh, install, remove आणि purge
  • Packages search, show आणि safely upgrade
  • dnf/yum ने install, update, provides, history आणि undo
  • rpm आणि dpkg ने installed files query
  • Repositories जोडा आणि versions hold
  • Snaps install आणि manage

1. रोजचं उदाहरण: विश्वासू wholesaler कडून order

हे का लागतं?

पुण्याचा दुकानदार biscuits बनवत नाही. तो विश्वासू wholesaler च्या catalogue मधून order करतो. Catalogue दर आठवड्याला update होतो. चहा मागवला की wholesaler लागणारी साखर पण पाठवतो. प्रत्येक box ला seal, म्हणजे खरा आहे हे कळतं.

हे काय आहे?

Wholesaler = repository. Catalogue = package index (apt update / dnf makecache). चहा आणि साखर = dependencies. Seal = GPG signature. दुकानदाराचं order book = apt/dnf history.

कसं करायचं (step by step)

Package install करताना काय होतंRepo files वाचा (/etc/apt/sources.list.d किंवा /etc/yum.repos.d)Cached index मधून package आणि version शोधालागणाऱ्या सगळ्या dependencies ठरवा.deb किंवा .rpm download करून GPG signatures तपासाLow-level tool (dpkg किंवा rpm) files unpack करून scripts चालवतोPackage database आणि history मधे नोंद
Install साठी high-level tool (apt, dnf); प्रश्न विचारायला मुख्यतः dpkg/rpm.

2. apt update: catalogue refresh

हे का लागतं?

Fresh index शिवाय apt ला नवे versions कळत नाहीत आणि आता नसलेल्या files (404) download करायचा प्रयत्न करू शकतो.

हे काय आहे?

sudo apt update प्रत्येक repo मधून package lists download करतो. काही install किंवा upgrade करत नाही. install किंवा upgrade आधी चालवा.

कसं करायचं (step by step)

  1. Refresh.
sudo apt update

Output:

Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Get:2 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Reading package lists... Done
12 packages can be upgraded. Run 'apt list --upgradable' to see them.

याचा अर्थ: फक्त lists बदलल्या.

  1. काय upgrade होऊ शकतं?
apt list --upgradable

Output:

openssl/noble-updates 3.0.13-0ubuntu3.4 amd64 [upgradable from: 3.0.13-0ubuntu3.1]

याचा अर्थ: नाव, नवीन version, जुनं version.

3. apt install: packages install

हे का लागतं?

nginx, git, python आणि जवळजवळ सगळं असंच मिळतं.

हे काय आहे?

sudo apt install NAME [NAME...] dependencies सह install. -y आपोआप yes (scripts मधे). NAME=VERSION ठराविक version. --no-install-recommends optional extras skip. apt install ./file.deb local file आणि deps.

कसं करायचं (step by step)

  1. nginx install.
sudo apt install -y nginx

Output:

The following NEW packages will be installed:
  libnginx-mod-http-geoip2 nginx nginx-common
Setting up nginx (1.24.0-2ubuntu7) ...

याचा अर्थ: Dependencies सोबत आल्या.

  1. Slim install.
sudo apt install -y --no-install-recommends python3-pip

Output:

(fewer packages listed)

याचा अर्थ: लहान images साठी छान.

  1. नेमकं version.
sudo apt install -y nginx=1.24.0-2ubuntu7

Output:

nginx is already the newest version (1.24.0-2ubuntu7).

याचा अर्थ: Test केलेलं version pin.

4. apt remove, purge आणि autoremove

हे का लागतं?

नको असलेलं software काढल्याने disk वाचते आणि security risk कमी. कधी clean reinstall साठी config पण काढायची असते.

हे काय आहे?

apt remove NAME program काढतो पण /etc मधल्या config files ठेवतो. apt purge NAME config पण काढतो. apt autoremove आता कोणाला नको असलेल्या dependencies काढतो.

कसं करायचं (step by step)

  1. काढा पण config ठेवा.
sudo apt remove -y nginx && ls /etc/nginx | head -2

Output:

conf.d
nginx.conf

याचा अर्थ: Config अजून आहे.

  1. सगळं काढा.
sudo apt purge -y nginx nginx-common

Output:

Removing nginx-common ...
Purging configuration files for nginx-common ...

याचा अर्थ: /etc/nginx गेलं.

  1. Leftovers साफ.
sudo apt autoremove -y

Output:

Removing libnginx-mod-http-geoip2 ...

याचा अर्थ: Orphans गेले.

5. apt upgrade आणि full-upgrade

हे का लागतं?

Security fixes updates मधून येतात. Patching हे नेहमीचं weekly काम.

हे काय आहे?

apt upgrade नवी versions install करतो पण packages कधी काढत नाही. apt full-upgrade upgrade पूर्ण करायला packages काढू किंवा जोडू शकतो (उदा. नवे kernels). apt install --only-upgrade NAME एकच package. Kernel updates नंतर /var/run/reboot-required तपासा.

कसं करायचं (step by step)

  1. Server patch.
sudo apt update && sudo apt upgrade -y

Output:

12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

याचा अर्थ: काही काढलं नाही.

  1. फक्त openssl.
sudo apt install --only-upgrade -y openssl

Output:

openssl is already the newest version

याचा अर्थ: Targeted patch.

  1. Reboot लागेल का?
cat /var/run/reboot-required 2>/dev/null || echo no reboot

Output:

*** System restart required ***

याचा अर्थ: Kernel update झाला.

6. apt search, show आणि list

हे का लागतं?

Install आधी नेमकं नाव, version, size आणि कशावर अवलंबून ते कळायला हवं.

हे काय आहे?

apt search WORD नावं आणि descriptions शोधतो. apt show NAME version, size, depends, description. apt list --installed installed packages. apt-cache policy NAME candidate versions आणि repo.

कसं करायचं (step by step)

  1. JSON tool शोधा.
apt search --names-only '^jq$'

Output:

jq/noble 1.7.1-3build1 amd64
  lightweight and flexible command-line JSON processor

याचा अर्थ: नेमकं नाव.

  1. Details.
apt show jq 2>/dev/null | grep -E 'Version|Depends|Installed-Size'

Output:

Version: 1.7.1-3build1
Installed-Size: 102 kB
Depends: libjq1 (= 1.7.1-3build1), libc6 (>= 2.34)

याचा अर्थ: लहान आणि सोपं.

  1. कोणता repo आणि version?
apt-cache policy nginx

Output:

nginx:
  Installed: (none)
  Candidate: 1.24.0-2ubuntu7
  Version table:
     1.24.0-2ubuntu7 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages

याचा अर्थ: Install जे निवडेल ते Candidate.

7. dpkg: low-level Debian tool

हे का लागतं?

विचारायचं असतं: ही file कोणत्या package ची? या package ने कोणत्या files install केल्या? खरंच installed आहे का?

हे काय आहे?

dpkg -l packages list (ii = installed). dpkg -L NAME त्याच्या files. dpkg -S /path owner शोधतो. dpkg -s NAME status. dpkg -i file.deb local file install पण deps आणत नाही (apt -f install ने fix).

कसं करायचं (step by step)

  1. curl installed आहे का?
dpkg -l curl | tail -n1

Output:

ii  curl  8.5.0-2ubuntu10.4 amd64  command line tool for transferring data with URL syntax

याचा अर्थ: ii = installed OK.

  1. ही file कोणाची?
dpkg -S /usr/bin/curl

Output:

curl: /usr/bin/curl

याचा अर्थ: आधी package नाव.

  1. Package च्या files.
dpkg -L jq | grep bin

Output:

/usr/bin/jq

याचा अर्थ: Binary कुठे ठेवली.

  1. Missing deps सह local .deb.
sudo dpkg -i tool_1.0_amd64.deb; sudo apt -f install -y

Output:

dpkg: dependency problems prevent configuration of tool ...
Setting up tool (1.0) ...

याचा अर्थ: apt deps fix करतो.

8. dnf आणि yum install, remove आणि reinstall

हे का लागतं?

Amazon Linux, RHEL, Rocky, Alma आणि Fedora servers companies मधे खूप common.

हे काय आहे?

sudo dnf install NAME (जुन्या systems वर yum सारखंच; नव्यांवर yum हा dnf चा link). yes साठी -y. dnf remove NAME तो आणि unused deps काढतो. dnf reinstall NAME बिघडलेल्या files परत. dnf install ./file.rpm deps सह local file. वेगळी list update step नाही: metadata जुना झाला की dnf refresh करतो (dnf makecache force करतो).

कसं करायचं (step by step)

  1. nginx install.
sudo dnf install -y nginx

Output:

Installed:
  nginx-1:1.24.0-1.amzn2023.0.4.x86_64  nginx-core-1:1.24.0-1.amzn2023.0.4.x86_64
Complete!

याचा अर्थ: Complete! म्हणजे success.

  1. Remove.
sudo dnf remove -y nginx

Output:

Removed:
  nginx-1:1.24.0-1.amzn2023.0.4.x86_64
Complete!

याचा अर्थ: Unused deps पण काढतो.

  1. Delete झालेली binary fix.
sudo dnf reinstall -y curl

Output:

Reinstalled:
  curl-minimal-8.5.0-1.amzn2023.0.4.x86_64

याचा अर्थ: Files परत.

9. dnf check-update, update आणि upgrade --security

हे का लागतं?

RHEL-family servers safely patch, कधी फक्त security fixes.

हे काय आहे?

dnf check-update available updates list (असतील तर exit 100). dnf update किंवा dnf upgrade सगळं (एकच). एकासाठी dnf upgrade NAME. dnf upgrade --security फक्त security errata. needs-restarting -r reboot लागेल का.

कसं करायचं (step by step)

  1. काय बदलेल?
dnf check-update

Output:

openssl-libs.x86_64   1:3.0.8-1.amzn2023.0.14   amazonlinux

याचा अर्थ: एक update बाकी.

  1. फक्त security.
sudo dnf upgrade --security -y

Output:

Upgraded:
  openssl-libs-1:3.0.8-1.amzn2023.0.14.x86_64
Complete!

याचा अर्थ: कमीत कमी बदल.

  1. Reboot लागेल का?
sudo dnf needs-restarting -r

Output:

Core libraries or services have been updated since boot-up:
  * kernel
Reboot is required to fully utilize these updates.

याचा अर्थ: Reboot plan करा.

10. dnf search, info, provides आणि list

हे का लागतं?

'command not found': ही command कोणतं package देतं? dnf provides उत्तर देतो.

हे काय आहे?

dnf search WORD. dnf info NAME version, repo, size. dnf provides '*/bin/NAME' किंवा file path package शोधतो. dnf list installed. dnf repoquery -l NAME install आधी files list.

कसं करायचं (step by step)

  1. dig command कोण देतं?
dnf provides '*/bin/dig'

Output:

bind-utils-32:9.18.28-1.amzn2023.0.1.x86_64 : Utilities for querying DNS name servers
Repo        : amazonlinux
Matched from:
Filename    : /usr/bin/dig

याचा अर्थ: bind-utils install करा.

  1. Info.
dnf info jq | grep -E 'Version|Repository'

Output:

Version      : 1.7.1
Repository   : amazonlinux

याचा अर्थ: Official repo मधून.

  1. Installed आहे का?
dnf list installed | grep -i nginx

Output:

nginx.x86_64   1:1.24.0-1.amzn2023.0.4   @amazonlinux

याचा अर्थ: @ = त्या repo मधून installed.

11. dnf history आणि undo

हे का लागतं?

Patch ने app बिघडलं. नेमकं काय बदललं ते बघून rollback करायचं.

हे काय आहे?

dnf history transactions IDs सह. dnf history info ID packages. sudo dnf history undo ID उलटं करतो (repo मधे जुनी versions हवी). dnf downgrade NAME जुनं version. apt वर /var/log/apt/history.log बघा.

कसं करायचं (step by step)

  1. अलीकडचे बदल.
sudo dnf history | head -4

Output:

ID | Command line              | Date and time    | Action(s) | Altered
14 | upgrade --security -y     | 2026-10-25 13:10 | Upgrade   |    1
13 | install -y nginx          | 2026-10-25 12:55 | Install   |    2

याचा अर्थ: कोणी, काय, कधी.

  1. Patch undo.
sudo dnf history undo 14 -y

Output:

Downgraded:
  openssl-libs-1:3.0.8-1.amzn2023.0.12.x86_64
Complete!

याचा अर्थ: Rollback झाला.

  1. apt ची नोंद.
grep -A2 'Start-Date' /var/log/apt/history.log | tail -n3

Output:

Start-Date: 2026-10-25  13:12:01
Commandline: apt upgrade -y
Upgrade: openssl:amd64 (3.0.13-0ubuntu3.1, 3.0.13-0ubuntu3.4)

याचा अर्थ: जुनं आणि नवं version.

12. rpm queries: -qa, -qi, -ql, -qf

हे का लागतं?

rpm package database थेट आणि पटकन वाचतो. Audits आणि scripts साठी छान.

हे काय आहे?

rpm -qa सगळी installed (grep ला pipe). rpm -qi NAME info. rpm -ql NAME files. rpm -qf /path owner. rpm -V NAME database शी files verify. rpm -qp --requires file.rpm install न झालेली file वाचतो. Install साठी rpm -i टाळा; deps सोडवत नाही.

कसं करायचं (step by step)

  1. Kernel packages.
rpm -qa | grep '^kernel-6'

Output:

kernel-6.1.112-122.189.amzn2023.x86_64
kernel-6.1.115-126.197.amzn2023.x86_64

याचा अर्थ: दोन kernels.

  1. File चा owner.
rpm -qf /etc/ssh/sshd_config

Output:

openssh-server-8.7p1-8.amzn2023.0.11.x86_64

याचा अर्थ: Owner package.

  1. Package च्या config files.
rpm -qc nginx-core | head -2

Output:

/etc/nginx/fastcgi.conf
/etc/nginx/mime.types

याचा अर्थ: -qc = फक्त config.

  1. काही बदललं का?
rpm -V openssh-server

Output:

S.5....T.  c /etc/ssh/sshd_config

याचा अर्थ: Size, checksum, time बदलले: कोणी edit केलं.

13. Repositories: जोडा, list आणि enable

हे का लागतं?

अनेक tools (Docker, Node.js, PostgreSQL) स्वतःच्या repo मधून नवी versions देतात.

हे काय आहे?

apt: /etc/apt/sources.list.d मधे .list किंवा .sources file, signed-by= /etc/apt/keyrings मधल्या key कडे; मग apt update. dnf: /etc/yum.repos.d मधे .repo file (dnf config-manager --add-repo URL); dnf repolist enabled repos; एका command साठी --enablerepo/--disablerepo. विश्वासाचे repos च जोडा.

कसं करायचं (step by step)

  1. Enabled dnf repos.
dnf repolist

Output:

repo id              repo name
amazonlinux          Amazon Linux 2023 repository
kernel-livepatch     Amazon Linux 2023 Kernel Livepatch repository

याचा अर्थ: Packages कुठून येतात.

  1. Docker चा repo जोडा (Fedora/RHEL).
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

Output:

Adding repo from: https://download.docker.com/linux/fedora/docker-ce.repo

याचा अर्थ: आता .repo file आहे.

  1. Key सह apt repo.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo 'deb [signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable' | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update

Output:

Get:5 https://download.docker.com/linux/ubuntu noble InRelease [48.8 kB]

याचा अर्थ: Key फक्त या repo पुरती.

14. Versions hold: apt-mark hold आणि dnf versionlock

हे का लागतं?

Routine patch मधे database किंवा Kubernetes package चं version उडी मारू नये.

हे काय आहे?

apt-mark hold NAME upgrades थांबवतो; apt-mark showhold list; unhold सोडतो. dnf: python3-dnf-plugin-versionlock install, मग dnf versionlock add NAME, list, delete. किंवा /etc/dnf/dnf.conf मधे exclude=NAME.

कसं करायचं (step by step)

  1. kubelet hold.
sudo apt-mark hold kubelet kubeadm && apt-mark showhold

Output:

kubelet set on hold.
kubeadm set on hold.
kubeadm
kubelet

याचा अर्थ: Upgrades त्यांना skip.

  1. dnf वर lock.
sudo dnf versionlock add postgresql16-server

Output:

Adding versionlock on: postgresql16-server-0:16.4-1.amzn2023.0.1.*

याचा अर्थ: या version ला lock.

  1. सोडा.
sudo apt-mark unhold kubelet

Output:

Canceled hold on kubelet.

याचा अर्थ: तयार असाल तेव्हा upgrade.

15. Caches साफ

हे का लागतं?

Download झालेल्या package files साठतात आणि लहान disks आणि container images भरतात.

हे काय आहे?

apt clean /var/cache/apt/archives delete. apt autoclean फक्त जुनी versions. dnf clean all dnf caches. Dockerfiles मधे एकाच RUN line मधे clean.

कसं करायचं (step by step)

  1. Cache size.
sudo du -sh /var/cache/apt /var/cache/dnf 2>/dev/null

Output:

412M	/var/cache/apt

याचा अर्थ: परत मिळणारी जागा.

  1. साफ.
sudo apt clean && sudo du -sh /var/cache/apt

Output:

36K	/var/cache/apt

याचा अर्थ: मोकळी.

  1. Dockerfile pattern.
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

Output:

(image layer)

याचा अर्थ: लहान image.

16. snap: install, list, refresh, remove

हे का लागतं?

काही tools सगळ्या libraries आत आणि auto updates सह snaps म्हणून येतात, प्रत्येक distro वर सारखं.

हे काय आहे?

sudo snap install NAME. Full system access लागणाऱ्या tools साठी --classic (code editors). snap list installed. snap refresh आत्ता update; snap refresh --hold updates थांबवतो. snap remove NAME. snap info NAME channels (stable, edge).

कसं करायचं (step by step)

  1. Snap install.
sudo snap install aws-cli --classic

Output:

aws-cli (v2/stable) 2.18.10 from Amazon Web Services (aws✓) installed

याचा अर्थ: ✓ = verified publisher.

  1. List.
snap list

Output:

Name     Version   Rev   Tracking   Publisher   Notes
aws-cli  2.18.10   1211  v2/stable  aws✓        classic
core22   20241001  1663  latest/stable canonical✓ base

याचा अर्थ: Tracking = channel.

  1. Event मधे updates थांबवा.
sudo snap refresh --hold=72h aws-cli

Output:

General refreshes of "aws-cli" held until 2026-10-28T13:20:00+05:30

याचा अर्थ: 3 दिवस surprises नाहीत.

17. अनेक industries मधली खरी उदाहरणं

हे का लागतं?

तेच Linux skill प्रत्येक प्रकारच्या company मध्ये लागतं. वेगवेगळ्या ठिकाणी पाहिलं की लक्षात राहतं.

हे काय आहे?

प्रत्येक row म्हणजे एक काल्पनिक team. कोण हे वापरतं आणि कसं ते दाखवते.

कसं करायचं (step by step)

Team आणि शहरते कसं वापरतातCommand
Rohit, SaaS startup, PuneUbuntu वर weekly security patchingapt update && apt upgrade -y
Emma, bank, ZurichPostgreSQL tested version ला pindnf versionlock add postgresql16-server
Yusuf, telecom, Istanbulबदललेली file कोणत्या package चीrpm -qf /etc/ssh/sshd_config
Mei, AI lab, SingaporeNo recommends सह slim GPU imagesapt-get install --no-install-recommends
Carlos, retail, Madridवाईट patch rollbackdnf history undo 14
Sana, college, AurangabadLab PCs वर snapssnap install code --classic

18. नेहमीच्या errors आणि त्यांचे fixes

हे का लागतं?

हे errors सगळ्यांना येतात. कारण माहीत असलं की तास वाचतात.

हे काय आहे?

आधी नेमका message वाचा. मग खालच्या row शी जुळवा.

कसं करायचं (step by step)

दिसणारा errorका होतंFix कसा करायचा
E: Unable to locate package nginxxTypo किंवा apt update नाहीLists update करा आणि नाव तपासा.
sudo apt update && apt search nginx
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 2101 (unattended-upgr)दुसरं apt चालू (auto updates)थांबा; lock delete करू नका.
ps -p 2101 -o cmd
E: Failed to fetch ... 404 Not Foundजुन्या package listsआधी apt update.
sudo apt update
dpkg: dependency problems prevent configurationdpkg -i deps install करत नाहीapt ला fix करू द्या.
sudo apt -f install -y
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a'Install मधेच मारलंConfigure पूर्ण करा.
sudo dpkg --configure -a
Error: Unable to find a match: htopतुमच्याकडे नसलेल्या repo मधे (उदा. EPEL)Search करा किंवा योग्य repo enable.
dnf search htop
GPG check FAILED / NO_PUBKEYRepo key नाही किंवा चुकीचीVendor key import; checks कधी बंद नका.
sudo rpm --import KEY_URL
Error: Failed to download metadata for repoNetwork, proxy किंवा चुकीचा repo URLURL तपासा; सध्या तो repo disable.
sudo dnf --disablerepo=REPO makecache
Problem: conflicting requests ... nothing provides libfoo.soIncompatible repos mixThird-party repo काढा किंवा जुळणारं version.
dnf repolist
error: snap "code" requires classic confinementSnap ला --classic हवंविश्वास असेल तर --classic.
sudo snap install code --classic

19. Troubleshooting step by step

हे का लागतं?

Install fail झालं तर नाव, repos, locks आणि keys या क्रमाने तपासा.

हे काय आहे?

वरून खाली जा. ज्या step ला problem दिसतो तिथे थांबा.

कसं करायचं (step by step)

  1. Refresh करा आणि नाव शोधा.
sudo apt update && apt search --names-only NAME
  1. कोणते repos चालू.
dnf repolist; ls /etc/apt/sources.list.d
  1. Lock कोणाकडे.
sudo lsof /var/lib/dpkg/lock-frontend
  1. अर्धवट installs पूर्ण.
sudo dpkg --configure -a && sudo apt -f install
  1. History बघा.
sudo dnf history | head; tail /var/log/apt/history.log
  1. Caches साफ करून retry.
sudo dnf clean all && sudo dnf makecache

20. Lab 1: Ubuntu वर पूर्ण package life cycle

हे का लागतं?

Package search, inspect, install, files query, hold, remove आणि purge.

हे काय आहे?

पूर्ण hands-on lab. प्रत्येक step test Linux machine वर करा (EC2 instance, VM किंवा WSL).

कसं करायचं (step by step)

  1. Refresh आणि search.
sudo apt update -qq && apt search --names-only '^tree$'

Output:

tree/noble 2.1.1-2 amd64
  1. Install.
sudo apt install -y tree

Output:

Setting up tree (2.1.1-2) ...
  1. Files आणि owner.
dpkg -L tree | grep bin; dpkg -S $(which tree)

Output:

/usr/bin/tree
tree: /usr/bin/tree
  1. Hold आणि तपासा.
sudo apt-mark hold tree && apt-mark showhold

Output:

tree set on hold.
tree
  1. Unhold आणि purge.
sudo apt-mark unhold tree && sudo apt purge -y tree && dpkg -l tree | tail -n1

Output:

dpkg-query: no packages found matching tree

21. Lab 2: history undo आणि rpm audit सह dnf

हे का लागतं?

dnf ने install, rpm ने काय मिळालं ते शोधा, files verify, मग install undo.

हे काय आहे?

पूर्ण hands-on lab. प्रत्येक step test Linux machine वर करा (EC2 instance, VM किंवा WSL).

कसं करायचं (step by step)

  1. Command कोण देतं.
dnf provides '*/bin/tree'

Output:

tree-2.1.0-1.amzn2023.0.2.x86_64 : File system tree viewer
  1. Install.
sudo dnf install -y tree

Output:

Complete!
  1. rpm info आणि files.
rpm -qi tree | head -3; rpm -ql tree | grep bin

Output:

Name        : tree
Version     : 2.1.0
/usr/bin/tree
  1. Verify.
rpm -V tree && echo clean

Output:

clean
  1. शेवटची transaction undo.
sudo dnf history undo last -y

Output:

Removed:
  tree-2.1.0-1.amzn2023.0.2.x86_64
Complete!

Ravindra Bagale's Tip

Install with apt or dnf, ask questions with dpkg or rpm. And before any patch on a production server, note the history ID or save apt-mark showmanual, so you can roll back in minutes.

22. नेहमी विचारले जाणारे प्रश्न

प्र. apt की apt-get?

माणसांसाठी apt (छान output); scripts मधे apt-get (stable output).

प्र. yum की dnf?

dnf हा नवा yum; RHEL 8+ वर yum dnf कडे.

प्र. apt update लागतो पण dnf आधी का नाही?

apt स्वतः lists refresh करत नाही; dnf जुना metadata आपोआप refresh करतो.

प्र. dnf update आणि dnf upgrade सारखेच?

हो.

प्र. Amazon Linux वर .deb install?

नाही, .rpm किंवा container.

प्र. remove vs purge?

purge config files पण delete करतो.

प्र. Snap की apt?

System packages साठी apt; स्वतःचं bundle आणि auto updates हवे त्या apps साठी snap.

प्र. dpkg lock delete करणं safe?

नाही. थांबा किंवा process शोधा; delete केल्याने database बिघडू शकतो.

23. मुलाखत प्रश्न आणि उत्तरं

Beginner level

प्र. Ubuntu वर nginx install?

sudo apt update && sudo apt install nginx.

प्र. Amazon Linux वर nginx?

sudo dnf install nginx.

प्र. apt update काय करतो?

फक्त package lists refresh.

प्र. /usr/bin/curl कोणत्या package ची?

dpkg -S किंवा rpm -qf /usr/bin/curl.

Mid level level

प्र. upgrade vs full-upgrade?

full-upgrade पूर्ण करायला packages काढू किंवा जोडू शकतो.

प्र. dnf बदल rollback कसा?

dnf history undo ID.

प्र. Package upgrade कसं थांबवायचं?

apt-mark hold किंवा dnf versionlock add.

प्र. Missing command चं package?

dnf provides '*/bin/cmd' किंवा apt-file search.

Senior level

प्र. 300 servers safely patch कसे?

Staged rings, local mirror किंवा snapshot repo, critical packages hold, history IDs, health checks, automatic reboot windows.

प्र. apt-key पेक्षा signed-by चांगलं का?

Key फक्त त्या repo साठी trusted, प्रत्येक repo साठी नाही.

प्र. Tampered system files कसे ओळखायचे?

rpm -Va किंवा debsums, package database शी तुलना.

प्र. Packages सह reproducible builds?

नेमकी versions pin, snapshot repos, lock files, आणि images एकदाच build.

घरी करून बघा

  1. तुमच्या machine वर किती packages installed ते मोजा (dpkg -l | grep -c ^ii किंवा rpm -qa | wc -l). /bin/ls चा owner शोधा.
  2. htop install करा, hold करा, upgrade करून बघा, मग unhold करून remove. वापरलेला प्रत्येक command लिहा.

सराव Tasks

या scenario बद्दल

Amravati Agro Market हा अमरावती मधला शेती व्यवसाय आहे. Anjali Thakre त्यांचं IT व cloud काम पाहतात. त्यांचे पैसे INR मध्ये मोजले जातात आणि AWS resources ap-south-1 Region मध्ये चालतात. खालच्या tasks मध्ये तुम्ही या lesson मध्ये शिकलेलं वापरून त्यांची खरी कामं करता. सगळी नावं, account IDs, IP addresses व numbers सरावासाठी काल्पनिक आहेत.

0 / 16

सोपं Lists refresh

का: Software safely install हवं.

काय करायचं: Ubuntu वर package lists refresh.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं apt install

का: Software safely install हवं.

काय करायचं: Prompt शिवाय Ubuntu वर nginx.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं apt search

का: Software safely install हवं.

काय करायचं: apt मधे redis शोधा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं dnf install

का: Software safely install हवं.

काय करायचं: Amazon Linux वर prompt शिवाय git.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं सगळे rpm packages

का: Software safely install हवं.

काय करायचं: सगळे installed rpm packages.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं dpkg list

का: Software safely install हवं.

काय करायचं: dpkg ने packages list करून nginx filter.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

सोपं Snaps list

का: Software safely install हवं.

काय करायचं: Installed snaps list.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Config सह काढा

का: Software safely install हवं.

काय करायचं: Config files सह apache2 काढा.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम File कोण देतो?

का: Software safely install हवं.

काय करायचं: semanage command कोणतं package देतं.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Package ची dnf history

का: Software safely install हवं.

काय करायचं: फक्त nginx ची dnf transaction history list.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Updates आहेत?

का: Software safely install हवं.

काय करायचं: Install न करता available updates.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम File कोणाच्या package चा

का: Software safely install हवं.

काय करायचं: /etc/ssh/sshd_config कोणाच्या package चं.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम Package मधल्या files

का: Software safely install हवं.

काय करायचं: nginx rpm ने install केलेल्या files.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम dpkg owner

का: Software safely install हवं.

काय करायचं: Ubuntu वर /usr/bin/curl कोणाचं.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम .deb install

का: Software safely install हवं.

काय करायचं: dpkg ने local app_1.2_amd64.deb.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

मध्यम snap install

का: Software safely install हवं.

काय करायचं: Classic snap code install.

कसं करायचं:
  1. हे काम करणारा Linux command शोधा.
  2. Task ला लागणारे options (उदा. -r, -h) जोडा.
  3. File नावं, folders किंवा users योग्य क्रमाने लिहा.
  4. System files/users बदलत असाल तर sudo वापरा. Check answer दाबा.

थोडक्यात सांगायचं तर

  1. apt update refresh; apt install, remove, purge, autoremove.
  2. Install आधी apt search, show, apt-cache policy.
  3. dpkg -l, -L, -S प्रश्नांची उत्तरं.
  4. dnf install, upgrade --security, provides, history undo.
  5. Audits साठी rpm -qa, -qf, -ql, -V.
  6. Signed keys सह repos; versions hold; bundled apps साठी snap.

उजळणी, तुलना आणि मुलाखत cards

हा lesson काही मिनिटांत revise करा. Cards phone वर save करा किंवा PNG download करा. प्रत्येक card वरचा QR हा lesson उघडतो.

apt आणि dnf. Trusted repos मधून install. Ubuntu वर apt, RHEL वर dnf. आधी lists refresh. Amazon Linux वर install.
उजळणी card: apt आणि dnf · PNG download करा · Card page उघडा
rpm / dpkg queries. काय installed ते कळवा. -qa सगळे, -ql files. -qf / -S file कोणाची. File चा owner.
उजळणी card: rpm / dpkg queries · PNG download करा · Card page उघडा
apt vs dnf. Debian, Ubuntu. / RHEL, Fedora, Amazon Linux.
तुलना: apt vs dnf · PNG download करा · Card page उघडा
rpm vs dnf. Low level, एक file. / High level, repos.
तुलना: rpm vs dnf · PNG download करा · Card page उघडा
apt vs dnf?. apt: Debian, Ubuntu (.deb). dnf: RHEL, Fedora, AL2023 (.rpm). सगळं update.
मुलाखत card: apt vs dnf? · PNG download करा · Card page उघडा
rpm vs dnf?. rpm: एक file, deps नाही. dnf: repos आणि deps. Command कोण देतं.
मुलाखत card: rpm vs dnf? · PNG download करा · Card page उघडा
Version pin?. अचानक upgrades थांबवा. apt-mark hold / versionlock. Ubuntu वर hold.
मुलाखत card: Version pin? · PNG download करा · Card page उघडा
snap कधी?. Bundled, auto-update apps. मोठं, हळू start. Snaps list.
मुलाखत card: snap कधी? · PNG download करा · Card page उघडा

अजून cards: Ravi Sir's Cards.