Linux Package Management (Distribute Your App)

(Difference between revisions)
Jump to: navigation, search
(moved pre-req extended to comments section)
(added heavily to Directions section - gave various subsections; added working log description; added categories; added to and prettied up related activies;)
Line 7: Line 7:
 
|-  
 
|-  
 
|'''Prerequisite Knowledge''' ||  Students should be familiar with:
 
|'''Prerequisite Knowledge''' ||  Students should be familiar with:
* Beginner Shell knowledge (linux command line)
+
* Beginner to Intermediate Shell knowledge (linux command line)
* Getting around the linux file system, sudo'ing, editing files, etc.
+
** Getting around the linux file system, sudo'ing, editing files, etc.
 
* Making and compiling Linux software code
 
* Making and compiling Linux software code
 
** see extended note in Comments section below
 
** see extended note in Comments section below
Line 20: Line 20:
  
 
=== Background: ===
 
=== Background: ===
* Is there background reading material?
+
Is there background reading material?
** Read about the various software installation methods on Linux: http://www.howtogeek.com/191245/beginner-geek-how-to-install-software-on-linux/
+
* Read about the various software installation methods on Linux: http://www.howtogeek.com/191245/beginner-geek-how-to-install-software-on-linux/
** http://www.control-escape.com/linux/lx-swinstall.html
+
* http://www.control-escape.com/linux/lx-swinstall.html
** https://help.ubuntu.com/community/SoftwarePackagingFormats
+
* https://help.ubuntu.com/community/SoftwarePackagingFormats
** https://wiki.archlinux.org/index.php/Arch_User_Repository, https://wiki.archlinux.org/index.php/Arch_packaging_standards
+
* https://wiki.archlinux.org/index.php/Arch_User_Repository, https://wiki.archlinux.org/index.php/Arch_packaging_standards
** https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Writing_a_package_from_scratch
+
* https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#Writing_a_package_from_scratch
** http://www.rpm.org/wiki/Docs
+
* http://www.rpm.org/wiki/Docs
 +
* https://en.m.wikipedia.org/wiki/DNF_(software)
  
