Linux Packages for Distributions




Distribution軟體管理機制使用指令線上升級機制(指令)
Red Hat/FedoraRPMrpm, rpmbuildYUM (yum), DNF(dnf).

yum update glibc

Debian/UbuntuDPKGdpkgAPT (apt-get)



RedHat


Install OpenCV-Python in Fedora


OpenCV-Python requires only Numpy (in addition to other dependencies, which we will see later). But in this tutorials, we also use Matplotlib for some easy and nice plotting purposes (which I feel much better compared to OpenCV).
Matplotlib is optional, but highly recommended.
Similarly we will also see IPython, an Interactive Python Terminal, which is also highly recommended.

Install all packages with following command in terminal as root.

$ yum install numpy opencv*

Open Python IDLE (or IPython) and type following codes in Python terminal.

>>> import cv2
>>> print cv2.__version__

If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

Yum repositories may not contain the latest version of OpenCV always.
You can compile from source to get the latest version.

Install ffmpeg


FFmpeg is an open source software used to convert video/audio into different format.

To Install ffmpeg on Fedora 24, install rpmfusion repository.

rpm -ivh https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-24.noarch.rpm
rpm -ivh https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-24.noarch.rpm
Update your package cache

dnf update
Now install ffmpeg with

dnf install ffmpeg
Check the installation

ffmpeg -version
rpm -qa | grep ffmpeg


Installing OpenCV from source


Ubuntu


Ubuntu live server

Ubuntu 從 18.04 開始 server 版本改用 https://github.com/CanonicalLtd/subiquity 這個工具來安裝系統,
subiquity會使用安裝媒體上面預先製作好的 root filesystem 直接解開安裝到機器上,最後提供一個機制可以從 Github 或是 Launchpad 自動下載 SSH public key 來使用,只要提供帳號就可以了。
Subiquity name basically means “Ubiquity for Server” .
The installer is more text based installation.
When the text-based wizard starts, the Welcome page will be shown for you to choose the language to be used .

DPKG


  • query all the files the package installed onto your system
  • 
    dpkg-query -L package_name
    

Using apt Commands in Linux

APT (Advanced Package Tool) is the command line tool to interact with the packaging system in Debian-based Linux distributions.
There is already dpkg commands to manage it. But APT is a more friendly way to handle packaging. You can use it to find and install new packages, upgrade packages, remove the packages etc.
apt consists some of the most widely used features from apt-get and apt-cache leaving aside obscure and seldom used features. It can also manage apt.conf file.
Let’s see which apt command replaces which apt-get and apt-cache command options.
apt commandthe command it replacesfunction of the command
apt installapt-get installInstalls a package
apt removeapt-get removeRemoves a package
apt purgeapt-get purgeRemoves package with configuration
apt updateapt-get updateRefreshes repository index
apt upgradeapt-get upgradeUpgrades all upgradable packages
apt autoremoveapt-get autoremoveRemoves unwanted packages
apt full-upgradeapt-get dist-upgradeUpgrades packages with auto-handling of dependencies
apt searchapt-cache searchSearches for the program
apt showapt-cache showShows package details
 
The good thing here is that you can use auto-completion while using apt install.
So, if you are not sure about the exact package name, you can type a few letters and press Tab and it will suggest all the packages available with those letters.
apt has a few commands of its own as well.

new apt commandfunction of the command
apt listLists packages with criteria (installed, upgradable etc)
apt edit-sourcesEdits sources list
By default, the latest version available in the repository will be installed for an application. But if you don’t want to install the latest version, you can specify the version number. You would need to know the exact version number that you want to install.

sudo apt install <package_name>=<version_number>

Use Apt-Get to Install Specific Version of Package

Use the apt-cache command to check the version of the package installed on your system plus all available packages in the Ubuntu repository.

