Table of Contents
In this article, I will take you through the steps to install gallery-dl on Ubuntu 20.04 LTS. gallery-dl is a free and open source command line utility to download images galleries and collections from Image Hosting Sites. It is an excellent cross platform utility with many configurations and capabilities available. One can easily download all the images by running just this easy to use utility in almost all the famous Linux distributions. Here we will see how to install gallery-dl and use on Ubuntu 20.04 LTS based systems.
How to Install gallery-dl on Ubuntu 20.04 LTS (Focal Fossa)
Step 1: Prerequisites
a) You should have a running
Ubuntu 20.04 LTS Server.
b) You should have
root access to run privileged commands.
c) You should have
python3 available in your Server.
Step 2: Update Your Server
Before going through the steps to install gallery-dl on your System, it is highly recommended to check for the latest updates from default Ubuntu repo and install it by using
sudo apt update && sudo apt upgrade command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade [sudo] password for cyberithub: Hit:1 https://downloads.plex.tv/repo/deb public InRelease Hit:2 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease Hit:3 http://in.archive.ubuntu.com/ubuntu focal InRelease Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Hit:6 https://dl.google.com/linux/chrome/deb stable InRelease Get:7 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [59.9 kB] Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [93.9 kB] Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,343 kB] Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B] Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [275 kB] Get:13 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,014 kB] ...........................................................
Step 3: Install gallery-dl
In the next step, you can choose to install gallery-dl command line utility by using one of the below methods.
a) Using apt-get
You can choose to install gallery-dl tool from default Ubuntu repo by using
sudo apt install gallery-dl command as shown below.
cyberithub@ubuntu:~$ sudo apt install gallery-dl Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libpython3.9-minimal libpython3.9-stdlib python3.9-minimal Use 'sudo apt autoremove' to remove them. Suggested packages: ffmpeg python3-brotli yt-dlp | youtube-dl The following NEW packages will be installed: gallery-dl 0 upgraded, 1 newly installed, 0 to remove and 40 not upgraded. Need to get 325 kB of archives. After this operation, 1,870 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu focal-backports/universe amd64 gallery-dl all 1.24.2-1~bpo20.04.1 [325 kB] Fetched 325 kB in 2s (212 kB/s) Selecting previously unselected package gallery-dl. (Reading database ... 256262 files and directories currently installed.) Preparing to unpack .../gallery-dl_1.24.2-1~bpo20.04.1_all.deb ... Unpacking gallery-dl (1.24.2-1~bpo20.04.1) ... Setting up gallery-dl (1.24.2-1~bpo20.04.1) ... Processing triggers for man-db (2.9.1-1) ...
b) Using Snap
You also have the option to install the utility as a snap package from Snap Store by running
sudo snap install gallery-dl command as shown below.
cyberithub@ubuntu:~$ sudo snap install gallery-dl gallery-dl 1.24.4 from Mike Fährmann (mikf123) installed
c) Using Python3
Next, you also have the option to install it as a python package by using
python3 -m pip install -U gallery-dl command as shown below.
cyberithub@ubuntu:~$ python3 -m pip install -U gallery-dl Defaulting to user installation because normal site-packages is not writeable Collecting gallery-dl Downloading gallery_dl-1.24.4-py3-none-any.whl (573 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 573.7/573.7 kB 1.7 MB/s eta 0:00:00 Requirement already satisfied: requests>=2.11.0 in /usr/lib/python3/dist-packages (from gallery-dl) (2.22.0) Installing collected packages: gallery-dl Successfully installed gallery-dl-1.24.4
Step 4: Using gallery-dl
After successful installation, you can choose to download images from a image hosting site called
danbooru by using below command. Below example is taken from GitHub website.
cyberithub@ubuntu:~$ gallery-dl "https://danbooru.donmai.us/posts?tags=bonocho" ./gallery-dl/danbooru/bonocho/danbooru_631416_f5b4621706bb5640f3ec75883ebd399e.jpg ./gallery-dl/danbooru/bonocho/danbooru_631328_e27ca099edc9c1eb973dbed72b7ba70d.jpg ./gallery-dl/danbooru/bonocho/danbooru_320235_37d1b14bda9652c5b9e1101b69efb225.jpg ./gallery-dl/danbooru/bonocho/danbooru_319152_788e3133596209b6ce09f8ea55da5daa.jpg ./gallery-dl/danbooru/bonocho/danbooru_294929_ac8e3b92ea328ce9cf7211e69c905bf9.jpg
It is very much possible that while running above command, you might get below warning if you installed the application as snap.
cyberithub@ubuntu:~$ gallery-dl "https://danbooru.donmai.us/posts?tags=bonocho" It seems that this snap isn't connected to the `removable-media` security confinement interface. If you want to save the files under `/media`, `/run/media`, or `/mnt` directories you need to connect this snap to the `removable-media` interface by running the following command in a terminal: sudo snap connect gallery-dl:removable-media To disable this warning create an empty file at the following path: /home/cyberithub/snap/gallery-dl/common/marker_disable_interface_warning
So to fix this warning you can run below command to connect the snap with removable-media.
cyberithub@ubuntu:~$ sudo snap connect gallery-dl:removable-media Connect gallery-dl:removable-media to snapd:removable-media
You can also disable the warning by creating an empty file as instructed on the above output.
cyberithub@ubuntu:~$ touch /home/cyberithub/snap/gallery-dl/common/marker_disable_interface_warning
Step 5: Uninstall gallery-dl
Once you are done using gallery-dl utility, you can choose to uninstall it from your System by using one of the below methods depending on how you have installed it.
a) Using apt-get
If you installed the utility from default Ubuntu repo then you can use
sudo apt remove gallery-dl command to uninstall gallery-dl from the System.
cyberithub@ubuntu:~$ sudo apt remove gallery-dl Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libpython3.9-minimal libpython3.9-stdlib python3.9-minimal Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: gallery-dl 0 upgraded, 0 newly installed, 1 to remove and 40 not upgraded. After this operation, 1,870 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 256480 files and directories currently installed.) Removing gallery-dl (1.24.2-1~bpo20.04.1) ... Processing triggers for man-db (2.9.1-1) ...
b) Using Snap
If you installed the utility as snap package then you can remove it from your system by using
sudo snap remove gallery-dl command as shown below.
cyberithub@ubuntu:~$ sudo snap remove gallery-dl gallery-dl removed
c) Using Python3
If you installed the utility as python package then you can remove it by using
python3 -m pip uninstall gallery-dl command as shown below.
cyberithub@ubuntu:~$ python3 -m pip uninstall gallery-dl Found existing installation: gallery-dl 1.24.4 Uninstalling gallery-dl-1.24.4: Would remove: /home/cyberithub/.local/bin/gallery-dl /home/cyberithub/.local/lib/python3.8/site-packages/gallery_dl-1.24.4.dist-info/* /home/cyberithub/.local/lib/python3.8/site-packages/gallery_dl/* /home/cyberithub/.local/share/bash-completion/completions/gallery-dl /home/cyberithub/.local/share/fish/vendor_completions.d/gallery-dl.fish /home/cyberithub/.local/share/man/man1/gallery-dl.1 /home/cyberithub/.local/share/man/man5/gallery-dl.conf.5 /home/cyberithub/.local/share/zsh/site-functions/_gallery-dl Proceed (Y/n)? Y Successfully uninstalled gallery-dl-1.24.4