APT commands

From ALT Linux Wiki
Stub.png
Under construction.
This page is not finished yet and may lack substantial information.

apt-get commands

Update information about repositories

Initially need to get indexes, which contains actual sets of packages and links to it.

Note: This command need to run every time when:
  • you searching new version of package
  • you installing package
  • you upgrade installed packages
  • you use apt-cache


This running with next command:

# apt-get update

Example of running:

# apt-get update
Get:1 http://ftp.altlinux.org p10/branch/x86_64 release [4223B]
Get:2 http://ftp.altlinux.org p10/branch/x86_64-i586 release [1665B]
Get:3 http://ftp.altlinux.org p10/branch/noarch release [2844B]
Fetched 8732B in 0s (89.8kB/s)
Get:1 http://ftp.altlinux.org p10/branch/x86_64/classic pkglist [23.8MB]
Get:2 http://ftp.altlinux.org p10/branch/x86_64/classic release [137B]
Get:3 http://ftp.altlinux.org p10/branch/x86_64-i586/classic pkglist [17.4MB]
Get:4 http://ftp.altlinux.org p10/branch/x86_64-i586/classic release [142B]
Get:5 http://ftp.altlinux.org p10/branch/noarch/classic pkglist [7164kB]
Get:6 http://ftp.altlinux.org p10/branch/noarch/classic release [137B]
Reading Package Lists... Done
Building Dependency Tree... Done

After running of this command, apt will update own cache of new information.

System upgrade

Attention! In ALT Linux is not customary to partial system upgrade via apt-get upgrade! You can drop own system with using this command! You need use only apt-get dist-upgrade instead it.
Attention! Do not hurry to press ENTER or Y. Study carefully, what APT suggets to remove, replace, upgrade or install. Truly you accepted with his changes? Never don't add option -y for control of APT.


For upgrade system to actual condition (except kernel), use next command:

# apt-get dist-upgrade

Example of run:

Note: When for you need upgrade several packages, you need confirm action with enter Y
# apt-get dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The following packages will be upgraded
  firefox libnss
2 upgraded, 0 newly installed, 0 removed and 0 not upgraded.
Need to get 59.2MB of archives.
After unpacking 2888kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.altlinux.org p10/branch/x86_64/classic libnss 3.89.0-alt1:p10+319679.40.8.1@1684328466 [1290kB]
Get:2 http://ftp.altlinux.org p10/branch/x86_64/classic firefox 112.0.2-alt0.p10.1:p10+319679.140.8.2@1684342590 [57,9MB]
Fetched 59.2MB in 2s (20.6MB/s)
Committing changes...
Preparing...                                                    #################################################################################################### [100%]
Updating / installing...
1: libnss-3.89.0-alt1                                           #################################################################################################### [ 25%]
2: firefox-112.0.2-alt0.p10.1                                   #################################################################################################### [ 50%]
Cleaning up / removing... 
3: firefox-110.0.1-alt0.p10.1                                   #################################################################################################### [ 75%]
4: libnss-3.88.1-alt1                                           #################################################################################################### [100%]
Done.

Packages installation

Note: Don't forget before package installation to update packages list via command apt-get update

You can to install packages with using next command:

# apt-get install package_name

For example:

 # apt-get install chromium

The program will find and install all needed packages automatic.

Also, you can to indicate some or large number of packages via space, at once.

 # apt-get install firefox gimp vlc
Note: Note, when you install several packages, you need to confirm action with button Y


For example:

# apt-get install stellarium
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  libqt5-script qt5-script-common
The following NEW packages will be installed:
  libqt5-script qt5-script-common stellarium
0 upgraded, 3 newly installed, 0 removed and 0 not upgraded.
Need to get 212MB of archives.
After unpacking 338MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.altlinux.org p10/branch/noarch/classic qt5-script-common 5.15.11-alt1:p10+335121.1500.3.1@1703503918 [5910B]
Get:2 http://ftp.altlinux.org p10/branch/x86_64/classic libqt5-script 5.15.11-alt1:p10+335121.1500.3.1@1703503918 [867kB]
Get:3 http://ftp.altlinux.org p10/branch/x86_64/classic stellarium 0.21.0-alt1.1:sisyphus+279564.100.1.3@1626602684 [212MB]
Fetched 212MB in 30s (6953kB/s)                                                                                                                                                  
Committing changes...
Preparing...                                                           #################################################################################################### [100%]
Updating / installing...
1: qt5-script-common-5.15.11-alt1                                      #################################################################################################### [ 33%]
2: libqt5-script-5.15.11-alt1                                          #################################################################################################### [ 67%]
3: stellarium-0.21.0-alt1.1                                            #################################################################################################### [100%]
Done.

