0% found this document useful (0 votes)
34 views

Working With Source Packages: Enable Deb-Src Entry in Your /etc/apt/sources - List (Uncommented)

The document discusses the process of working with source packages in Debian/Ubuntu. It explains how to download source packages using apt-get source, build packages from source using dpkg-buildpackage, and install the built packages. It also covers how to check build dependencies and automatically install them using apt-get build-dep.

Uploaded by

shithindasmk
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Working With Source Packages: Enable Deb-Src Entry in Your /etc/apt/sources - List (Uncommented)

The document discusses the process of working with source packages in Debian/Ubuntu. It explains how to download source packages using apt-get source, build packages from source using dpkg-buildpackage, and install the built packages. It also covers how to check build dependencies and automatically install them using apt-get build-dep.

Uploaded by

shithindasmk
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Working with source packages

1. Enable deb-src entry in your /etc/apt/sources.list (uncommented).

2. To download a source package, you would use the following command: $ apt-get source packagename eg: - apt-get source vsftpd This will download three files: .orig.tar.gz .dsc .diff.gz In the case of packages made specifically for Debian, the last of these is not downloaded and the first usually won't have "orig" in the name.

3. To create the .deb file $ dpkg-buildpackage -rfakeroot -uc -b or (# dpkg-buildpackage -uc -b) Note : run this command from same directory which contains source dpkg-buildpackage - build binary or source packages from sources -uc -b Do not sign the .changes file. Specifies a binary-only build, no source files are to be built and/or distributed.

-rgain-root-command When dpkg-buildpackage needs to execute part of the build process as root, it prefixes the command it executes with gain-root-command if one has been specified. Otherwise, if none has been specified, fakeroot will be used by default, if the command is present. su is not suitable, since it can only invoke the user's shell. fakeroot runs a command in an environment wherein it appears to have root privileges for file manipulation. This is useful for allowing users to create archives (tar, ar, .deb etc.) with files in them with root permissions/ownership. Without fakeroot one would need to have root privileges to create the constituent files of the archives with the correct permissions and ownership, and then pack them up, or one would have to construct the archives directly, without using the archiver.

Note: -it will create a .deb package and .changes file

4. To auto-build the package when it's been downloaded, just add -b to the command line, like this: $ apt-get -b source packagename eg:- apt-get -b vsftpd note:- this will autobuild package from source and will get a .deb file. But all dependencies for that package must be installed prior.

5.To install the package built by the commands above $ dpkg -i vsftpd_2.3.2-3ubuntu5_amd64.deb

Packages needed for compiling a source package


Normally, specific headers and shared libraries need to be present in order for a source package to be compiled. All source packages have a field in their control files called 'BuildDepends:' that indicates which additional packages are needed for the package to be built from source Run apt-get build-dep package, where `package' is the name of the package you're going to build. apt-get build-deb vsftpd build-dep causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package. To find which all are dependencies needed apt-cache show vsftpd

You might also like