Changes between Version 4 and Version 5 of Csle2022/Agenda/linuxpackagemanagement


Ignore:
Timestamp:
Oct 19, 2022, 5:44:36 PM (2 years ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/linuxpackagemanagement

    v4 v5  
    33== Linux package management ==
    44
     5The 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.
    56
    6 == Repositories, update/upgrade, package installation, key management ==
     7We’ll cover some of the basic commands of how to use apt in order to illustrate the ease of use of using a package manager in the terminal window.
     8
     9=== Let's see - update/upgrade, package installation ===
     10==== How to install a package ====
     11
     12Install a package as follows by specify a single package name or install many packages at once by listing all their names.
     13
     14To install apache2
     15
     16`sudo apt install apache2`
     17
     18==== Find dependencies of a package ====
     19
     20Once 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.
     21
     22`sudo apt depends apache2`
     23
     24==== Search for package ====
     25
     26It 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.
     27
     28In this case, I want to search for an image manipulation program, I can simply include the phrase in quotes and use the apt search facility
     29
     30`sudo apt search "image manipulation program"`
     31
     32==== View package details ====
     33
     34You 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.
     35
     36`sudo apt show apache2`
     37
     38==== Upgrade system packages ====
     39
     40Often 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.
     41
     42`sudo apt upgrade`
     43
     44You will often want to execute both these commands at the same time, so you can run them both at the same time using.
     45
     46`sudo apt update && sudo apt upgrade -y`
     47
     48==== Remove packages ====
     49
     50To remove packages from your system.
     51
     52`sudo apt remove apache2`
     53
     54if you want to ensure all packages configuration and dependencies are removed at the same time you can use the purge switch.
     55
     56`sudo apt remove apache2 --purge`
     57
     58==== Remove unused packages ====
     59
     60Installing 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:
     61
     62`sudo apt autoremove`
     63
     64== Repositories and key management ==
     65
     66A 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).
     67
     68Debian-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.
     69
     70===== to add manually =====
     71
     72Although 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.
     73
     74======= Install add-apt-repository =======
     75
     76You 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:
     77
     78`sudo apt install software-properties-common`
     79
     80====== Add Repositories Using add-apt-repository ======
     81
     82Now 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:
     83
     84`sudo add-apt-repository [options] repository`
     85
     86ex:
     87
     88`sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"`
    789
    890== Linux Editors ==