Additional variants

  • Package installation from file system:
# apt-get install /home/user/Downloads/whois-5.5.0-alt1.x86_64.rpm
  • Package installation from its URLL:
# apt-get install http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/files/x86_64/RPMS/whois-5.5.0-alt1.x86_64.rpm
  • Package installation by name of exec file or library:
# apt-get install /usr/bin/whois

Some situations

Package is already installed, in repo is new version, you run new installation

  • If package is already installed and repo has not updates for this package, system will report about already installed package
# apt-get install stellarium
Reading Package Lists... Done
Building Dependency Tree... Done
stellarium is already the newest version.
0 upgraded, 0 newly installed, 0 removed and 0 not upgraded.
  • If repo have new version of package or new update, apt will start process of installation
    • Apt manager when install packages checks every dependency and if any package need to upgrade of replace, he will offer to take needed actions.
# apt-get install MySQL-server
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  MySQL-client
The following packages will be upgraded
  MySQL-client MySQL-server
2 upgraded, 0 newly installed, 0 removed and 7 not upgraded.
Need to get 32.1MB of archives.
After unpacking 11.1kB of additional disk space will be used.
Do you want to continue? [Y/n]

Fix of broken system

If at you due some causes (system freezing, power outage and others) work of APT was disrupted, and system messaged what need to "run fix", use next command:

# apt-get install -f

Package re-installation

For forced re-installation of specified packages run next command:

# apt-get install --reinstall packages names

For example:

# apt-get install --reinstall stellarium
Reading Package Lists... Done
Building Dependency Tree... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 removed and 9 not upgraded.
Need to get 212MB of archives.
After unpacking 0B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.altlinux.org p10/branch/x86_64/classic stellarium 0.21.0-alt1.1:sisyphus+279564.100.1.3@1626602684 [212MB]
Fetched 212MB in 10s (20.7MB/s)                                                                                                                                                  
Committing changes...
Preparing...                                                           #################################################################################################### [100%]
Updating / installing...
1: stellarium-0.21.0-alt1.1                                            #################################################################################################### [100%]
Done.

Package downloading to cache without installation

For package downloading to cache without installation use next command:

# apt-get install -d packages

For example:

# apt-get install -d boswars
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  liblua5.1 liblua5.1-preinstall libtolua++-lua5.1
The following NEW packages will be installed:
  boswars liblua5.1 liblua5.1-preinstall libtolua++-lua5.1
0 upgraded, 4 newly installed, 0 removed and 9 not upgraded.
Need to get 74.8MB of archives.
After unpacking 92.1MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.altlinux.org p10/branch/x86_64/classic liblua5.1-preinstall 5.1.5-alt17:sisyphus+278018.100.1.2@1625976910 [10.8kB]
Get:2 http://ftp.altlinux.org p10/branch/x86_64/classic liblua5.1 5.1.5-alt17:sisyphus+278018.100.1.2@1625976910 [93.9kB]
Get:3 http://ftp.altlinux.org p10/branch/x86_64/classic libtolua++-lua5.1 1.0.93-alt5:sisyphus+249325.100.1.1@1585937317 [15.8kB]
Get:4 http://ftp.altlinux.org p10/branch/x86_64/classic boswars 2.7-alt1_24.svn160110:sisyphus+264006.100.1.2@1609002965 [74.7MB]
Fetched 74.8MB in 9s (7557kB/s)                                                                                                                                                  
Download complete and in download only mode

Remove packages

Note

Packages removing is no more complicated than installation. For that you need to know package name, which to you want to remove and take note to messages by APT system.

To remove anything, you need to know what to possible to remove. For example, packages of programs, which you already not use, or did not use in general.

At removing of packages you need to follow the rule:

  • Not every package, which you don't use is not needed

The rule reports what soft, which you use, can use package, which you want to remove. Usual dependencies are built correctly and APT system always warn about which packages need to remove with specified. Should not be remove general system packages, you can to broke correct functionality of system. In this case apt will ask, do you really user to sure in own actions.

For example:

# apt-get remove coreutils
<big list of packages>
...
WARNING: The following essential packages will be removed
This should NOT be done unless you know exactly what you are doing!
...
You are about to do something potentially harmful
To continue type in the phrase 'Yes, do as I say!'

Commands