This tutorial shows how to install and update the popular youtube-dl video downloader in Ubuntu, Fedora, Debian, and other Linux.
Youtube-dl is a free open-source command line tool to download video and audio from YouTube.com. It also supports for downloading from other websites, e.g., Twitter, Facebook, Vimeo, Twitch, DailyMotion.
Many video players and downloading apps, e.g., SMPlayer and ClipGrab use youtube-dl as backend. So you may need to install the tool and keep it always updated!
This tutorial works on most Linux Distros, including Ubuntu, Debian, Linux Mint, CentOS, Arch Linux, Manjaro, Fedora, openSUSE, and more.
Install youtube-dl in Linux via the official way:
Many Linux Distros and third-party repositories provide the youtube-dl package. This is however the official way that works on all Linux.
1.) Firstly open terminal from your system app launcher, or login the command console of your Linux server.
2.) Download youtube-dl from its official downloads page.
To do so, run either wget command:
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
Or use curl command as you prefer:
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
3.) Finally add executable permission (see the last picture) and done:
sudo chmod a+rx /usr/local/bin/youtube-dl
How to Update youtube-dl Manually:
It’s easy to update the download manager as is has a built-in option to do the job. Just run the command line tool with
--update flag. Sudo is required as it’s installed to system wide.
To do so, open terminal and run command:
sudo youtube-dl -U
Auto Update youtube-dl via schedule job:
Without using third-party repository, you can create a schedule job to update the download manager every day, every week, or every month at specified time.
1.) Open terminal from system app launcher or login to command console of your Linux server. Then run command:
sudo crontab -e
Type user password for sudo prompt. And choose an editor if prompted (nano is recommended).
crontab may be not pre-installed in Fedora, CenterOS. Just install it via command:
sudo yum install cronie
2.) The command will open the crontab file with a command line text editor. Scroll down and add a new line:
For instance, auto run command to update youtube-dl at 12:00 every Monday:
0 12 * * 1 /usr/local/bin/youtube-dl -U
You can replace the line to set to update every day, for instance, at 2:30 AM:
30 2 * * * /usr/local/bin/youtube-dl -U
Or set to update every month on 4th for example at midnight (00:00):
0 0 4 * * /usr/local/bin/youtube-dl -U
Here is a picture explains what do the flags before command mean:
After writing the line for the schedule task, press Ctrl+X, then type y, and hit Enter to save the change (for nano text editor only).