Changes between Version 15 and Version 16 of Csle2022/Agenda/linuxpackagemanagement
- Timestamp:
- Nov 12, 2022, 7:55:29 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Csle2022/Agenda/linuxpackagemanagement
v15 v16 5 5 A 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). 6 6 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.7 Debian-based distributions, including, Ubuntu make use of the Advanced Package Tool (APT) to install and update packages. 8 8 9 ===== to add manually ===== 9 You can find software repository information in the `/etc/apt/sources`. list file on your Debian-based Linux installation. 10 10 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 === 12 12 13 ===== Install add-apt-repository ===== 13 A better way of adding them to your system is by using the `add-apt-repository` tool. 14 14 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: 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. 16 17 To install add-apt-repository using the APT package manager, type: 16 18 17 19 `sudo apt install software-properties-common` 18 20 21 Then execute, 19 22 20 ==== Add Repositories Using add-apt-repository ==== 23 `sudo apt update` 24 25 Add the repository as below. 26 27 === Add Repositories Using add-apt-repository === 21 28 22 29 Now 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: … … 24 31 `sudo add-apt-repository [options] repository` 25 32 26 ex :33 example: 27 34 28 35 `sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"` … … 32 39 The 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 33 40 41 The `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. 34 42 35 == Linux package management == 43 `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <key id>` 44 45 Replacing the<key id> with the second part of the key informed in the PPA website that you want to add. 46 47 For example, if you find this line: 48 49 4096R/7BF576066 50 51 Use only the second part (no matter its size), which in this example is 7BF576066 52 53 After performing that command, and setting up the sources 54 55 {{{ 56 sudo apt-get update 57 sudo apt-get install[PACKAGE] 58 }}} 59 60 To list the key list, execute 61 62 `apt-key list` 63 64 and if you need to delete a key, 65 66 `sudo apt-key del <key id>` 67 68 === Manual way to change the mirror === 69 70 Change original URL addresses in `/etc/apt/sources.list` into the desired ones. 71 72 The easiest way to do this is by using nano/vi. 73 74 The last, perform a reload command to re-download the new mirror addresses: 75 76 `sudo apt-get update` 77 78 = Linux package management = 36 79 37 80 The 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. … … 40 83 41 84 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 === 44 87 45 88 Install a package as follows by specify a single package name or install many packages at once by listing all their names. … … 49 92 `sudo apt install apache2` 50 93 51 === = Find dependencies of a package ====94 === Find dependencies of a package === 52 95 53 96 Once 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. … … 55 98 `sudo apt depends apache2` 56 99 57 === = Search for package ====100 === Search for package === 58 101 59 102 It 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. … … 63 106 `sudo apt search "image manipulation program"` 64 107 65 === = View package details ====108 === View package details === 66 109 67 110 You 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. … … 69 112 `sudo apt show apache2` 70 113 71 === = Upgrade system packages ====114 === Upgrade system packages === 72 115 73 116 Often 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. … … 79 122 `sudo apt update && sudo apt upgrade -y` 80 123 81 === = Remove packages ====124 === Remove packages === 82 125 83 126 To remove packages from your system. … … 89 132 `sudo apt remove apache2 --purge` 90 133 91 === = Remove unused packages ====134 === Remove unused packages === 92 135 93 136 Installing 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: 94 137 95 138 `sudo apt autoremove` 96 97 98