How to Create, Install, and Uninstall deb Packages in Debian Linux

Опубликовано: 05 Октябрь 2024
на канале: Arashtad
331
9

In this video we discuss the way we can create, install, and uninstall .deb packages in Debian Linux.

1. Create a Directory for Your Project:
mkdir hello-world
cd hello-world

2. Write the C++ Program (main.cpp)

3. Compile the Program:
g++ main.cpp -o hello-world

4. Create the Directory Structure for the .deb Package:
mkdir -p hello-world-1.0/usr/local/bin
mkdir -p hello-world-1.0/DEBIAN

5. Move the executable:
mv hello-world hello-world-1.0/usr/local/bin/

6. Create the control file:
vim hello-world-1.0/DEBIAN/control

7. Add the following content to the control file:
Package: hello-world
Version: 1.0
Section: base
Priority: optional
Architecture: amd64
Maintainer: Your Name [email protected]
Description: A simple Hello World program
This is a simple Hello World program written in C++.

8. Set the necessary permissions:
chmod 755 hello-world-1.0/DEBIAN
chmod 755 hello-world-1.0/usr
chmod 755 hello-world-1.0/usr/local
chmod 755 hello-world-1.0/usr/local/bin
chmod 755 hello-world-1.0/usr/local/bin/hello-world

9. Build the package:
dpkg-deb --build hello-world-1.0

10. Install the package:
sudo dpkg -i hello-world-1.0.deb

11. Run the program to test:
hello-world

12. Uninstall the Package:
sudo dpkg -r hello-world
or:
sudo apt remove hello-world

13. Remove Configuration Files (if any):
sudo dpkg --purge hello-world
or:
sudo apt purge hello-world

14. Clean Up Unused Dependencies:
sudo apt autoremove

15. Verify Uninstallation:
which hello-world

All Open Source!

Arashtad provides high quality tutorials, eBooks, articles and documents, design and development services, over 400 free online tools, frameworks, CMS, WordPress plugins, Joomla extensions, and other products.

More Courses ▶ https://tuts.arashtad.com/

Business Inquiries ▶ https://arashtad.com/business-inquiries/
Affiliate Programs ▶ https://arashtad.com/affiliate-programs/

eBooks ▶ https://press.arashtad.com/
Our Products ▶ https://market.arashtad.com/
Our Services ▶ https://arashtad.com/services/
Our Portfolio ▶ https://demo.arashtad.com/
Free Online Tools ▶ https://tools.arashtad.com/
Our Blog ▶ https://blog.arashtad.com/
Documents ▶ https://doc.arashtad.com/
Licensing ▶ https://arashtad.com/licensing/
About us ▶ https://arashtad.com/about/

Join Arashtad Network ▶ https://i.arashtad.com/

Our Social Profiles ▶ https://arashtad.com/arashtad-social-...
Vimeo ▶ https://vimeo.com/arashtad
Udemy ▶ https://www.udemy.com/user/arashtad
GitHub ▶ https://github.com/arashtad
Linkedin ▶   / arashtad  
Twitter ▶   / arashtad