* Are there other related activities?
+
Are there other related activities?
** Students can follow the [[Linux_Beginner_Activity]] to get command-line basics.
+
* Students can follow the [[Linux_Beginner_Activity]] to get command-line basics.
*** Note that the requirements above ask for slightly more in-depth command-line experience via sudo and code compilation.
+
** Note that the requirements above ask for slightly more in-depth command-line experience via sudo and code compilation.
** If students need virtual linux machines for command-line access, they can use [http://foss2serve.org/index.php/Installing_a_Virtual_Machine Virtualbox as seen in this activity].
+
* If students need virtual linux machines for command-line access, they can use [[Installing_a_Virtual_Machine Virtualbox as seen in this activity]].
 +
* Students can follow the [[Introduction_to_building_open_source_software]] or the [[Building_a_GnomeMusic_Clone]] activities to get linux compilation and build experience.
  
* What is the rationale for this activity?
+
What is the rationale for this activity?
** 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.
+
* 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.
  
* If you wanted to do this activity in Ubuntu, Debian, etc:
+
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.  
+
* 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:
+
* Ubuntu is debian-based and uses the ``dpkg`` command. For more info on equivalent commands, see:
*** http://wiki.openvz.org/Package_managers
+
** http://wiki.openvz.org/Package_managers
*** http://askubuntu.com/questions/85839/deb-equivalents-to-rpm-commands/85849
+
** http://askubuntu.com/questions/85839/deb-equivalents-to-rpm-commands/85849
  
  
 
=== Directions: ===
 
=== Directions: ===
# Learn about dnf/yum and rpm files. Have students find it themselves. https://en.m.wikipedia.org/wiki/DNF_(software),
+
 
 +
==== 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 all commands and output to text files. Either way, make it human readable, make it a story. When you come back to this years from now, needing to remind yourself how to package some newly minted code, 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 ====
 +
# Learn about dnf/yum and rpm files. Have students find it themselves.
 
# Learn about creating rpm's and rpmbuild command
 
# Learn about creating rpm's and rpmbuild command
#* [https://www.youtube.com/watch?v=4J_Iksu1fgo&feature=youtu.be RPM Build Example Video] - Watch, at least, the first 8 mins of this video from a recording of a local Linux User Group meeting
 
#* [ftp://ftp.eso.org/midaspub/RPMS-tutorial/GURULABS-RPM-GUIDE-v1.0.PDF RPM process Diagram from video] - Find the diagram that the video references on the page labeled 12-17
 
#** Document authored by Guru Labs, L.C. released under the CC-BY-NC-ND 2.0 license
 
 
# Use an existing, easy, mature, yet small project like wget or top (or something that doesn't come standard on most systems) to have students compile and make and package.
 
# Use an existing, easy, mature, yet small project like wget or top (or something that doesn't come standard on most systems) to have students compile and make and package.
#* See example of [http://www.ibm.com/developerworks/library/l-rpm1/ packaging the `wget` command]
+
 
# Have students rename it so the command line can be run as a test
+
'''Consider breaking these into a new activity'''
 
# Have students host the package on a web source (ftp? Some free internet service that makes the .rpm accessible by URL)
 
# Have students host the package on a web source (ftp? Some free internet service that makes the .rpm accessible by URL)
 
#* Package Repo location
 
#* Package Repo location
Line 59: Line 68:
  
  
 +
==== dnf / yum ====
 +
* 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 are already installed on your machine.
 +
* 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.
 +
* Use dnf to show that the new package is now installed.
 +
* Run or operate this newly installed package. Where did dnf place the executable file?
 +
 +
 +
==== RPM's and rpmbuild ====
 +
* [https://www.youtube.com/watch?v=4J_Iksu1fgo&feature=youtu.be RPM Build Example Video] - Watch, at least, the first 8 mins of this video from a recording of a local Linux User Group meeting
 +
* [ftp://ftp.eso.org/midaspub/RPMS-tutorial/GURULABS-RPM-GUIDE-v1.0.PDF RPM process Diagram from video] - Find the diagram that the video references on the page labeled 12-17
 +
** Document authored by Guru Labs, L.C. released under the CC-BY-NC-ND 2.0 license
 +
 +
 +
==== Create your own RPM ====
 +
* See example of [http://www.ibm.com/developerworks/library/l-rpm1/ packaging the `wget` command]
  
  

Revision as of 22:35, 12 February 2016

Title Linux package management (distribute desktop apps) (build your own linux package)
Overview 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
  • Make and Compile existing code into a binary RPM package
  • Upload a package to an online repository
  • Install a package from an online repository

Background:

Is there background reading material?

Are there other related activities?

What is the rationale for this activity?

  • 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.

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


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 all commands and output to text files. Either way, make it human readable, make it a story. When you come back to this years from now, needing to remind yourself how to package some newly minted code, 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

  1. Learn about dnf/yum and rpm files. Have students find it themselves.
  2. Learn about creating rpm's and rpmbuild command
  3. Use an existing, easy, mature, yet small project like wget or top (or something that doesn't come standard on most systems) to have students compile and make and package.

Consider breaking these into a new activity

  1. Have students host the package on a web source (ftp? Some free internet service that makes the .rpm accessible by URL)
  2. Have each student in the class pair up and try to install the other person's RPM and run the new command


dnf / yum

  • 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 are already installed on your machine.
  • 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.
  • Use dnf to show that the new package is now installed.
  • Run or operate this newly installed package. Where did dnf place the executable file?


RPM's and rpmbuild

  • RPM Build Example Video - Watch, at least, the first 8 mins of this video from a recording of a local Linux User Group meeting
  • RPM process Diagram from video - Find the diagram that the video references on the page labeled 12-17
    • Document authored by Guru Labs, L.C. released under the CC-BY-NC-ND 2.0 license


Create your own RPM


Deliverables:

What will the student hand in?


Assessment:

How will the activity be graded?

How will learning will be measured?

Criteria Level 1 (fail) Level 2 (pass) Level 3 (good) Level 4 (exceptional)
Installs and inspects RPMs with dnf/yum
Compiles code into binary RPM
Uploads RPM to COPR or other online repo
Installs colleagues RPM from COPR

Comments:

What should the instructor know before using this activity?

  • Students should know how to compile Linux software code before doing this activity.
    • There exists an activity which covers this: Introduction_to_building_open_source_software
    • 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.

What are some likely difficulties that an instructor may encounter using this activity?


Additional Information:

ACM Knowledge Area/Knowledge Unit What ACM Computing Curricula 2013 knowledge area and units does this activity cover? ACM_Body_of_Knowledge
ACM Topic What specific topics are addressed? The Computing Curriucula 2013 provides a list of topics - https://www.acm.org/education/CS2013-final-report.pdf
Level of Difficulty Is this activity easy, medium or challenging?
Estimated Time to Completion How long should it take for the student to complete the activity?
Materials/Environment
  • Access to the shell of a Linux operating system that uses RPM (virtualized or on hardware can work)
  • root access is likely needed - another good vote for virtualized systems (might use openshift or virtualbox)
Author Who wrote this activity?
Source Is there another activity on which this activity is based? If so, please provide a link to the original resource.
License Under which license is this material made available? (http://creativecommons.org/licenses/)

Suggestions for Open Source Community:

Suggestions for an open source community member who is working in conjunction with the instructor.



This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

CC license.png

Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox