We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Imagine you are developing an application which runs on Linux (I'm using Ubuntu) and requires a number of packages to be able to run.
One way would be to just install the packages as needed, but sooner than later, you'll forget which packages are needed. It becomes an even bigger problem when you want to install the same set of packages on your production systems.
Therefor, the approach I take is to keep a file called packages.list
as part of the source repository in which I keep track of the packages I need. It's largely inspired on the requirements.txt
approach often found in Python projects.
The content is simple: one package per line.
packages.list:
# Movie processing
ffmpeg
# PDF processing
mupdf-tools
poppler-utils
qpdf
Now, it would be very easy to have a single command to use apt
to install / update these packages on any system. Well, here is a command that will do exactly that:
sudo apt install -y $(grep -o ^[^#][[:alnum:]-]* "packages.list")
The grep
command filters out all invalid lines (e.g. the ones which are commented out) and then uses apt install
to install them on the system.
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.