Can you build apt-get from source?

apt's source code is available on Salsa, but it isn't designed to serve as a basis for bootstrapping a distribution from source. To bootstrap a Debian-based (apt-based) distribution, you need to use a tool such as debootstrap, which itself needs quite a number of programs to run (although since your filesystem isn't empty, but includes the basic Linux tools, it might already have everything needed). Usually, bootstrapping a system in this way involves either using another Debian-style system, or running an installer.

If you want to build a system from source, pulling yourself up by your bootstraps, you should look at Linux from Scratch.


You can build apt-get from source. The source of a Debian package is always available from the package page (except for some packages in the non-free component). However this won't help you.

To install Debian or Ubuntu on a system where you have a running Linux kernel, use debootstrap. Debootstrap downloads and installs a basic system. For installation on a system where debootstrap isn't running, use the two-phase mode: first run debootstrap with the --foreign option and the right --arch option on a Unix system (not necessarily Debian, you can run Debootstrap on any system with basic Unix shell utilities and wget), then copy the resulting files to the target system's root directory. The busybox binary from Debian's busybox-static may help, e.g. to pack the files into an archive and busybox tar -xzf - them.

Tags:

Apt