การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`
เรียนรู้การจัดการแพ็กเกจซอฟต์แวร์บนระบบที่ใช้ Debian ด้วย `apt` และ `dpkg`
การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg` เป็นบทเรียน Linux Command Line Mastery ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Linux Command Line Mastery และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Linux Command Line Mastery มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Intro to Package Management
Welcome to package management! On Linux, software comes in packages. These are archives containing program files, documentation, and metadata.
A package manager is a tool that automates the installation, upgrade, configuration, and removal of software. It handles dependencies, ensuring all necessary components are installed.
`dpkg`: The Core Tool
On Debian-based systems (like Ubuntu), the fundamental tool for managing packages is dpkg. It's a low-level tool that directly interacts with .deb files (Debian package files).
dpkginstalls, removes, and manages individual.debpackages.- It does NOT automatically handle dependencies. If a package needs others, you must install them yourself.
Installing with `dpkg`
To install a .deb file you've downloaded, you use the -i (or --install) option with dpkg.
Remember, if the package has dependencies, dpkg will warn you and the installation might fail or be incomplete until those dependencies are met.
sudo dpkg -i /path/to/your-package.debListing `dpkg` Packages
You can query dpkg to see information about installed packages. The -l (or --list) option shows all installed packages.
You can pipe its output to grep to search for specific packages.
dpkg -l | grep firefox`apt`: The Smarter Manager
While dpkg handles individual .deb files, apt (Advanced Package Tool) is the user-friendly, high-level front-end. It works with repositories (servers holding many packages).
apt automatically handles dependencies, fetches packages from repositories, and simplifies system-wide updates.
Syncing with `apt update`
Before installing or upgrading, you should always run apt update. This command downloads the latest package information from the configured repositories.
It does NOT install new software or update existing ones, it only updates the list of what's available.
sudo apt updateInstalling Apps with `apt install`
To install new software from the repositories, use apt install followed by the package name. apt will resolve and install all necessary dependencies.
You'll be prompted to confirm the installation before it proceeds.
sudo apt install htopUpgrading Your System
To upgrade all installed packages to their latest available versions (based on your updated package lists), use apt upgrade.
This is crucial for security updates and new features. It's a good practice to run apt update before apt upgrade.
sudo apt upgradeRemoving Packages
When you no longer need a package, you can remove it using apt remove or apt purge.
apt remove package_name: Deletes the package but keeps its configuration files.apt purge package_name: Deletes the package AND its configuration files, for a cleaner uninstall.
sudo apt remove libreoffice-writerPackage Management Quiz
You've learned about the two main package management tools on Debian-based systems. Let's test your understanding!
Summary: `apt` & `dpkg`
Great job! You've learned about Debian's powerful package management system:
dpkg: The low-level tool for individual.debfiles, without dependency resolution.apt: The high-level, user-friendly tool for managing packages from repositories, handling dependencies automatically.
Key apt commands include update, install, upgrade, remove, and purge.
คำถามที่พบบ่อย
บทเรียน “การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Linux Command Line Mastery ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Linux Command Line Mastery มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`”
เรียนรู้การจัดการแพ็กเกจซอฟต์แวร์บนระบบที่ใช้ Debian ด้วย `apt` และ `dpkg` คุณปฏิบัติ Linux Command Line Mastery ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Linux Command Line Mastery หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Linux Command Line Mastery บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Linux Command Line Mastery นี้ได้ไหม
ได้ บทเรียน Linux Command Line Mastery ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- การจัดเก็บและบีบอัดไฟล์: `tar`, `gzip`, `bzip2`
- การจัดการแพ็กเกจ (Debian/Ubuntu): `apt`, `dpkg`
- การจัดการแพ็กเกจ (CentOS/Fedora): `yum`, `dnf`, `rpm`
- การสร้างจากซอร์ส: configure, make และ make install