$ sudo apt-get update
$ sudo apt-cache search modemmanager
[sudo] password for jerry: 
gir1.2-modemmanager-1.0 - GObject introspection data for modemmanager
libmm-glib-dev - D-Bus service for managing modems - library development files
libmm-glib-doc - D-Bus service for managing modems - library documentation
libmm-glib0 - D-Bus service for managing modems - shared libraries
modemmanager - D-Bus service for managing modems
modemmanager-dev - D-Bus service for managing modems - development files
modemmanager-doc - D-Bus service for managing modems - documentation files
hdmi2usb-udev - udev rules for HDMI2USB devices
libkf5modemmanagerqt-doc - Qt wrapper library for ModemManager (documentation)
libkf5modemmanagerqt6 - Qt wrapper library for ModemManager
modem-manager-gui - GUI front-end for ModemManager / Wader / oFono
modem-manager-gui-help - GUI front-end for ModemManager / Wader / oFono - documentation
modemmanager-qt-dev - Qt wrapper for ModemManager - devel files
To add the following lines to /etc/apt/sources.list in the Hirsute release:

deb http://tw.archive.ubuntu.com/ubuntu/ impish main restricted
deb http://tw.archive.ubuntu.com/ubuntu/ impish universe
deb http://tw.archive.ubuntu.com/ubuntu/ impish-updates main restricted
deb http://tw.archive.ubuntu.com/ubuntu/ impish-updates universe
deb http://tw.archive.ubuntu.com/ubuntu/ impish-backports main restricted universe multiverse
To show whether the package is installed, which version is available from which repository and its priority:

$ sudo apt-cache policy modemmanager      
modemmanager:
  Installed: 1.14.10-0.1
  Candidate: 1.16.6-2
  Version table:
     1.16.6-2 500
        500 http://tw.archive.ubuntu.com/ubuntu impish/main amd64 Packages
 *** 1.14.10-0.1 500
        500 http://tw.archive.ubuntu.com/ubuntu hirsute/main amd64 Packages
        100 /var/lib/dpkg/status
The same package may have more than one version with a different priority.
APT installs the version with higher priority unless the installed version is newer.

A specific version of a package can be selected for installation by following the package name with an equals and the version of the package to select.


$ sudo apt-get install modemmanager=1.14.10-0.1
A specific distribution can be selected by following the package name with a slash and the version of the distribution or the Archive name (stable, frozen, unstable).

$ sudo apt install modemmanager/impish
$ sudo apt install libqmi-utils/impish

The Debian Administrator's Handbook

Chapter 6. Maintenance and Updates: The APT Tools

APT needs to be given a “list of package sources (repositories)”: the file /etc/apt/sources.list will list the different repositories that publish Debian packages.

APT will then import the list of packages published by each of these sources.

6.1. Filling in the sources.list File

6.1.1. Syntax
Each active line in the /etc/apt/sources.list file represents a package source (repository) and is made of at least three parts separated by spaces.

deb       url   distribution component1 component2 component3 [..] componentX
deb-src   url   distribution component1 component2 component3 [..] componentX
  • The first field indicates the source type
    • deb
    • package source (repository) of binary packages
    • deb-src
    • package source (repository) of source packages
  • The second field gives the base URL of the source.
  • The syntax of the last field depends on the structure of the repository.
6.1.2. Repositories for Stable Users
6.1.3. Repositories for Testing/Unstable Users
6.1.4. Using Alternate Mirrors
6.1.5. Non-Official Resources: mentors.debian.net
6.1.6. Caching Proxy for Debian Packages

6.2. aptitude, apt-get, and apt Commands

6.2.1. Initialization
6.2.2. Installing and Removing
6.2.3. System Upgrade
6.2.4. Configuration Options
6.2.5. Managing Package Priorities
6.2.6. Working with Several Distributions
6.2.7. Tracking Automatically Installed Packages

6.3. The apt-cache Command

6.4. The apt-file Command

6.5. Frontends: aptitude, synaptic

6.5.1. aptitude
6.5.2. synaptic

6.6. Checking Package Authenticity

6.7. Upgrading from One Stable Distribution to the Next

