How to make software packages under Linux system

  
        In general, there are three main ways to install software under Linux: one is source installation, and the user needs to manually compile another RPM package (RedHat Linux Packet Manager). The RPM command can be used to install it. Bin file, the installation method is similar to the installation process under Windows. Generally, the Linux installation software mainly uses the following two methods: 1 file name is xxx.i386.rpm, and the package is released in binary form. 2 File name is xxx.tar .gz, the software package is mostly released in the form of source code. Linux package management can be divided into three categories: binary package management, source code package management, script installation, and noteworthy is that there are currently various Linux distributions acquired and There are many ways to install the software, such as [] redhat/centos yum installation (with a dedicated image source) [] Ubuntu/Fedora/Debian sudo apt-get for deb package for management installation [] Some software is also through the disc The encrypted form is then installed (for example, cnyunwei) [] is also available in the system operation and maintenance management personnel. Over ssh, C /C ++ language or some software command execution py be automated management of applications, here is not described in detail. Below is a picture that clearly shows the architectural relationship of the Linux software application: when Linux is started. First, the kernel (kernel) is started. The kernel is a computer program that directly manages the management hardware, including the CPU, memory space, hard disk interface, network interface, and so on. All computer operations are passed to the hardware through the kernel. We can see that Linux uses the kernel to implement software and hardware conversations. Through this important interface of the system call, Linux completely separates the upper application from the underlying kernel, hiding the underlying complexity for the programmer (correspondingly, also improves the portability of the upper application). When we upgrade the kernel, we can also keep the system call statement unchanged, so that the upper application does not feel the underlying changes. Library functions use system calls to create modular functionality, while shells provide a user interface and allow us to script in the shell syntax to integrate programs. With these ideas, we can quickly understand the installation and working principle of Linux software applications, so in order to facilitate and obtain more enterprise applications, we need to develop on Linux system and compile various software packages through source code compilation. Service in the era. This article mainly introduces the source code installation and RPM package installation source package and commercial package according to the actual situation of each company or author (can be a tar and other format compression package, can also be the source code of bin, can be compiled Directly used to run files, or other media such as CD virtualization files to make published iso files, etc.) packaged into a specific format for publishing to perform the corresponding software services. In fact, the software installed by the yum or make install command will automatically generate rpm packages in the system (only the parameters and function modules are different and rigorous)

Introduction:

