APT often known as Superior Packaging Software is the command-line instrument for managing packages in Debian-based distributions like Ubuntu 16.04, Ubuntu 18.04, Debian 8, Debian 9 and far more. APT simplifies the method of putting in, eradicating, upgrading packages and even used to improve all the working system by way of the Command Line Interface
On this tutorial, we are going to clarify how one can handle packages utilizing APT command line instrument on Ubuntu 18.04 LTS server.
Necessities
- A server operating Ubuntu 18.04 LTS.
- A root or sudo entry on the server.
All instructions under are run as root person. Both log in as root person on the shell or run:
sudo -s
to turn out to be the foundation person. Instead, you’ll be able to prepend ‘sudo ‘ to all instructions.
Set up and Replace Packages
Apt-get works by acquiring info from totally different sources and saved in a neighborhood database. The replace command fetched the packages from their areas and replace the packages to a newer model.
apt-get replace -y
After operating the above command, your database must be up-to-date.
The improve command is used to improve all of the at the moment put in software program packages to the newer model.
apt-get improve -y
You can too use dist-upgrade command to improve the packages, however it modifications package deal dependencies with a wise battle decision technique.
apt-get dist-upgrade -y
As soon as your database is up to date, you’ll be able to set up any packages by operating the next command:
apt-get set up package1 package2
For instance, you’ll be able to set up Nginx net server package deal by operating the next command:
apt-get set up nginx
If you wish to obtain solely package deal file however not set up it, you’ll be able to run the next command:
apt-get set up -d package1
The above command will obtain the package deal file in /var/cache/apt/archives listing.
To reinstall any package deal with the newer model run the next command:
apt-get set up package1 --reinstall
Take away a Bundle with Apt
To take away a package deal out of your system merely run the next command:
apt-get take away package1
The above command will solely take away the package deal however preserve the configuration file.
To take away the package deal with configuration file with the next command:
apt-get purge package1
You can too take away all undesirable packages and clear the database with the next command:
apt-get autoremove
apt-get clear
Search Bundle with Apt-Cache
The command apt-cache is used to seek for software program packages.
To search out the package deal by its description, run the next command:
apt-cache search proftpd
It is best to see the next output:
resource-agents - Cluster Useful resource Brokers fail2ban - ban hosts that trigger a number of authentication errors ftpd - File Switch Protocol (FTP) server gadmin-proftpd - GTK+ configuration instrument for proftpd gadmin-proftpd-dbg - GTK+ configuration instrument for proftpd debug package deal gadmintools - GTK+ server administration instruments (meta-package) proftpd-basic - Versatile, virtual-hosting FTP daemon - binaries proftpd-dev - Versatile, virtual-hosting FTP daemon - improvement information proftpd-doc - Versatile, virtual-hosting FTP daemon - documentation proftpd-mod-autohost - ProFTPD module mod_autohost proftpd-mod-case - ProFTPD module mod_case proftpd-mod-clamav - ProFTPD module mod_clamav proftpd-mod-dnsbl - ProFTPD module mod_dnsbl proftpd-mod-fsync - ProFTPD module mod_fsync proftpd-mod-geoip - Versatile, virtual-hosting FTP daemon - GeoIP module proftpd-mod-ldap - Versatile, virtual-hosting FTP daemon - LDAP module proftpd-mod-msg - ProFTPD module mod_msg proftpd-mod-mysql - Versatile, virtual-hosting FTP daemon - MySQL module proftpd-mod-odbc - Versatile, virtual-hosting FTP daemon - ODBC module proftpd-mod-pgsql - Versatile, virtual-hosting FTP daemon - PostgreSQL module proftpd-mod-sqlite - Versatile, virtual-hosting FTP daemon - SQLite3 module proftpd-mod-tar - ProFTPD module mod_tar proftpd-mod-vroot - ProFTPD module mod_vroot
To search out all of the packages beginning with proftpd with the next command:
apt-cache pkgnames proftpd
It is best to see the next output:
apt-cache pkgnames proftpd proftpd-mod-dnsbl proftpd-mod-odbc proftpd-mod-pgsql proftpd-doc proftpd-mod-tar proftpd-mod-ldap proftpd-mod-case proftpd-mod-geoip proftpd-mod-mysql proftpd-basic proftpd-mod-vroot proftpd-mod-clamav proftpd-mod-autohost proftpd-mod-fsync proftpd-mod-sqlite proftpd-mod-msg proftpd-dev
You may examine the whole info of any package deal (nano) with the next command:
apt-cache present nano
Output:
Bundle: nano Precedence: commonplace Part: editors Put in-Measurement: 600 Maintainer: Ubuntu Builders <[email protected]> Unique-Maintainer: Jordi Mallach <[email protected]> Structure: amd64 Model: 2.2.6-1ubuntu1 Replaces: pico Offers: editor Relies upon: libc6 (>= 2.14), libncursesw5 (>= 5.6+20070908), libtinfo5, dpkg (>= 1.15.4) | install-info Suggests: spell Conflicts: pico Breaks: alpine-pico (<= 2.00+dfsg-5) Filename: pool/major/n/nano/nano_2.2.6-1ubuntu1_amd64.deb Measurement: 194060 MD5sum: c97dc062e9941bfe13b6b303cf8ed639 SHA1: ee93fcfd1f2ecd601b0a8f8932319848043f4f0f SHA256: f20d8cca5c30b90ebf68301d126f86e473ac83e7d6fdc36f59bcd685c2eb4020 Description-en: small, pleasant textual content editor impressed by Pico GNU nano is an easy-to-use textual content editor initially designed as a alternative for Pico, the ncurses-based editor from the non-free mailer package deal Pine (itself now out there beneath the Apache License as Alpine). . Nonetheless, nano additionally implements many options lacking in pico, together with: - characteristic toggles; - interactive search and change (with common expression assist); - go to line (and column) command; - auto-indentation and coloration syntax-highlighting; - filename tab-completion and assist for a number of buffers; - full internationalization assist. Description-md5: b7e1d8c3d831118724cfe8ea3996b595 Homepage: http://www.nano-editor.org/ Bugs: https://bugs.launchpad.net/ubuntu/+filebug Origin: Ubuntu Supported: 5y Job: commonplace, kubuntu-active, kubuntu-active
To examine the dependencies of a particular package deal with the next command:
apt-cache showpkg htop
Output:
Bundle: htop Variations: 2.1.0-3 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages) (/var/lib/dpkg/standing) Description Language: File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages MD5: 8eb5aa19b3c92a975dc78e2165f6688d Description Language: en File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_main_i18n_Translation-en MD5: 8eb5aa19b3c92a975dc78e2165f6688d Reverse Relies upon: ubuntu-server,htop lubuntu-qt-desktop,htop lubuntu-gtk-desktop,htop lubuntu-desktop,htop util-vserver,htop ubuntu-benchmark-tools,htop lubuntu-qt-desktop,htop lubuntu-gtk-desktop,htop lubuntu-desktop,htop hollywood,htop freedombox-setup,htop Dependencies: 2.1.0-3 - libc6 (2 2.15) libncursesw5 (2 6) libtinfo5 (2 6) lsof (0 (null)) strace (0 (null)) Offers: 2.1.0-3 - Reverse Offers:
To examine whether or not a package deal is put in or not and which repository it belongs to with the next command:
apt-cache coverage apache2
It is best to see the next output:
apache2: Put in: 2.4.29-1ubuntu4.5 Candidate: 2.4.29-1ubuntu4.5 Model desk: *** 2.4.29-1ubuntu4.5 500 500 http://archive.ubuntu.com/ubuntu bionic-updates/major amd64 Packages 100 /var/lib/dpkg/standing 2.4.29-1ubuntu4.4 500 500 http://security.ubuntu.com/ubuntu bionic-security/major amd64 Packages 2.4.29-1ubuntu4 500 500 http://archive.ubuntu.com/ubuntu bionic/major amd64 Packages
APT Superior Utilization
You can too examine for damaged dependencies with the next command.
apt-get examine
It is best to see the next output:
Studying package deal lists... Performed Constructing dependency tree Studying state info... Performed
To go looking and set up the construct dependencies for a package deal (right here vsftpd), use the next command:
apt-get build-dep vsftpd
It is best to see all of the dependencies required by vsftpd package deal within the following output:
Studying package deal lists... Performed Constructing dependency tree Studying state info... Performed Word, choosing 'libcap-dev' as an alternative of 'libcap2-dev' The next NEW packages can be put in: debhelper dh-apparmor dh-apport libcap-dev libpam0g-dev po-debconf The next packages can be upgraded: libpam0g 1 upgraded, 6 newly put in, Zero to take away and 595 not upgraded. 1 not totally put in or eliminated. Have to get 1,020 kB of archives. After this operation, 2,238 kB of further disk house can be used. Do you need to proceed? [Y/n]
To obtain the supply code of any package deal, unpack and compile a package deal by operating the next command:
apt-get --compile supply htop
It is best to see the next output:
Studying package deal lists... Performed NOTICE: 'htop' packaging is maintained within the 'Git' model management system at: https://salsa.debian.org/debian/htop.git Please use: git clone https://salsa.debian.org/debian/htop.git to retrieve the most recent (presumably unreleased) updates to the package deal. Have to get 314 kB of supply archives. Get:1 http://archive.ubuntu.com/ubuntu bionic/major htop 2.1.0-3 (dsc) [1,961 B] Get:2 http://archive.ubuntu.com/ubuntu bionic/major htop 2.1.0-3 (tar) [303 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic/major htop 2.1.0-3 (diff) [8,824 B] Fetched 314 kB in 35s (8,877 B/s) dpkg-source: data: extracting htop in htop-2.1.0 dpkg-source: data: unpacking htop_2.1.0.orig.tar.gz dpkg-source: data: unpacking htop_2.1.0-3.debian.tar.xz dpkg-source: data: making use of 601-openvz-new-ctid-vpid.patch dpkg-source: data: making use of fix-small-terminals.patch dpkg-source: data: making use of fix-ldflags.patch dpkg-source: data: making use of fix-isalnum-crash.patch dpkg-buildpackage: data: supply package deal htop dpkg-buildpackage: data: supply model 2.1.0-3 dpkg-buildpackage: data: supply distribution unstable dpkg-buildpackage: data: supply modified by Graham Inggs <[email protected]> dpkg-buildpackage: data: host structure amd64
To examine the model of APT with the next command:
apt-get -v
Output:
apt 1.6.1 (amd64) Supported modules: *Ver: Customary .deb *Pkg: Debian dpkg interface (Precedence 30) Pkg: Debian APT solver interface (Precedence -1000) Pkg: Debian APT planner interface (Precedence -1000) S.L: 'deb' Debian binary tree S.L: 'deb-src' Debian supply tree Idx: Debian Supply Index Idx: Debian Bundle Index Idx: Debian Translation Index Idx: Debian dpkg standing file Idx: Debian deb file Idx: Debian dsc file Idx: Debian management file Idx: EDSP situation file Idx: EIPP situation file
You may listing all of the out there choices with APT by operating the next command:
apt-get -h
Output:
apt 1.6.1 (amd64) Utilization: apt-get [options] command apt-get [options] set up|take away pkg1 [pkg2 ...] apt-get [options] supply pkg1 [pkg2 ...] apt-get is a command line interface for retrieval of packages and details about them from authenticated sources and for set up, improve and removing of packages collectively with their dependencies. Most used instructions: replace - Retrieve new lists of packages improve - Carry out an improve set up - Set up new packages (pkg is libc6 not libc6.deb) take away - Take away packages purge - Take away packages and config information autoremove - Take away routinely all unused packages dist-upgrade - Distribution improve, see apt-get(8) dselect-upgrade - Observe dselect choices build-dep - Configure build-dependencies for supply packages clear - Erase downloaded archive information autoclean - Erase outdated downloaded archive information examine - Confirm that there are not any damaged dependencies supply - Obtain supply archives obtain - Obtain the binary package deal into the present listing changelog - Obtain and show the changelog for the given package deal See apt-get(8) for extra details about the out there instructions. Configuration choices and syntax is detailed in apt.conf(5). Details about how one can configure sources might be present in sources.listing(5). Bundle and model decisions might be expressed through apt_preferences(5). Safety particulars can be found in apt-secure(8). This APT has Tremendous Cow Powers.
Comments