6.7.1. Recommended Procedure
6.7.2. Handling Problems after an Upgrade
6.7.3. Cleaning Up after an Upgrade

6.8. Keeping a System Up to Date

6.9. Automatic Upgrades

6.9.1. Configuring dpkg
6.9.2. Configuring APT
6.9.3. Configuring debconf
6.9.4. Handling Command Line Interactions
6.9.5. The Miracle Combination

Packaging/PPA(Personal Package Archive)

Using a Personal Package Archive (PPA), you can distribute software and updates directly to Ubuntu users.
Create your source package, upload it and Launchpad will build binaries and then host them in your own apt repository.
You can familiarise yourself with how PPAs work by installing a package from an existing PPA. You can also jump straight into uploading your source packages.
Before you can start using a PPA, you need to activate it on your Launchpad profile page via "Create a new PPA".
Using Bazaar with Launchpad: As Launchpad keeps track of thousands of projects and their latest code whether it be managed by Bazaar, CVS or Subversion, Bazaar users can grab that code as easily:
  • install bzr
  • 
    $ sudo apt-get install aptitude
    $ sudo aptitude install bzr
    $ bzr whoami "The One <xxx@gmail.com>"
    $ bzr launchpad-login xxx-yyy-zzz
    
      
  • Check out the original source code
  • Push the imported source code to the LaunchPad
  • You have to create a repository of what you want to upload, so go to the directory where all the files are.
    Your project is now hosted on Launchpad.
    Keep in mind it might take a few minutes after the push is done succesfully for everything to work correctly.
    Any user who wants to work on the project has two different approaches:
    • Checkouts
    • 
          bzr checkout lp:~launchpad_user_or_team/project_name/branch
          
      For quick changes, it commits straight into Launchpad.
    • Branches
    • 
          bzr branch lp:~launchpad_user_or_team/project_name/branch
          
      For bigger changes, it commits locally and you push the changes to Launchpad when ready.
    "bzr branch" will create a standalone copy of the branch on Launchpad. "bzr checkout" will create a local branch that is bound to the branch on Launchpad. Whenever you make a commit locally in a checkout, it will also automatically be committed to the branch in Launchpad.

More about Bazaar

Bazaar is a distributed version control system(VCS).
You will need to learn Bazaar to contribute to an Ubuntu project.
The default Bazaar repository relies on ssh to validate all connections. Open up a browser and point it to your Launchpad account, copy / paste the contents of id_rsa.pub into that ssh key box.
  • get the package source
  • 
    
    
  • core concept
    • Revision
    • a snapshot of the files you’re working with.
    • Working tree
    • the directory containing your version-controlled files and sub-directories.
    • Branch
    • an ordered set of revisions that describe the history of a set of files.
      
                  	bzr init
                  
      bzr init creates a .bzr directory in the top level directory
    • Repository
    • a store of revisions. In the simplest case, each branch has its own repository. In other cases, it makes sense for branches to share a repository in order to optimize disk usage.
      
                  	bzr init-repo
                  
  • Controlling file registration
  • You can tell Bazaar to ignore some file types by adding them to a file called .bzrignore at the top of the tree.
    To get a list of which files are ignored and what pattern they matched, use bzr ignored.
    Review your changes prior to permanently recording it:
    
        	bzr status
            bzr diff
        
    Creating a new revision holding a snapshot of that state: bzr commit -m "..."
    The bzr log command shows a list of previous revisions.
  • project control
  • The export command is used to package a release, i.e. to take a copy of the files and directories in a branch and package them into a fresh directory or archive:
    
      		bzr export ../releases/my-stuff-1.5.tar.gz
        
    Use the tag command to define a symbolic name for a version:
    
      		bzr tag version-1-5
        
    To see the list of tags defined in a branch, use bzr tags.
    If you have defined a tag and no longer want it defined, use the --delete option of the tag command to remove it.
    
      		bzr tag version-1-5 --delete
        
  • Undoing mistakes
  • If you accidentally register a file using bzr add that you don’t want version controlled, you can use the bzr remove command to tell Bazaar to forget about it. bzr remove has been designed to Do the Safe Thing in that it will not delete a modified file.
    If you want to delete the file, use bzr remove --force .
    If you decide that the changes you have made since the last commit ought to be thrown away, the command to use is bzr revert. It is good practice to use bzr status and bzr diff first to check that everything being thrown away really ought to be.
    To undo changes to a particular file since the last commit but keep all the other changes in the tree,
    
        	bzr revert foo.py
        
    Undoing the last commit:
    
        	bzr uncommit
        
    You can use revert to take your working tree back to the desired reversion. For example:
    
    bzr commit "Fix bug #5"
    Committed revision 20.
    (release the code)
    (hmm - bad fix)
    bzr revert -r 19
    bzr commit -m "Backout fix for bug #5"
    	
  • Team collaboration
  • IN distributed workflows, your main local branch is not the place to make changes, it is as a copy of the central branch, i.e. it’s a mirror branch. Each new feature or fix is developed in its own branch. These branches are referred to as feature branches or task branches.
    • If your mirror is a checkout
    • 
      cd trunk
      bzr update
      bzr merge ../fix-123
      (resolve any conflicts)
      bzr commit -m "Fixed bug #123"        
              
    • If your mirror is a branch
    • 
      cd trunk
      bzr pull
      bzr merge ../fix-123
      (resolve any conflicts)
      bzr commit -m "Fixed bug #123"
      bzr push        
              

