Revision as of 09:56, 13 February 2016

Students will learn about rpm and dnf/yum package tooling and then actually create their own package from code, upload it to a public package repository and finally have a classmate install their compiled package. This can be advertised to students as being able to distribute their own linux-based application to the world.

Prerequisite Knowledge

Students should be familiar with:

Beginner to Intermediate Shell knowledge (linux command line)

Getting around the linux file system, sudo'ing, editing files, etc.

Making and compiling Linux software code

see extended note in Comments section below

Learning Objectives

Upon completion, students should be able to:

Install RPM's and use the dnf/yum command to inspect and install packages

Students may wonder how they can distribute linux-based code that they develop out to other everyday users. Not many users enjoy compiling code, so the RPM package structure allows easy installation of binary pre-compiled code packages. Basically, a student could have coded a small sample command-line application and now they can send it to others easily. The other side of it is that students, as users of Linux, will be interfacing with RPM packages not of their making and it will be good to have an understanding of the backends of how this works. Students will interface with the dnf and yum commands even if simply using linux for fun. Now, they can have knowledge into how it works and how they can employ it for their careers and personal uses.

Directions:

Keep a working log

Log your shell commands, answers to questions, and commentary in a text file, wiki, or blog. You will be constructing and troubleshooting numerous linux shell command's and their outputs. Your assignment is to document these commands and the process you went through in an organized fashion. You might use bullet points or a new set of commands on each line. Make sure it is easily consumable by a human (your instructor), as well as yourself 10 years from now.

The data that is the output of the commands is not as interesting as a summary or comment of their output or on what the command has done - ex: failed, succeeded, why, what it did, what it changed, etc. Write these in complete sentences. Commentary is especially important if you run into problems. When this occurs, state the problem and how you intend to solve it. At the end, you should have a text document with all of the commands, right and wrong, that you went through to get this activity completed. It should read as a timeline of what you did and what your thoughts were, to get the assignment complete. After this is complete, you will summarize the most useful commands into a sort of cheatsheet - this can come in useful for years to come.

You might consider upping your terminal windows buffer for the number of lines it holds, to somewhere in the tens of thousands - just in case you decide you want to come back to something you learned a while back, or in case a command spits out thousands of lines of results - which can happen. Some terminal applications can record commands and output to text files. Either way, make your written log human readable, make it a story if you wish. When you come back to this years from now, needing to remind yourself how to package some newly minted code, you want a summary/cheatsheet and you want to be able to understand the context and follow your thoughts of why you tried certain things. You don't want to be parsing through lines and lines of shell input and output.

The activity will follow these general steps

Use dnf/yum and rpm files.

Learn about creating rpm's and the rpmbuild command.

Package the htop project into an RPM.

Step 1: dnf / yum and .rpm's

First, lets do some learning before we jump into shell commands. Answer the following in your log:

What is the difference between dnf and yum? Why was the change made?

What are .rpm files? Where might you find them and how are they used?

Use the dnf command to view what packages have been recently installed on your machine.

Hint: There is a specific command for this. man dnf is your friend

Attempting to list all packages will often be quite a long listing.

Use the dnf command to install a .rpm package not currently installed on your machine.

Pick something simple, as you will need to operate it in the next steps.

Hint: If you dont find your own (more credit given for this), you can install screen

Use dnf to show that the new package is now installed.

Run or operate this newly installed utility. Where did dnf place the executable file?

Particularly, students should have experience using the configure, make, and make install commands

If students have not compiled in the past, it is common to not have all of the required libraries and modules already installed for the compilation process to succeed. This is a major part of creating RPM's. This setup takes time to troubleshoot and setup, and it could be different on each system if students are not using identical operating systems.

If you wanted to do this activity in Ubuntu, Debian, etc:

Students could optionally do this activity on Ubuntu or other Linux OS's which use a different Package Management toolset.

Ubuntu is debian-based and uses the ``dpkg`` command. For more info on equivalent commands, see: