How to Create .deb Packages for Debian, Ubuntu and Linux Mint

Тәжірибелік нұсқаулар және стиль

How To Create Debian Packages
Note: Commands here are just for examples. They will NOT run as they are shown here. You have to adapt them to your own needs and system.
1. Create the directory to hold the project:
shell) mkdir /home/USER/debpkgs/my-program_version_architecture
2. Create a directory called "DEBIAN" inside the project directory:
shell) mkdir /home/USER/debpkgs/my-program_version_architecture/DEBIAN
3. Copy files into project root directory and include the final paths:
/usr/bin/ would be /home/USER/debpkgs/my-program_version_architecture/usr/bin/
/opt/ would /home/USER/debpkgs/my-program_version_architecture/opt/
4. Create a control file in DEBIAN:
shell) touch /home/USER/debpkgs/my-program_version_architecture/DEBIAN/control
5. Now add the necessary meta data to the control file:
Package: my-program
Version: 1.0
Architecture: all
Essential: no
Priority: optional
Depends: packages;my-program;needs;to;run
Maintainer: Your Name
Description: A short description of my-program that will be displayed when the package is being selected for installation.
6. If desired a "preinst" and/or "postinst" script can be added that execute before and/or after installation. They must be given proper execute permissions to run:
shell) touch /home/USER/debpkgs/my-program_version_architecture/DEBIAN/postinst
Add commands you'd like to run in postinst and then set the permissions to 755.
7. Now generate package:
shell) dpkg-deb --build /home/USER/debpkgs/my-program_version_architecture
The package will be in /home/USER/debpkgs
Check out www.ezeelinux.com for more about Linux.
Please join the discussion at EzeeTalk.
www.ezeelinux.com/talk/ It's free, secure and fun!

