You are on page 1of 18

Distributions, Compiling, and

Packaging
Harrison Kuo
ocf.io/decal/slides/4

Sign-In
https://tinyurl.com/ocf95

Slido
https://slido.com with event code L399
Topics
● Distributions
● Compilation
● Packaging
Distributions?
● Basically the Linux kernel + other software = operating system
● Because there are many different configurations of the kernel and other software,
Linux OS have a term called “distributions”
● Basically a car.
○ Kernel -> Engine
○ Drivers -> Wires
○ Applications -> Radio, Car seat
● Comes in three distinct flavors like ice cream.
○ Debian, Red Hat Enterprise Linux, Arch
● Are spun off a lot.
○ Debian -> Ubuntu, RHEL -> Scientific Linux, Arch -> Manjaro
Debian
● Debuted in late 1993
● Why?
○ Stable
○ User-friendly
○ Respects your privacy (cough cough pre-16.04 vanilla Ubuntu cough)
● Uses apt/dpkg as the package manager
Wait what’s a package manager?

https://courses.edx.org/c4x/LinuxFoundationX/LFS101x/asset/LFS01_ch06_screen60.jpg
But really, what is it?

https://en.opensuse.org/images/c/c3/Packagemanagement.png
What?
● Repository -> Costco
● Package list -> Catalogue
● Package -> Treadmill
Wait how do I use one then?
apt update

Grabs a new list (catalogue) of what packages are available.

apt install packagenamehere

Installs the package.

apt remove

Uninstalls the package.


Wait how do I use one then?
apt dist-upgrade

Updates the packages and resolves package conflicts/removals.

apt-cache search packagesearchterm

Searches for the package in the catalogue


A Demonstration of Superior Judgement
● Install random package (cowsay).
Ok now, how do I make a package?
● You have to make something useful to package.
○ You first make the cake then you put it in a box, not the other way around.
● Usually involves compiling something.
● Usually involves downloading something from the internet then compiling
something.
● Usually involves writing a program then compiling it.
● Then you create a package.
● Pain in the ass historically.
Compilation
● Usually packages downloaded from the web have a Makefile.
● Basically they make the application for you as long you have the right things
installed (like compilers like GCC).
● First ./configure --prefix=”some absolute path here”
● Just run make and then make install.
Compi-what?
● Turns source code into a real executable.
● Turns ingredients/recipe into a real cake.
● gcc hellopenguin.c -o hellopenguin
Packaging Basics

/usr

/usr/bin /usr/lib /usr/include /usr/share


Executables/Binaries Libraries Header Files Documentation/Etc
Packaging Basics

.deb Metadata
version#, name, etc
/usr

/usr/bin /usr/lib /usr/include /usr/share


Executables/Binaries Libraries Header Files Documentation/Etc
Packaging
● Pain in the ass
● We’re going to use FPM, which is a Ruby Gem.
● sudo apt install ruby-dev
● sudo gem install fpm
● fpm -s dir -t deb -n [name here] -v [version #] -C [the
directory with the /usr folder]
More Resources?
Google

FPM documentation

Debian documentation
Assignment
● ocf.io/decal/labs/4
○ Install gcc, ruby-dev
○ Get FFTW then compile it
○ Write your own “hellopenguin” program, compile it, then package
it, then install it.

You might also like