![How to create, install and uninstall deb packages in Debian Linux](https://ytimg.googleusercontent.com/vi/mgLqrpdNAcc/hqdefault.jpg)
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
Responsible: Your name [protected email]
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. Create 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:
Hi world
12. Uninstall the package:
sudo dpkg -r hello-world
Or:
sudo apt remove hello-world
13. Delete configuration files (if applicable):
sudo dpkg –purge hello-world
Or:
sudo apt purge hello world
14. Clean up unused dependencies:
sudo apt automatic removal
15. Verify the uninstallation:
what hello world
Everything is open source!
Arashtad offers high-quality tutorials, eBooks, articles and documents, design and development services, 400+ free online tools, frameworks, CMS, WordPress plugins, Joomla extensions and more. others products.
More courses https://tuts.arashtad.com/
Business Inquiries https://arashtad.com/business-inquiries/
Affiliate Programs https://arashtad.com/affiliate-programs/
E-books 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/
License https://arashtad.com/licensing/
About us https://arashtad.com/about/
Join the Arashtad network https://i.arashtad.com/
Our social profiles https://arashtad.com/arashtad-social-media-profiles/
Vimeo https://vimeo.com/arashtad
Udemy https://www.udemy.com/user/arashtad
GitHub https://github.com/arashtad
Linkedin https://www.linkedin.com/company/arashtad
Twitter https://twitter.com/arashtad
Please take the opportunity to connect and share this video with your friends and family if you find it useful.
No Comments