Packaging/SourceBuilds

You can ask Launchpad to make an automatic daily build of the code in this branch and place the resultant package(s) in your chosen PPA.
A "recipe" is a description of the steps Launchpad's package builder should take to construct a source package from a set of Bazaar or Git branches that you specify.
The main advantage of source package recipes is that they help with testing.

Packaging/SourceBuilds/GettingStarted

To create your own source package recipes, you need:
  • sourcecode in Launchpad (either hosted directly on Launchpad or imported from elsewhere)
  • a branch with buildable code
  • a recipe.
This screencast will take you through each of the steps you need to get a source package recipe up and running.

Code in Launchpad

The code that you want to use for your source package recipe must be in Launchpad, either as a Bazaar or Git branch that you have uploaded to Launchpad (easier) or as an import from elsewhere.

Packaging

If there's no existing packaging, either for Debian or Ubuntu, you'll need to create your own.
You should read the "Ubuntu Packaging Guide" to packaging to get started.
The recipe is a simple description of what steps are needed to construct a package from your various Bazaar or Git branches. It specifies:
  • which branch to use:
  • such as the project's trunk branch or an experimental branch
  • where to find the packaging information:
  • e.g. an Ubuntu source package branch or some other Bazaar or Git branch
  • which version to give the package:
  • this is important to allow users to upgrade to the stable version once it is released in their distro
  • what to modify
  • to make the source build properly.

Trying it out

  • Getting bzr-builder
  • bzr-builder takes a 'recipe' which specifies several Bazaar branches to combine in a certain fashion as input, and provides the resulting branch as output.
    It helps you set up daily builds in Launchpad. You need to install it locally to test your recipes and builds before you send them to Launchpad.
    The easiest way to install bzr-builder is to simply
    
      	apt-get install bzr-builder
      	
    Or, click Install the bzr-builder package.
    bzr-builder works with "recipes" that are descriptions of the steps needed to construct a package from the various Bazaar branches.
  • Getting git-build-recipe
  • git-build-recipe takes a "recipe" which specifies several Git branches to combine in a certain fashion as input for a Debian-format source package, and provides the resulting branch as output.
    Click install the git-build-recipe package.
  • Writing a basic recipe
  • The recipe is a series of pointers to branches and instructions for how they should be combined.
    See the recipe guide.
    This example is the simplest way: you use the project's trunk, which contains no packaging, and nest another branch that contains only packaging information.
    • create the recipe
    • The file as gedit.recipe:
      
      
      
          		
      • The 1st line
      • tells Launchpad which recipe version we're using (in this case it's 0.3), along with how we want to name the resultant package.
        • format
        • Specify which recipe format we're using. The current format is 0.4.
        • deb-version
        • You should make sure that “deb-version” is set to an appropriate value in your recipe. This will be used as the version number of the package.
          • {time} will be substituted with the current date and time
          • {date} will be substituted with just the current date
          • {revno} will be the revno of the base branch (the first specified).
          • {debversion}
          • Replaced with the version in debian/changelog
          • {debupstream} will be replaced by the upstream portion of the version number taken from debian/changelog in the final tree.
      • The 2nd line
      • specifies the code base branch, using Launchpad's short name system.
      • The 3rd line
      • where to find the packaging branch and say that we want to nest it into the code branch.
    • Test the recipe locally
    • You should always test your recipe locally before sending it to Launchpad.
      The following command processes your recipe "gedit.recipe" and creates a directory called "working-dir", into which it places the resulting source tree and source package.
      
            		$ bzr dailydeb --allow-fallback-to-native gedit.recipe working-dir
            		
      This package needs additional packages for the recipe to be processed successful,
      
                  sudo apt-get install -y gnome-pkg-tools gnome-common intltool gsettings-desktop-schemas-dev gtk-doc-tools libsoup2.4-dev libgspell-1-dev libxml2-dev libgtk-3-dev libgtksourceview-3.0-dev libpeas-dev python-gi-dev yelp-tools gobject-introspection libgirepository1.0-dev valac
                  
      This will perform the steps specified in package.recipe. It will create working-dir and put the resulting source tree and the source package there.
      
      
                  
                  
      Note, git-build-recipe can do the similar thing as of bzr dailydeb.
  • Testing your building process locally
    • Testing the build
    • If bzr-builder processed the recipe without any problems, you'll now have a source package.
      pbuilder, a tool that creates a clean, minimal environment for the build. It allows users to setup a chroot environment for building Ubuntu packages.
      If you build packages without pbuilder, you must already have all the build dependencies of the package that you are building installed on your running system.
      This ensures that the build will work everywhere and that it's not dependent on something unusual in your own environment.
      • Install pbuilder
      • 
              		sudo apt-get install pbuilder
              		
      • Edit ~/.pbuilderrc
      • 
              		COMPONENTS="main universe multiverse restricted"
              		
        A repository is a collection of files that has information about various software, their versions and some other details like the checksum.
        Each Ubuntu version has its own official set of four repositories:
        • Main
        • Canonical-supported free and open-source software.
        • Universe
        • Community-maintained free and open-source software.
        • Restricted
        • Proprietary drivers for devices.
        • Multiverse
        • Software restricted by copyright or legal issues.
      • Creates a base.tgz for the specified distribution.
      • 
              		sudo pbuilder create --distribution focal
              		
        The base tarball /var/cache/pbuilder/base.tgz is created.
      Now, kick off the test build with:
      
            
      This extracts base tarball [/var/cache/pbuilder/base.tgz] then build it.
      If the build succeeds, the resulting package is under /var/cache/pbuilder/result/.
      
      
            
            
    You can test and install the built package:
    
    
    	  
    Now fill in all the necessary details:
    • Name
    • a short name for the recipe. Remember: you might want more than one.
    • Description
    • make your intention clear and tell potential users of the build what they're signing up for.
    • Owner
    • select who drives these builds.
    • Build daily
    • enables automatic daily builds, rather than building on-demand only.
    • Daily build archive
    • the PPA where you want to publish the package.
    • Default Distribution Series
    • select all the Ubuntu releases you want to build the package for. Make sure all these builds work before you sign up for them!
    • Recipe text
    • paste your recipe in here.
  • Building
  • It's a good idea to try building it yourself first, to make sure that everything is working correctly.
    You can click (+) the "Request build(s)" link:
  • Adding this PPA to your system
  • This information of repositories is stored in the file /etc/apt/sources.list.
    If you look at its content, you’ll see that it has the URL of the repositories. The lines with # at the beginning are ignored.
    Everytime you run the command sudo apt update, your system uses APT tool to check against the repo and stores the information about the software and their version in a cache.
    When you use the command sudo apt install package_name, it uses the information to get that package from the URL where the actual software is stored.
    Therefore, you can update your system with unsupported packages from this untrusted PPA by adding ppa:jerry-lee-tpe/test to your system's Software Sources. (Read about installing)
    
      	sudo add-apt-repository ppa:jerry-lee-tpe/test
        ...
        Get:5 http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic InRelease [15.9 kB] 
        ...
        Get:10 http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic/main i386 Packages [1172 B]
    	...
        Get:12 http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic/main amd64 Packages [1180 B]                 
    	...
        Get:14 http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic/main Translation-en [744 B] 
    	...
        
    The PPA will be added in the APT system by creating a file under /etc/apt/sources.list.d/ automatically,
    
    $ cat /etc/apt/sources.list.d/jerry-lee-tpe-ubuntu-test-bionic.list
    deb http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic main
    # deb-src http://ppa.launchpad.net/jerry-lee-tpe/test/ubuntu bionic main  
        
    The above two lines are the traditional way to add any repositories to your etc/apt/sources.list manually.
    Then refresh the package index,
    
    	sudo apt-get update
        
    Now you're ready to start installing software from the PPA!
  • Install a specific version of an application from PPA
  • 
    
        
        
  • Building the Bazaar branch directly
  • bzr builddeb is a command to build the package in its current Bazaar branch location. This will build the package and place it in ../build-area/. There is also an alias "bzr bd" of bd provided for this.
    
    
            
  • Check in a change via patch
  •      
    
    		
    In Debian packaging, any changes to a file outside the debian directory must be reversible via the patch.
    This means you have applied changes to the unpacked upstream source which are not part of a patch in the debian/patches/ directory, or listed in the debian/patches/series file if they are
    The best way to handle this error is to add a patch.
    There are a number of different ways of handling patches in Debian packages, fortunately we are standardizing on one system, Quilt, which is now used by most packages. The patches are kept in debian/patches. This package has 3 patches:
    
    
            
    The order of patches to apply is kept in debian/patches/series.
    To patch with Quilt:
    • setup environment
    • Add this to your ~/.bashrc:
      
                	export QUILT_PATCHES=debian/patches
                  
      Then, source the file to apply the new export:
      
      			$ . ~/.bashrc
                  
    • Adding a New Patch
      • create a new patch file
      • 
                      		$ quilt new 09_no_copyright.patch
        					Patch debian/patches/09_no_copyright.patch is now on top
        				
      • add the file to the patch
      • 
        
        
            			
      • modify the file which will be added to the patch
      • refreshes the specified patch
      • 
                      		$ quilt refresh
        					Refreshed patch debian/patches/09_no_copyright.patch
            			
        The change will now be in debian/patches/09_no_copyright.patch and the debian/patches/series file will have had the new patch added to it.
        
        
            			
      • Add the patch header
      • 
                        	$ quilt header -e
        Title: Patch Tagging Guidelines
        DEP: 3
        State: ACCEPTED
        Date: 2009-11-26
        Drivers: Raphael Hertzog <hertzog@debian.org>
        URL: http://dep.debian.net/deps/dep3
        Source: http://anonscm.debian.org/viewvc/dep/web/deps/dep3.mdwn
        Abstract:
         Meta-information embedded in patches applied to Debian packages                    
                        
    • Add the new patch file to the packaging
    • 
      				$ bzr add debian/patches/09_no_copyright.patch
      				$ bzr add .pc/*
      				$ dch -i "Add patch 09_no_copyright.patch to change the copyright"
      				$ bzr commit
      			
      Note,
      • Quilt keeps its metadata in the .pc/ directory, so currently you need to add that to the packaging too.
      • debchange(dch) is a tool for maintenance of the debian/changelog file in a source package
    • Test then push the change to the Launchpad
    • 
      
      			

Ubuntu Packaging Guide

2. Getting Set Up

This article is designed to get your computer set up so that you can start working with packages, and upload your packages to Ubuntu’s hosting platform, Launchpad.

2.1. Install basic packaging software

To install most of the tools you will need run this command:

$ sudo apt install gnupg pbuilder ubuntu-dev-tools apt-file
This command will install the following software:
  • gnupg
  • GNU Privacy Guard contains tools you will need to create a cryptographic key with which you will sign files you want to upload to Launchpad.
    You can sign files with your key so they can be identified when you upload a source package to Launchpad.
    • To generate a new GPG key
    • 
              $ gpg --gen-key
              
    • To list generated GPG keys
    •     
          	$ gpg --list-keys
              
              pub   key ID 2010-12-06
                    Key fingerprint = 5C28 0144 FB08 91C0 2CF3  37AC 6F0B F90F 43CD E61D
              uid                  Daniel Holbach <dh@mailempfang.de>
              sub   4096R/51FBE68C 2010-12-06
              
      In public-key cryptography, a public key fingerprint is a short sequence of bytes used to identify a longer public key. Fingerprints are created by applying a cryptographic hash function to a public key.
    • upload the public part of your key to a keyserver
    •      
          	$ gpg --send-keys --keyserver keyserver.ubuntu.com KEY ID
              
      This will send your key to the Ubuntu keyserver.
  • ssh
  • We will mainly be using SSH to securely upload source packages to Launchpad.
    To generate an SSH key, enter:
         
    		$ ssh-keygen -t rsa
            
  • pbuilder
  • A tool to do reproducible builds of a package in a clean and isolated environment.
    It serves a couple of purposes:
    • The build will be done in a minimal and clean environment.
    • This helps you make sure your builds succeed in a reproducible way, but without modifying your local system
    • There is no need to install all necessary build dependencies locally
    • You can set up multiple instances for various Ubuntu and Debian releases
    • Creates a pbuilder environment for Ubuntu/Debian releases:
         
              $ pbuilder-dist release create
              
      where release can be for Ubuntu: trusty(14.04), xenial(16.04), bionic(18.04), or in the case of Debian maybe sid or buster. This will take a while as it will download all the necessary packages for a “minimal installation”.
  • ubuntu-dev-tools (and devscripts, a direct dependency)
  • a collection of tools that make many packaging tasks easier.
  • apt-file
  • provides an easy way to find the binary package that contains a given file.
    The apt-file tool can list, and search for, individual files in the software packages used by APT. It's similar to using dpkg -L, but apt-file can search all available packages, not just the ones already installed. It accomplishes this by maintaining a local cache of package contents.
    
      	apt-file [options] [action] [pattern]
    	
    • options
      • -s sources.list
      • Use a custom list of APT sources. The default APT sources.list is typically located at /etc/apt/sources.list.
    • action
      • find/search
      • Search for a file, whose name matches pattern, inside all available packages.
        Directory names are not searched, only file names.
      • list/show
      • List all the files contained in packages whose names match pattern. One file per line is listed.
      • update
      • Update apt-file's user cache of package contents from all configured APT sources.
      • purge
      • Clear "Contents-" files from the apt-file cache directory. If you receive any errors listing or searching, it's a good idea to perform a purge and then an update.
    • pattern

2.2. Get set up to work with Launchpad

Launchpad is the central piece of infrastructure used for Ubuntu:
  • stores packages and code
  • bug reports, fixes and reviews
For more information see the Launchpad Help wiki.
  • Get a Launchpad account
  • Upload your GPG key to Launchpad
  • After the key is imported, the Launchpad will use the fingerprint to check the Ubuntu key server for your key and, if successful, send you an encrypted email asking you to confirm the key import.
  • Upload your SSH key to Launchpad
  • Configure your shell
  • The Debian/Ubuntu packaging tools need your information. Configure your shell ~/.bashrc:
    
    		export DEBFULLNAME="Bob Dobbs"
    		export DEBEMAIL="subgenius@example.com"
    	

3. Fixing a bug in Ubuntu

Take a look at the bitesize bugs in Launchpad, and that might give you an idea of something to work on.
  • Discover the source package that you’ll need to work on.
  • apt-file, apt-cache showsr, ...
  • Confirm that the problem exists and not fixed yet.
  • Check the bug situation
  • For Ubuntu the URL https://bugs.launchpad.net/ubuntu/+source/<package> should always take to the bug page of the source package in question.
    For Debian, which is the major source for Ubuntu’s packages: http://bugs.debian.org/src:<package>
  • Getting the code
  • The ubuntu-dev-tools package has a tool called pull-lp-source that a developer can use to grab the source code for any package.
    
      pull-pkg [options] <package name> [release|version]
      
  • Work on a fix
  • The command edit-patch is a simple way to add a patch to a package.
    edit-patch is a tool for preparing patches for Debian source packages, it is a wrapper script around the Quilt, CDBS, and dpatch patch systems.
    Run from inside the root directory of the source package, edit-patch can be used to edit existing patches located in debian/patches.

apt-key

Each distribution has a release file,

Origin: Canonical
Codename: focal-elgin
Version: 20.04
Date: Thu, 10 Dec 2020 03:10:44 UTC
Architectures: amd64 i386
Components: public
Description: focal-elgin Repository
MD5Sum:
...
SHA1:
...
SHA256:
...
apt-key is the key management utility for APT.
apt-key is used to add , delete , list , and export public keys used by apt to verify the signature of a release file .
Packages which have been authenticated using these keys will be considered trusted.

How will the verification work ?

A distribution source indicates the location from which we are going to download its release file.
The distribution source may be in the following :
  • The file /etc/apt/sources.list
  • Under the folder /etc/apt/sources.list.d/
The public keys used to verify a distribution release file can be located in the following :
  • The file /etc/apt/trusted.gpg
  • Under the folder /etc/apt/trusted.gpg.d
The above are known as keyring since they can contain one or more public key which can be used to verify the signatures of release files.
To list the public keys that are installed :

$ apt-key list
When debian is installed , the package debian-archive-keyring is also installed .
This package contains public keys which can be used to verify the release files of distributions authored by the debian project . By default , apt will only accept the release files which are signed and their public key have been installed .
Each distribution has a Release , InRelease and Release.gpg files .
.

Issues and Tips

How do I find the package that provides a file?

  • find out which installed package owns a file
  • 
    $ dpkg -S /bin/ls
    coreutils: /bin/ls    
        
  • search for files not yet installed
  • 
    $ apt-file find ModemManager.h
    modemmanager-dev: /usr/include/ModemManager/ModemManager.h   
        

“Repository does not have a release file” Error in Ubuntu

E: The repository 'http://ppa.launchpad.net/rmescandon/yq/ubuntu groovy Release' does not have a Release file.
  • Each Ubuntu release has a codename
  • Ubuntu 20.10 (Groovy Gorilla) .
  • The error is basically telling you that though you have added a third-party repository to your system’s sources list, this new repository is not available for your current Ubuntu version.
  • Go to the webpage of the PPA: https://launchpad.net/~rmescandon, you can go to the “Overview of published packages” and filter it by the codename of your Ubuntu version
    In case when the repository in question is not available for your Ubuntu version, here’s what you can do:
    • Delete the troublesome repository from your list of repository so that you don’t see the error every time you run the update.
    • To delete the troublesome repository, start Software & Updates tool: Highlight it and then click on Remove button to delete it from your system.
    • Get the software from another source (if it is possible).

“debconf: DbDriver ”config“: config.dat is locked by another process: Resource temporarily unavailable” while installing packages Ask Question

sudo fuser -v /var/cache/debconf/config.dat sudo kill PID sudo rm /var/cache/debconf/*.dat

留言

熱門文章