RPM (RedHat Package Manager, Red Hat Package Manager) ) for the installation, query, upgrade, verification, uninstallation of the software package, and the generation of the .rpm format package RPM before use.
Installing the linux system (centos4 as an example) installation CD, of course, also online Download the free RPM package. # mount/dev/cdrom --- Mount CD # cd/media/cdrom/CentOS/RPMS --- Enter the directory of the RPM package on the CD (you can view the CD mount by the #mount command) Points will generally be displayed in the last line) # ls I, source package installation 1, *.src.rpm form source code package usage: installation: rpm – rebuild *.src.rpmcd /usr/src/dist/RPMSRpm &ndash ;ivh *.rpmUninstall: rpm –e packagename2, .tar.gz, *.tgz, *.bz2 The installation of the package is first decompressed, the command is as follows tar zxvf *.tar.gztar xvfz *.tgztar xvfj *. After decompressing tar.bz2, enter the decompression directory, and then perform the following operations (in general, with Look at the file name of the package) Configuration: ./configure Compile: make install: make install uninstall: make uninstall source installation has certain difficulty, different software may have different installation, generally after decompression should read the documentation first, according to Explain the installation, the above is just the general situation. Second, the RPM package installation RPM installation package format is proposed by Redhat company, greatly simplifying the installation of software under Linux, first introduce the general options. -v: Display additional information -vv: Display debugging information--root directory: Let RPM use directory as the root directory, so pre-installer and post-installer will be installed in this directory. 1. Installation: rpm –i<options> file.rpmOptions:h: Output hash mark when installing test: test only for installation, not really installed --persent: display installation progress as a percentage --excludedocs: no software installed The documentation in the package -- replacepkgs: forced reinstall -- replacefiles: replace files belonging to other packages -- force: ignore packages and document conflicts -- ignorearch: do not verify package structure -- ignoreos: do not check packages Running operating system --nodeps: do not check dependency relationships --noscripts: do not run pre-install and post-install script 2, delete rpm – e<option> pkgnameOption:--test: only do delete test, do not really delete --noscripts: Do not run pre-installation and post-install scripts--nodeps: Do not check dependencies Note: pkgname is the name of the package, not the name of the rpm package, but the name of the package after installation, you can use the query command to query Package name. 3, upgrade rpm & ndash; U (or & mdash; upgrade) <option> file.rpmOption: Basically the same as the installation option, there are a few special: --oldpackage: allow an old version 4, query rpm – q ( Or --query)<option>Option:-p PACKAGE_FILE: Query the package file -f FIEL: Query which package FILE belongs to -a: Query all installed packages -g group: Query packages belonging to group group --whatproVidesCAPABILITY: Query the package that provides the CAPABILITY function--whatrequiresCAPABILITY: query all packages that require CAPABILITY -i: display package summary information -l: display file list in package -c: display configuration file list -s: Display file list - scripts: display installation, uninstall, check script --qf: query in the way specified by the user --dump: display check information for each file --proVides: display the functions provided by the package - R: Display the functions required by the software package. 5. Verify that the installed software package rpm –V(or –verify,or –y)<option>Option options are similar to other commands. Verify the file rpm –K(or –checksig)<option> file.rpmOption:-v: display version information -vv: display debugging information --rcfile FILELIST: set rpmrc file to FILELIST7, other RPM Options --rebuilddb: Rebuild RPM repository --initdb: Create a new RPM repository --quiet: Reduce output as much as possible --help: display help files --version: shows the current version of RPM just for common options To sum up, what are the specific problems, you can use the man rpm command to view, the official document is always the best teacher. Third, *.bin format installation file installation just double-click or click *.bin file can be installed according to the prompt, no longer described. To make a package in RPM format, you need to write a package description file. The standard naming format is: software name - version number - release number. spec (now in most cases directly: software name. spec), this file, detailed description of the package for a lot of information, such as the software name , version, category, description summary, what instructions to execute when creating, what to do when installing, and what files to include in the package. With this file, RPM can make the corresponding package file. Of course, there are now open source package creation tools such as Source rpm, as long as a program source can be produced through the wizard. A simple production example: In fact, the best way is to make a package. I remember that both rpm and debian have fast-packaged open source software that you can use directly. Eg>> Make the nginx tarball as an RPM package 1. Download the nginx source package 2. Place the file in the /usr/src/redhat/SOURCES/directory 3. Write the SPEC file [root@mail SPECS]# vinginx -0.8.35.specSummary:the first rpmpackageName:nginxVersion:0.8Release:35Vendor:[email protected]:ShareGroup:Applications/TextSource0:nginx-0.8.35.tar.gz%descriptionmy test nginx%preptar -zxvf $ RPM_SOURCES_DIR/nginx-0.8.35.tar.gz%buildcd$RPM_BUILD_DIR/nginx-0.8.35./configuremake%installcd$RPM_BUILD_DIR/nginx-0.8.35make install%cleanrm -rf$RPM_BUILD_DIR/nginx-0.8.35%files% Defattr(-,root,root)/usr/local/nginx/sbin/nginx%doc $RPM_BUILD_DIR/nginx-0.8.35/README4. Make RPM package [root@mail SPECS]#rpmbuild -ba nginx-0.8.35. If there is no error in the spec, then /usr/src/redhat/RPMS/i386/nginx-0.8-35.i386.rpm and /usr/src/redhat/SRPMS/nginx-0.8-35.src.rpm are generated. .

Copyright © Windows knowledge All Rights Reserved