In this article we are going to learn about Nala – An Alternative To APT package manager. APT is slow… single downloading and generally uses slow mirrors as it doesn’t optimize them out of the box. It also doesn’t have a history so rolling back updates can really suck.
Help all that is now fixed with Nala and it is absolutely wonderful. Not only does it fix all that listed above but it makes the updates look beautiful.
Install Nala
Add Repository
echo "deb http://deb.volian.org/volian/ scar main" | sudo tee /etc/apt/sources.list.d/volian-archive-scar-unstable.listwget -qO - https://deb.volian.org/volian/scar.key | sudo tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg
Update Ubuntu
$ sudo apt update
Installation of Nala on Ubuntu 22.04
$ sudo apt install nala
Install on Ubuntu 21 and below:
$ sudo apt install nala-legacy
Update Mirrors
This will drastically speed up your downloads
$ sudo nala fetch
Select the mirrors you want from the list. Typically you will want to select three. Here is an example:
techdhee@ubuntu:~|⇒ sudo nala fetchFetching Ubuntu mirrors…╭─ Fastest Mirrors ───────────────────────────────────────────────────────╮│ ││ Index Mirror Score ││ 1 http://mirror.deace.id/ubuntu/ 76 ms ││ 2 http://repos.del.extreme-ix.org/ubuntu/ 101 ms ││ 3 http://mirror.soonkeat.sg/ubuntu/ 102 ms ││ 4 https://repo.huaweicloud.com/ubuntu/ 117 ms ││ 5 http://mirrors.piconets.webwerks.in/ubuntu-mirro… 132 ms ││ 6 https://mirrors.gbnetwork.com/ubuntu/ 138 ms ││ 7 http://kartolo.sby.datautama.net.id/ubuntu/ 142 ms ││ 8 http://mirror.datacenter.by/ubuntu/ 146 ms ││ 9 http://ubuntu.ntc.net.np/ubuntu/ 146 ms ││ 10 https://in.mirror.coganng.com/ubuntu-ports/ 146 ms ││ 11 http://ftp.tsukuba.wide.ad.jp/Linux/ubuntu/ 148 ms ││ 12 http://mirror.init7.net/ubuntu/ 149 ms ││ 13 http://ftp.tudelft.nl/archive.ubuntu.com/ 151 ms ││ 14 http://mirrors.bangmod.cloud/ubuntu/ 151 ms ││ 15 http://mirror.clearsky.vn/ubuntu/ 152 ms ││ 16 https://mirror.coganng.com/ubuntu-ports/ 157 ms ││ ││ Score is how many milliseconds it takes to download the Release file │╰──────────────────────────────────────────────────────────────────────────╯Mirrors you want to keep separated by spaces (1..16): 1 2 3 4 5
Convert APT to Nala
Add the following to your ~/.bashrc
or ~/.zshrc
AND /root/.bashrc
or /root/.zshrc
file:
apt() { command nala "$@"}sudo() { if [ "$1" = "apt" ]; then shift command sudo nala "$@" else command sudo "$@" fi}
From here you can install programs with apt or Nala command and it will always work perfectly!
Update Repositories using Nala
$ sudo nala update
techdhee@ubuntu:~|⇒ sudo nala update╭─ Updating Package List ──────────────────────────────────────────────────────╮│Updated: http://archive.ubuntu.com/ubuntu jammy/universe DEP-11 64x64 Icons…││Updated: http://archive.ubuntu.com/ubuntu jammy/universe DEP-11 64x64@2 Ico…││Updated: http://archive.ubuntu.com/ubuntu jammy/universe amd64 c-n-f Metada…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages […││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse i386 Packages [1…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse Translation-en […││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 DEP-11 Met…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse DEP-11 48x48 Ico…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse DEP-11 64x64 Ico…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse DEP-11 64x64@2 I…││Updated: http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 c-n-f Meta…││Fetched 94.0 MB in 6s (229 kB/s) │╰──────────────────────────────────────────────────────────────────────────────╯All packages are up to date.techdhee@ubuntu:~|⇒
Upgrade Packages
$ sudo nala upgrade -y
techdhee@ubuntu:~|⇒ sudo nala upgrade -y╭─ Updating Package List ──────────────────────────────────────────────────────╮│No Change: http://ftp.jaist.ac.jp/pub/Linux/ubuntu jammy InRelease ││No Change: https://repo.extreme-ix.org/ubuntu jammy InRelease ││No Change: http://deb.volian.org/volian scar InRelease ││No Change: http://archive.ubuntu.com/ubuntu jammy InRelease ││Updated: http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]││No Change: http://in.archive.ubuntu.com/ubuntu jammy InRelease ││No Change: http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease ││No Change: http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease ││Fetched 110 kB in 6s (0 B/s) │╰──────────────────────────────────────────────────────────────────────────────╯All packages are up to date.techdhee@ubuntu:~|⇒
Install Packages
To install a package using Nala, for example, neofetch, simply run the following command:
$ sudo nala install neofetch
echdhee@ubuntu:~|⇒ sudo nala install neofetch ================================================================================ Installing ================================================================================ Package: Version: Size: caca-utils 0.99.beta19-2.2ubuntu4 57 kB chafa 1.8.0-1 39 kB gsfonts 1:8.11+urwcyr1.0.7~pre44 3.1 MB -4.5 imagemagick 8:6.9.11.60+dfsg-1.3buil 15 kB d2 imagemagick-6-common 8:6.9.11.60+dfsg-1.3buil 64 kB d2 imagemagick-6.q16 8:6.9.11.60+dfsg-1.3buil 224 kB d2 jp2a 1.1.1-1 29 kB libaom3 3.3.0-1 1.7 MB libchafa0 1.8.0-1 88 kB libdav1d5 0.9.2-1 463 kB libde265-0 1.0.8-1 243 kB libfftw3-double3 3.3.8-2ubuntu8 770 kB libheif1 1.12.0-2build1 196 kB libid3tag0 0.15.1b-14 31 kB libilmbase25 2.5.7-2 175 kB libimlib2 1.7.4-1build1 195 kB libjxr-tools 1.2~git20170615.f752187- 16 kB 5 libjxr0 1.2~git20170615.f752187- 174 kB 5 liblqr-1-0 0.4.2-2.1 28 kB libmagickcore-6.q16-6 8:6.9.11.60+dfsg-1.3buil 1.8 MB d2 libmagickcore-6.q16-6-e… 8:6.9.11.60+dfsg-1.3buil 70 kB d2 libmagickwand-6.q16-6 8:6.9.11.60+dfsg-1.3buil 328 kB d2 libnetpbm10 2:10.0-15.4 59 kB libopenexr25 2.5.7-1 780 kB libsixel-bin 1.10.3-3 18 kB libsixel1 1.10.3-3 111 kB libx265-199 3.5-2 1.2 MB neofetch 7.1.0-3 84 kB netpbm 2:10.0-15.4 1.0 MB toilet 0.3-1.4 13 kB toilet-fonts 0.3-1.4 714 kB w3m 0.5.3+git20210102-6build 1.1 MB 3 w3m-img 0.5.3+git20210102-6build 24 kB 3 ================================================================================ Suggested, Will Not Be Installed ================================================================================ Package: Version: Size: imagemagick-doc 8:6.9.11.60+dfsg-1.3buil 1 kB d2 autotrace Virtual Package 0 B curl 7.81.0-1ubuntu1.3 194 kB enscript 1.6.5.90-3 407 kB ffmpeg 7:4.4.2-0ubuntu0.22.04.1 1.7 MB gimp 2.10.30-1build1 4.9 MB gnuplot 5.4.2+dfsg2-2 4 kB grads 3:2.2.1-4build1 4.6 MB graphviz 2.42.2-6 650 kB hp2xx 3.4.4-11 337 kB html2ps 1.0b7-5 98 kB libwmf-bin 0.2.12-5ubuntu1 34 kB mplayer 2:1.4+ds1-3build1 2.3 MB povray 1:3.7.0.10-1 1.3 MB radiance Virtual Package 0 B texlive-binaries:i386 2021.20210626.59705-1bui 10.0 MB ld1 fig2dev:i386 1:3.2.8b-1 431 kB ufraw-batch Virtual Package 0 B libfftw3-bin 3.3.8-2ubuntu8 36 kB libfftw3-dev 3.3.8-2ubuntu8 2.1 MB inkscape 1.1.2-3ubuntu1 17.8 MB figlet 2.2.5-3 133 kB cmigemo 1:1.2+gh0.20150404-7.1 8 kB dict 1.13.0+dfsg-1build2 48 kB dict-wn 1:3.0-37 10.7 MB dictd 1.13.0+dfsg-1build2 113 kB w3m-el 1.4.632+0.20210201.2305. 656 kB 54c3ccd-1 xsel 1.2.0+git9bfc13d.2018010 20 kB 9-3 ================================================================================ Summary ================================================================================ Install 33 Packages Total download size 14.9 MB Disk space required 57.3 MB Do you want to continue? [Y/n] Y╭─ Downloading… ───────────────────────────────────────────────────────────────╮│ Total Packages: 33/33 ││ Last Completed: gsfonts_8.11+urwcyr1.0.7~pre44-4.5_all.deb ││ Time Remaining: 0:00:00 ━━━━━━━━━━━━━━━━━ 100.0% • 14.9/14.9 MB • 549.2 kB/s │╰──────────────────────────────────────────────────────────────────────────────╯╭─ Installing Packages ────────────────────────────────────────────────────────╮│update-alternatives: using /usr/bin/montage-im6.q16 to provide /usr/bin/monta…││update-alternatives: using /usr/bin/montage-im6.q16 to provide /usr/bin/monta…││update-alternatives: using /usr/bin/mogrify-im6.q16 to provide /usr/bin/mogri…││update-alternatives: using /usr/bin/mogrify-im6.q16 to provide /usr/bin/mogri…││Setting up: imagemagick (8:6.9.11.60+dfsg-1.3build2) ││Processing: triggers for fontconfig (2.13.1-4.2ubuntu5) ││Processing: triggers for desktop-file-utils (0.26-1ubuntu3) ││Processing: triggers for hicolor-icon-theme (0.17-2) ││Processing: triggers for gnome-menus (3.36.0-1ubuntu3) ││Processing: triggers for libc-bin (2.35-0ubuntu3) ││Processing: triggers for man-db (2.10.2-1) ││Processing: triggers for mailcap (3.70+nmu1ubuntu1) ││╭────────────────────────────────────────────────────────────────────────────╮│││✔ Running dpkg … ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00 • 67/67│││╰────────────────────────────────────────────────────────────────────────────╯│╰──────────────────────────────────────────────────────────────────────────────╯Finished Successfullytechdhee@ubuntu:~|⇒
View Nala Help
To display nala command help section, use -h
or --help
flag like below:
$ nala -h
techdhee@ubuntu:~|⇒ nala -h Usage: nala [OPTIONS] COMMAND [ARGS]... Each command has its own help page. For Example: `nala history --help`Options: --version Show program's version number and exit. --license Reads the GPLv3 which Nala is licensed under. --install-completion Install completion for the current shell. --show-completion Show completion for the current shell, to copy it or customize the installation. -h, --help Show this message and exit.Commands: autopurge Autopurge packages that are no longer needed. autoremove Autoremove packages that are no longer needed. clean Clear out the local archive of downloaded package files. fetch Fetch fast mirrors to speed up downloads. history Show transaction history. install Install packages. list List packages based on package names. purge Purge packages. remove Remove packages. search Search package names and descriptions. show Show package details. update Update package list. upgrade Update package list and upgrade the system.
Conclusion
This is everything about the Nala package manager. Great work by the team that came up with all these drastic improvements and it has made it much easier on Debian-based distros.
If you have any questions, feel free to leave a comment.
Related Posts: