Changes between Version 15 and Version 16 of Csle2022/Agenda/linuxpackagemanagement


Ignore:
Timestamp:
Nov 12, 2022, 7:55:29 PM (2 years ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/linuxpackagemanagement

    v15 v16  
    55A Linux repository is a storage location that contains essential and popular software for different Linux distributions and, each distribution has its own official repositories (also called standard-repositories).
    66
    7 Debian-based distributions, including, Ubuntu make use of the Advanced Package Tool (APT) to install and update packages. You can find software repository information in the `/etc/apt/sources`. list file on your Debian-based Linux installation.
     7Debian-based distributions, including, Ubuntu make use of the Advanced Package Tool (APT) to install and update packages.
    88
    9 ===== to add manually =====
     9You can find software repository information in the `/etc/apt/sources`. list file on your Debian-based Linux installation.
    1010
    11 Although you can manually enter repository details in the file, it can quickly become a tiresome job. A better way of adding them to your system is by using the `add-apt-repository` tool.
     11=== Add repos manually ===
    1212
    13 ===== Install add-apt-repository =====
     13A better way of adding them to your system is by using the `add-apt-repository` tool.
    1414
    15 You won't find the add-apt-repository utility installed on your system by default. It is a part of the software-properties-common package. To install add-apt-repository using the APT package manager, type:
     15You won't find the add-apt-repository utility installed on your system by default. It is a part of the software-properties-common package.
     16
     17To install add-apt-repository using the APT package manager, type:
    1618
    1719`sudo apt install software-properties-common`
    1820
     21Then execute,
    1922
    20 ==== Add Repositories Using add-apt-repository ====
     23`sudo apt update`
     24
     25Add the repository as below.
     26
     27=== Add Repositories Using add-apt-repository ===
    2128
    2229Now that you've installed the package, it's time to add a third-party software repository to your system. The basic syntax for adding repositories is:
     
    2431`sudo add-apt-repository [options] repository`
    2532
    26 ex:
     33example:
    2734
    2835`sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"`
     
    3239The Linux key-management facility is primarily a way for various kernel components to retain or cache security data, authentication keys, encryption keys, and other data in the kernel
    3340
     41The  `add-apt-key`  will request the specified GPG key from a public keyserver and insert it into the APT keyring so that archives signed with that key will be trusted.
    3442
    35 == Linux package management ==
     43`sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <key id>`
     44
     45Replacing the<key id> with the second part of the key informed in the PPA website that you want to add.
     46
     47For example, if you find this line:
     48
     49 4096R/7BF576066
     50
     51Use only the second part (no matter its size), which in this example is 7BF576066
     52
     53After performing that command, and setting up the sources
     54
     55{{{
     56sudo apt-get update
     57sudo apt-get install[PACKAGE]
     58}}}
     59
     60To list the key list, execute
     61
     62`apt-key list`
     63
     64and if you need to delete a key,
     65
     66`sudo apt-key del <key id>`
     67
     68=== Manual way to change the mirror ===
     69
     70Change original URL addresses in `/etc/apt/sources.list` into the desired ones.
     71
     72The easiest way to do this is by using nano/vi.
     73
     74The last, perform a reload command to re-download the new mirror addresses:
     75
     76`sudo apt-get update`
     77
     78= Linux package management =
    3679
    3780The most common and popular package managers they are likely to first start using is the apt (Advanced Package Tool) because it is most widely shipped as the default Package Manager for users of Debian, Ubuntu and Mint.
     
    4083
    4184
    42 === Let's see - update/upgrade, package installation ===
    43 ==== How to install a package ====
     85== Let's see - update/upgrade, package installation ==
     86=== How to install a package ===
    4487
    4588Install a package as follows by specify a single package name or install many packages at once by listing all their names.
     
    4992`sudo apt install apache2`
    5093
    51 ==== Find dependencies of a package ====
     94=== Find dependencies of a package ===
    5295
    5396Once package has been installed you might want to understand which dependencies the package is making use of, you can list out the dependencies of a package using apt as follows.
     
    5598`sudo apt depends apache2`
    5699
    57 ==== Search for package ====
     100=== Search for package ===
    58101
    59102It is highly likely that you will need to search for a package to perform a specific task. The apt package manager enables you to easily search for packages via the terminal.
     
    63106`sudo apt search "image manipulation program"`
    64107
    65 ==== View package details ====
     108=== View package details ===
    66109
    67110You will often want to find and view details of package. In this example I want to view some details regarding the apache2 package we installed earlier.
     
    69112`sudo apt show apache2`
    70113
    71 ==== Upgrade system packages ====
     114=== Upgrade system packages ===
    72115
    73116Often the above command will instruct you that new releases of packages are available, so to install new versions of all the packages on your system.
     
    79122`sudo apt update && sudo apt upgrade -y`
    80123
    81 ==== Remove packages ====
     124=== Remove packages ===
    82125
    83126To remove packages from your system.
     
    89132`sudo apt remove apache2 --purge`
    90133
    91 ==== Remove unused packages ====
     134=== Remove unused packages ===
    92135
    93136Installing or upgrading packages will result in some dependencies not being required, you can clean up these unused dependencies after removing that particular package, it's dependencies will remain on the system, therefore to remove them use auto-remove as follows:
    94137
    95138`sudo apt autoremove`
    96 
    97 
    98