Пікірлер: 97

  • @fredmckinney8933
    @fredmckinney89333 жыл бұрын

    After trying to wrap my head around several other .deb packaging tutorials, I found yours to give the best explanation as to how it's done, and it's really surprisingly easy to do, no less. Thanx! :-)

  • @eznix
    @eznix5 жыл бұрын

    Once I learned how to build a .deb package, I then started unpacking .deb packages and looking inside to see how they operate and see what pre and post scripts do my system. If you want to play with installing software that your package manager does not want to install, you can unpack the deb package, modify the control file and tweak the dependencies so the package will install. It can be a fun waste of time. :-)

  • @Milosz_Ostrow

    @Milosz_Ostrow

    5 жыл бұрын

    If something can be learned by doing that, I would never consider it a "waste of time". You never know when the knowledge might be crucial.

  • @Kamel419

    @Kamel419

    3 жыл бұрын

    i can see your point in calling it a waste of time lol. there are far worse ways to waste time though for sure

  • @ed4157

    @ed4157

    2 жыл бұрын

    Great tip, I did that with the google-chrome and I could create my .deb file easily since like google-chrome my app also create a symbolic link to the bin

  • @Jaycsee66
    @Jaycsee665 жыл бұрын

    Another excellent video Joe. Congratulations on 75K subscribers. When I first subscribed i think you were only about 30K (Only 30K! That it self is a great effort). All the hard work and effort you put into your videos is appreciated. Thanks Joe.

  • @NotMarkKnopfler
    @NotMarkKnopfler5 жыл бұрын

    This is absolute treasure. Thank you so much, Joe. Really appreciate this. Greetings from Scotland.

  • @edhousemanjr5474
    @edhousemanjr54744 жыл бұрын

    Thanks. Clear and easy. Everywhere I looked, they made it complicated.

  • @2000MohammedSuper
    @2000MohammedSuper3 жыл бұрын

    Man, thank you so much for this amazingly instructive video! From now on, before installing any .deb file, I will check the inner things just to see how the whole package works. I now understand why you say to be "very, very carefull" about where we get Debian packages from on the Internet. It's look so easy to put some maliscious code in one of them.

  • @jdsgotninelives
    @jdsgotninelives5 жыл бұрын

    Congrats on your growing KZread base. You make great content on :-)

  • @juanc.casanova2572
    @juanc.casanova25725 жыл бұрын

    Mr Collins Thank You for Imparting KNOWLEDGE I really REALLY APPRECIATE YOU

  • @1kit
    @1kit2 жыл бұрын

    Love your voice and clear English speech. I enjoy it.

  • @solarsiztem
    @solarsiztem2 ай бұрын

    that was really simple. thank you. everyone make this so complicated but you are really the best. keep working

  • @SlingshotMadMan
    @SlingshotMadMan5 жыл бұрын

    I think this is the first video i ever see in youtube for creating packages in Linux systems

  • @Ilsh1964
    @Ilsh19645 жыл бұрын

    Perfect and very clear guide! I've tried before to create a deb package and found it too complicated, but after your explanation it's quite easy, THANK YOU!!! Remark: Joe, You have >75,000 satisfied users, don't be upset by the trolls. You are doing fantastic job!

  • @noferblatz
    @noferblatz5 жыл бұрын

    Many thanks for this video. I've read through this process before, but, like you, I had a hard time with it. Your video made it clear. I'll take notes on it, and add it to my "Tips And Tricks" internal website. (I don't know why other explanations of this process are hard to understand.)

  • @dersammler9254
    @dersammler92543 жыл бұрын

    Great, exactly what I was looking for! Many thanks & BR

  • @aaronrennyvargheseOriginal
    @aaronrennyvargheseOriginal4 жыл бұрын

    Amazing video! You just gained a new sub!

  • @BrucesWorldofStuff
    @BrucesWorldofStuff5 жыл бұрын

    Great as always! Congrats on the over 75K!!! USER @ 16:48.... HaHaHa, yep I call it User everytime I type USR still.... It's the way I remember it... Thanks for the videos as I reference them a lot.. I know I can write stuff down but I lose it, so I save notes in a reference file and use it to go back to videos to see how it is done! Thank you so so so much!

  • @Esque123
    @Esque1235 жыл бұрын

    Great video, really easy to follow.

  • @deckluck372
    @deckluck3725 жыл бұрын

    Congratulations on the 75K achievement. You know 100K will be around the corner very soon!

  • @ed4157
    @ed41572 жыл бұрын

    Thank you very much, I can't believe it is this easy

  • @linuxrant
    @linuxrant Жыл бұрын

    Wonderfully and patiently explained. It is obviously simple now. Subscribed for more. You could ease out on the font size just a little bit. It's nice that it's big, but the prompt takes whole screen estate instead of the command... but I don't want to complain, the tutorial is awesome. BTW, quite nice voice impression you made 14:23 :)

  • @fvillarrealg
    @fvillarrealg Жыл бұрын

    Thank you for sharing the this video, it guided me to understand the process.

  • @chaslinux
    @chaslinux4 жыл бұрын

    This is really awesome Joe! Like a few others I tried following the debian maintainers guide the first time and things didn't work out. This video clarified some things and I managed to build a .deb package on an Ubuntu system and it installed perfectly on an Xubuntu system. One question: thinking I should have packaged for /opt because the software I'm packaging has a binary blob that depends on an assets/ directory in the same directory. This doesn't seem like a good practice to put those in /usr/bin. So thinking have an /opt/myprogram and a symlink in /usr/bin to /opt/myprogram?

  • @abdelrhmanhamdy2370
    @abdelrhmanhamdy2370 Жыл бұрын

    Thanks for clear explanation

  • @stephenjames5745
    @stephenjames57454 жыл бұрын

    Terrific video! Thank you

  • @MohamedIbrahim-cb8rl
    @MohamedIbrahim-cb8rl10 ай бұрын

    Thank you for the informative and enjoyable tutorial. Explaining the project directory may have been more clear using the 'tree' command. Thanks again and wishing you the best in your career.

  • @andreim.1763
    @andreim.17633 жыл бұрын

    It was of great help. thank you !

  • @textoffice
    @textoffice2 жыл бұрын

    thanks for this job ! it works well.

  • @tpasi2020UG
    @tpasi2020UG5 жыл бұрын

    We subscribe to quality and this channel is quality.

  • @toshn4151
    @toshn41513 жыл бұрын

    Thank you, this is very useful. I don't know why all the other tutorials online are so complicated... are they using an older method or something?

  • @earnestredwood4694
    @earnestredwood46945 жыл бұрын

    You are the man Joe...

  • @gmailservice9945
    @gmailservice99453 жыл бұрын

    very useful tutorial. thank you

  • @JoshuaPeisach
    @JoshuaPeisach4 жыл бұрын

    Thanks a lot, -From The Ubuntu Cinnamon Team

  • @trido3815
    @trido3815 Жыл бұрын

    Clear explanations. Straight to the point. Thanks.

  • @conandiaz6999
    @conandiaz69993 жыл бұрын

    Nice tutorial.

  • @Greatfulone
    @Greatfulone3 жыл бұрын

    Thank you.

  • @ArjunDandagi
    @ArjunDandagi3 жыл бұрын

    @Joe Collins , Thanks for the awesome video on walking us through how to create a .deb package , i have learnt how to build one and how to install in my system . however i would like to make it available to all using my own ppa , i did create my own account in launchpad . but the documentation about uploading the packaging is so cluttered or i simply not interested to the hard path to upload. can you walk us through the uploading procedure please. TIA

  • @EzeeLinux

    @EzeeLinux

    3 жыл бұрын

    No.. I use Git. It's way simpler. Go learn Git if you want to share. :)

  • @knerduno5942
    @knerduno59423 жыл бұрын

    So many ways to generate deb packages. Some say pbuilder is the way to make those .deb packages. Also, looking at the Debian source files from "apt source " I am seeing not only a different file structure, but also naming is a bit different. For example, instead of "DEBIAN" like you are showing, I am seeing "debian."

  • @jagadeesh_palli
    @jagadeesh_palli3 жыл бұрын

    Nice one

  • @junicast_tech
    @junicast_tech3 жыл бұрын

    Thank you for the nice video. It could be a bit shorter instead of explaining every detail about what directories are for what but in the end it helped a a significant deal.

  • @aequanimus63247
    @aequanimus632473 жыл бұрын

    Thanks for the help. Fyi, you might benefit from installing tree.

  • @lechsiz1642
    @lechsiz16424 жыл бұрын

    that warning is what I needed. too many installs or other issues can break linux. but i needed more visuals. had to quit this video after 8 minutes

  • @SanpuiRonak
    @SanpuiRonak2 жыл бұрын

    You can apt purge to remove configs from home

  • @philippecardin1109
    @philippecardin11095 жыл бұрын

    I will keep your video in my references for sure, thanks! Next, how to create or modify an AUR package for Arch systems!

  • @EzeeLinux

    @EzeeLinux

    5 жыл бұрын

    I don't do anything Arch related. Not really into packaging anyway, as I said at the beginning of the video. :)

  • @philippecardin1109

    @philippecardin1109

    5 жыл бұрын

    @RDE Lutherie Thanks i'l keep that in mind!

  • @caseywinters3021
    @caseywinters30214 жыл бұрын

    I made an ezeelinux profile today. Looks like a good community. I’m not surprised though.

  • @PizzaLovingNerd
    @PizzaLovingNerd4 жыл бұрын

    Thanks.

  • @voiceoftreason1760
    @voiceoftreason17602 жыл бұрын

    is there any logic to version numbering schemes? I see all sorts of combinations of numbers with : . - + characters in between

  • @vanpeters9751
    @vanpeters97515 жыл бұрын

    I run linspire 8.0 CE 2019 it is hybrid Linux primary Ubuntu but has rpm and other types of packages

  • @toosafelol
    @toosafelol5 жыл бұрын

    Thank you for the video, i've been looking for this. Thank: command not found edit: no sarcasm btw, very usefull

  • @strayferal
    @strayferal3 ай бұрын

    07:50 not quite - /usr/local/bin according to few things I read is for the locally compiled from source software, so we should not put anything there manually. This is what I read on like 2 different places.

  • @douggale5962
    @douggale59624 жыл бұрын

    Have you seen how windows MSI install files are built? A nightmare of complexity. It is beautiful how simply deb packages are created.

  • @ohiovr
    @ohiovr3 жыл бұрын

    Green belt achieved

  • @hamzaarain4238
    @hamzaarain42383 жыл бұрын

    thanks to guide me

  • @ajinkyarathod5180
    @ajinkyarathod51803 жыл бұрын

    How can I make my debian app also run from command line (if made in python)

  • @Pan_Samochodzik
    @Pan_Samochodzik5 жыл бұрын

    Would be great if you did video for ftp server that works and setting permissions so logged in user can create files etc... also sharing directory and connecting from one linux machine to another.

  • @stephenjames5745

    @stephenjames5745

    5 жыл бұрын

    Tom H why not just use sftp through ssh?

  • @Pan_Samochodzik

    @Pan_Samochodzik

    5 жыл бұрын

    @@stephenjames5745 It was easier to use usb drive. I'm learning basic bash and linux under the hood is like going to dark forest at night while blindfolded with hands tied and looking for instruction manual that is encrypted form of most obscure lost language. Lol, geez I'm funny.

  • @tanja84dk1
    @tanja84dk1 Жыл бұрын

    I have a small question even that I know its a older video. I tried to add the dependencies line to make sure the packages are installed and saw they were separated by ; in the description. But I unfortunally got this error 'Depends' field, invalid package name 'iptables;grep;coreutils;gawk': character ';' not allowed (only letters, digits and characters '-+._') And when I looked back at your video they were actually , separated so I think that is a error in the description

  • @tanja84dk1

    @tanja84dk1

    Жыл бұрын

    @Axel Steiner Thank you for reminding me why to NEVER comment on youtube anymore

  • @celestialbeing4767
    @celestialbeing47675 жыл бұрын

    You have great content, not surprised why your getting subscribers. I just wanna be a good Stewart of what I already have and created. Making the experience a good one and passing it other acquiring minds. " Lean on Me" song by Bill Withers.

  • @mihajlopetkovic2003
    @mihajlopetkovic20032 жыл бұрын

    How would I create internal structure of the package if some files need to be copied to /home/USER/.config? What do I type instead of USER because I don't know how user folder is called on every system?

  • @textoffice

    @textoffice

    2 жыл бұрын

    use the $LOGNAME environnement variable in command in the postinst script

  • @kbaafi
    @kbaafi3 жыл бұрын

    I did not consider subscribing....I just subscribed

  • @davonuk1
    @davonuk15 жыл бұрын

    So you can use one of these deb packages to put files anywhere on your system. If these files happen to overwrite key components of your OS, or even the kernel ... ? Definitely handle with care!

  • @EzeeLinux

    @EzeeLinux

    5 жыл бұрын

    Yep, you got it. :)

  • @givenfool6169

    @givenfool6169

    2 жыл бұрын

    Dangerous Freedom for sure

  • @declanmoran1894
    @declanmoran18945 жыл бұрын

    👍👍👍👍

  • @commonsense5797
    @commonsense57975 жыл бұрын

    Two words: you rock! Wait, that's four words, eight words. Oh Crap, counting in binary again.!?!

  • @MrHatoi
    @MrHatoi4 жыл бұрын

    Pro tip: "apt purge" instead of "remove" will eliminate all configuration files as well. It's a good idea to use this to automatically get rid of leftover files if you don't have any intention of reinstalling the program or ever using it again.

  • @ajinkyarathod5180

    @ajinkyarathod5180

    3 жыл бұрын

    Really thank you for this. Is there any documentation about this I can read?

  • @MrHatoi

    @MrHatoi

    3 жыл бұрын

    @@ajinkyarathod5180 You can look at "man apt", under the "install, remove, purge" section: "Removing a package removes all packaged data, but leaves usually small (modified) user configuration files behind, in case the remove was an accident. Just issuing an installation request for the accidentally removed package will restore its function as before in that case. On the other hand you can get rid of these leftovers by calling purge even on already removed packages. Note that this does not affect any data or configuration stored in your home directory."

  • @ajinkyarathod5180

    @ajinkyarathod5180

    3 жыл бұрын

    @@MrHatoi Thankies

  • @greob
    @greob5 жыл бұрын

    Probably not a great idea to arbitrarily remove files from the user's file system without at least prompting for confirmation. What if I have my own program called xbt in my $HOME/bin/xbt for example? -> dangerous data loss!

  • @EzeeLinux

    @EzeeLinux

    5 жыл бұрын

    The chances that a user would have their own program called xbt in the ~/bin directory and get mad 'cause the installer for a new program called xbt removed it are just about zero. Better to test for and then remove an old version than to have a user contact you and tell you that the update didn't work.

  • @OpenGL4ever

    @OpenGL4ever

    4 жыл бұрын

    @@EzeeLinux You're wrong. You can't assume that it's unlikely that someone is using the name xbt for his or another program. Because the name consists of only three characters, the chances that this name is used already is thus even very high. To do it the correct way you should use some sort of checksums like sha256sum, and compare it to your known old xbt binaries. That way you can exclude, that you will accidentally delete someones other file. The only disadvantage of that way is, that you will have to keep a history of all possible checksums and it will stop to work if someone is creating his own binaries from source. In the latter case you should ask the user if he wants to have that file be deleted. And one more thing, all in all this should even be not necessary when the file is installed via a package manager.

  • @_antoniocouto
    @_antoniocouto5 жыл бұрын

    A new Debian version is going to be release with /usr merge. What’s your take on this?

  • @EzeeLinux

    @EzeeLinux

    5 жыл бұрын

    That's just pluming. I don't have strong option on it either way... :)

  • @_antoniocouto

    @_antoniocouto

    5 жыл бұрын

    Learn Linux They are moving everything from /bin, /sbin, /lib and /lib64 to /usr. What is all about: www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/ Debian 10: www.phoronix.com/scan.php?page=news_item&px=Debian-Go-Ahead-Merged-Usr

  • @ayoubelmhamdi7920
    @ayoubelmhamdi79202 жыл бұрын

    why you are using unconformable bash prompt

  • @ayoubelmhamdi7920

    @ayoubelmhamdi7920

    2 жыл бұрын

    @@coreyhollaway7368 you can change the prompe in bach by change PS1 like export PS1="> "

  • @terranrepublican5522
    @terranrepublican55225 жыл бұрын

    Why don't you just use Open Build System from OpenSUSE? You can easily package software for all formats.

  • @EzeeLinux

    @EzeeLinux

    5 жыл бұрын

    That doesn't teach you how .deb packages work, though. That's the point of this video.

  • @hamzaodt3515
    @hamzaodt35154 жыл бұрын

    guys i have a problem when i try to dpkg-deb --build ... i get error "control directory has bad permission 700 (must be>=0755 and

  • @EzeeLinux

    @EzeeLinux

    4 жыл бұрын

    Make sure all the directories in you build directory are set for 755. Use 'chmod 755 directory-name' to do that. :)

  • @hamzaodt3515

    @hamzaodt3515

    4 жыл бұрын

    @@EzeeLinux yes it worked thanks

  • @JoshuaKisb
    @JoshuaKisb3 жыл бұрын

    seems like this should be automated

  • @user-lt6se4qn8v
    @user-lt6se4qn8v4 жыл бұрын

    for java ?

Келесі