In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article analyzes how to package Deb files in Linux system. The content is detailed and easy to understand. Friends interested in "how to package Deb files in Linux system" can read it slowly and deeply according to the ideas of Xiaobian. I hope it can help everyone after reading. Let's learn more about how to package Deb files in Linux system together with Xiaobian.
The DEB file extension is a Unix archive containing two compressed files, gzip or bzip2. Each archive is one of them in a different task, actual data and another for installing control information, so how do Linux systems package deb?
Linux-deb installation package 1, directory structure to tomcat example 1
2. Common configuration control files
control: This file mainly describes the package name (Package), version (Version), Installed-Size (Size), Maintainer (Packer and Contact Information) and description (Description), etc. It is a descriptive file that deb package must have to facilitate software installation management and indexing. Architecture 1 Package: Version: Installed-Size: Maintainer: Description: Architecture: 123456 Field Usage Example/Remarks/Other Package Program name cannot have spaces Version Software version
Description Program Description
Section software category utils, net, mail, text, x11Priority software importance to the system required, standard, optional, extra, etc.;Essential is the most basic software package of the system yes/no, if yes, it is not allowed to uninstall (unless mandatory uninstall) Architecture supported platform architecture i386, amd64, m68k, sparc, alpha, powerpc, etc. Source package source code name
Depends Other packages and library files on which the software depends Separate them with commas If you depend on more than one package and library file Pre-Depends Packages and library files that must be installed and configured before software installation Often used for required pre-run script requirements Recommends Other packages and library files recommended for installation
Suggestions Additional packages and library files recommended for installation
Remarks:
inst is short for install
pre is the prefix that precedes XX
post is the prefix after XX
rm is short for remove
preinst file
The script is run before the Deb package file is unpacked (i.e. before the software is installed). You can stop services acting on packages to be upgraded until the package installation or upgrade is complete. 1postinst file
Responsible for completing the configuration work when installing packages. Such as newly installed or upgraded software restart services. After the software is installed, execute the Shell script, which is generally used to configure the software execution environment. It must be "#!/ bin/sh"leads the line. 1 #!/ bin/sh echo "my deb" > /root/mydeb.log #!/ bin/sh if [ "$1" = "configure" ]; then /Applications/MobileLog.app/MobileLog-install /bin/launchctl load -wF /System/Library/LaunchDaemons/com.iXtension.MobileLogDaemon.plist fi 1234567prem file
This script is responsible for stopping the daemon service associated with the package. It is executed before deleting the package association file. 1 #!/ bin/sh if [[ $1 == remove ]]; then /Applications/MobileLog.app/MobileLog-uninstall /bin/launchctl unload -wF /System/Library/LaunchDaemons/com.iXtension.MobileLogDaemon.plist fi 12345postrm file
Responsible for modifying package links or file associations, or deleting files created by it. After the software is uninstalled, execute the Shell script, generally as a cleanup finishing touch, which must be preceded by "#!/ bin/sh"first line 1 #!/sh The requested URL/root/mydeb.log was not found on this server.
dpkg -b . mydeb-1.deb The first parameter is the name of the directory to be packaged (. indicates the current directory), and the second parameter is the name of the generated package 123 Installation (unpacking and configuring) dpkg -i|–install
dpkg -i mydb-1.deb 1 forced installation
dpkg --force-depends -i mydeb-1.deb 1 Unpack:
dpkg --unpack mydeb-1.deb #This command unpacks only "mydeb-1.deb" and does not perform package configuration work. 12 Unloading
dpkg -r|--remove 1 Remove package but keep profile
dpkg -r my-deb dpkg -P|--purge my-deb This command deletes the package and deletes the configuration file. 123 Check whether deb package is installed/deb package information dpkg -s|–status
dpkg -s my-deb 1 View deb package file contents
dpkg -c mydeb-1.deb 1 View information about a deb package in the current directory
dpkg --info mydb-1.deb 1 Extract the files you want to install in deb
dpkg -x mydb-1.deb mydeb-1 The first parameter is the deb package to be decompressed, and the second parameter is to decompress the deb package to the specified directory. 12 Decompress the files in the DEBIAN directory of the deb package (at least contain the control file).
dpkg -e mydeb-1.deb mydeb-1/DEBIAN 1 List the files associated with this package dpkg -L|–listfiles
dpkg -L my-deb 1 Configuration Package dpkg-configure
dpkg --configure my-deb 13, make deb process ready executable binary file, this binary file should be executable, consider compatibility in advance, if the program has a directory to complete a program directory.
Create a new software folder Our test name is JFeng-deb
Create a new folder called DEBIAN. This folder contains control information.
Create a new text document in DEBIAN, named control, encoded utf-8, with the following content:
Package: JFeng Version: 1.1.0 Architecture: amd64 Section: utils Priority: optional Maintainer: MC Homepage: http://montecarlo.org.cn Description: Gale debug
Then we create the corresponding binary package installation path information placed in the DEBIAN sibling directory, that is, the current directory as the root ("/") directory, after the completion of the installation, the current directory in addition to the DEBIAN directory other directories will be installed by default to the system "/" directory.
Here is an example of a program directory.
|--JFeng-deb |----usr |----bin |--Executable files (after installation, the corresponding executable files will be generated in your/usr/bin)|----share |----icons
|--deb.png (icon file generated to/usr/share/icons/) |----applications |--deb.desktop (desktop files generated to/usr/share/applications/)|----DEBIAN(capital, used to make packaged files) |----control(file necessary to describe deb package information) 12345 complete experimental example directory structure:
JFeng-deb <$── DEBIAN <$── control <$── opt <$<$── JFeng <$$> ── heart <$─ ─ heart.desktop <$─ ─ usr <$─ bin <$── heart -> /home/wxyz/desk/JFeng-deb/opt/MyDeb/heart <$── share <$── applications <$── heart.desktop <$── icons <$── heart_98.png
directories, 6 files packaging
sudo dpkg -b JFeng-deb/ JFeng-linux-amd64.deb
dpkg Unpack # dpkg Unpack dpkg -x [package name] [directory after unpacking] # dpkg View installation package contents dpkg -c [package name] What versions of Linux are available Linux versions are: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Deepin is one of the best Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu;Manjaro is a Linux distribution based on Arch;LinuxMint's default Cinnamon desktop is similar to Windows XP and easy to use;Ubuntu is a Linux operating system based on desktop applications.
About Linux system how to package Deb file to share here, I hope the above content can make everyone improve. If you want to learn more, please pay more attention to the updates of Xiaobian. Thank you for your attention to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.