Yt-dlp: youtube-dl alternative

yt-dlp is a youtube-dl fork based on the now inactive youtube-dlc. The main focus of this project is adding new features and patches while also keeping up to date with the original project.

Official GitHub repository: https://github.com/yt-dlp/yt-dlp

Installation:

sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp

Yt-dlp usage similar as a youtube-dl. To show all supported video formats use command:

yt-dlp -F https://youtube.com/video-id

To download video use command with flag yt-dlp -f <firmat-id> <video-url>

yt-dlp -f 22 https://youtube.com/video-id

To download all videos from playlist and convert them to mp3 use command:

yt-dlp --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist 'YOUTUBE-PLAYLIST-URL'

Install Proxmox VE on Debian

Proxmox VE (Proxmox Virtual Environment) – this is a open source virtualization system, that uses a hypervisor KVM and LXC, based on Debian GNU Linux.

First edit your /etc/hosts file and write there your IP address:

sudo nano /etc/hosts
192.168.1.2    hostname.com   hostname

Add Proxmox VE distribution to your operating system:

echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list

Add key for Proxmox VE repository:

wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg
chmod +r /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg # optional, if you have a non-default umask

Update packages list and upgrade your system:

apt update && apt full-upgrade

Install Proxmox VE packages:

apt install proxmox-ve postfix open-iscsi

Reboot your system

reboot

After reboot open your web borwser and go to https://192.168.1.2:8006, where 192.168.1.2 – is a IP address of your Proxmox computer, and 8006 – default Proxmox port.

That’s all, Proxmox VE successfully installed on your PC. Now you can create new Virtual machines…

How to auto start program in Linux with root privilegies

To run some script or program when computer start in linux – copy this program to /etc/init.d directory. Change permissions to 755.

For example let’s create simple bash script “ntpsync“that sync system clock with NTP server in Internet:

service ntp stop
ntpdate time.nist.gov
service ntp start

Copy this sctipt to /etc/init.d, create symbolic link to /etc/rc3.d:

ln -s /etc/init.d/ntpsync /etc/rc3.d/ntpsync

Rc3 level – Мulti-user regime width network support.

That’s all, on next startup Linux will run this script, and automatically sync system clock with NTP server from Internet.

Download video from YouTube and convert it to mp3 in Linux

To download video from YouTube you can use some site in Internet, but many of them have ads, viruses and don’t do what you need.

But you can use simple program youtube-dl. It is free, open source, work in console and can download video, audio from YouTube in one click.

To install youtube-dl use simple commands:

1. Install python:

sudo apt install python3
sudo ln -s /usr/bin/python3 /usr/local/bin/python

2. Install youtube-dl:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

How to use youtube-dl:

To get all supported formats from YouTube video use command:

youtube-dl -F https://www.youtube.com/watch?v=QpqdtB4ssX0

Thic sommand show you all video formats and id’s

To download some format use flag -f and ID from previous command:

youtube-dl -f 18 https://www.youtube.com/watch?v=QpqdtB4ssX0

That’s all, video starts download. You can use it in terminal and don’t need to open suspicious sites.

You can also download playlists of video from YouTube the same way.

Convert video to mp3 audio.

And you can convert video to mp3 using program ffmpeg. To install ffmpeg use command:

sudo apt install ffmpeg

To convert video to mp3 use command:

ffmpeg -i video.mp4 -acodec libmp3lame audio.mp3

Configure thumbnails for video files in nextcloud

Nextcloud use ffmpeg to generate thumbnails from video files, so you need to install ffmpeg on your server first:

sudo apt install ffmpeg

Now configure nextcloud. Open configuration file /config/config.php and add this lines:

'enable_previews' => true,
'enabledPreviewProviders' => array (
        0 => 'OC\\Preview\\Image',
        1 => 'OC\\Preview\\Movie',
        2 => 'OC\\Preview\\TXT',
),

That’s all, it is very simple 😉

How to Install NGINX and PHP 7.4 on Debian 10

Step 1: Install Nginx

Firstly install the prerequisites:

sudo apt install curl gnupg2 ca-certificates lsb-release

Then we need to add the Nginx mainline package to our repository so that when we run apt install nginx, we will download the mainline version instead of the old stable version.

echo "deb http://nginx.org/packages/mainline/debian `lsb_release -cs` nginx" 
    | sudo tee /etc/apt/sources.list.d/nginx.list

Next we need to download the signing key so that we can verify its authenticity

curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -

If it prints out OK! then you are good to go!

Now update package repositories and install Nginx:

sudo apt update
sudo apt install nginx

That’s it! You have now installed the latest release of Nginx on Debian 10. You should now start it!

sudo systemctl start nginx.service

And Don’t forget to make it automatically start on system boot as well.

sudo systemctl enable nginx.service

Step 2: Install PHP 7.4

To install PHP 7.4 we need to add repository. Since PHP 7.4 didn’t come with Debian 10 it is required to add the following repository. Write this commands:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Update package repositories:

sudo apt update

And now install PHP 7.4:

sudo apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-soap php7.4-imap

It is recommended to raise the memory limit to improve the overall performance. Your PHP configuration is located in /etc/php/7.4/fpm/php.ini.

sudo vim /etc/php/7.4/fpm/php.ini

Replace it with memory_limit = 256 and save document with :wq command. How to edit files in text editor Vim you can read here: How to exit Vim? And other required commands.

Step 3: Configure Nginx

Add nginx to www-data group

sudo usermod -a -G www-data nginx

Change owner of directory to www-data

sudo chown -R www-data /usr/share/nginx/html

Go into your default.conf file

sudo vim /etc/nginx/conf.d/default.conf

Replace your existing configuration file with the one below

server {
    listen       80;
    server_name  localhost;

    root   /usr/share/nginx/html;
    index  index.php index.html index.htm;

   location / {
    if ($request_uri ~ ^/(.*)\.html$) {
        return 302 /$1;
        }
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
        location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

Restart Nginx server:

service nginx restart

Now you can cteate test file fith information about PHP version:

nano /usr/share/nginx/html/phpinfo.php
phpinfo();

In Web-browser write IP address of server:
http://192.168.1.1/phpinfo.php

That’s all Nginx Server with PHP 7.4 installed.

Change default Grub 2 theme

Different themes for Grub 2 boot loader you can find on Gnome-Look website: https://www.gnome-look.org/browse?cat=109&ord=latest

To change Grub them use three simple steps:

1. Copy folder with theme into Grub themes directory:

/boot/grub/themes

2. Edit Grub configuration file /etc/default/grub and write there GRUB_THEME parameter:

GRUB_THEME=/boot/grub/themes/theme_folder/theme.txt

3. Update Grub configuration:

update-grub

Best three Grub themes:

1. Vimix

2. Tela

3. CyberRe

You don’t need Windows anymore

Microsoft Windows is a proprietary operating system which has captured 80% personal computers in the world and using their monopoly position dictates their rules of the game.

In addition, Microsoft collects your personal information and sells it to third parties, which endangers your security.

To change the situation, many people are looking for alternative operating systems, and one such alternatives is GNU Linux.

Many years Linux was leader operating system on web servers and mainframes, but on personal computers it occupied a miserable 3%. But now the situation has changed and GNU Linux is the best free and open source alternative for proprietary Microsoft Windows.

Install monit in Debian 10 (buster)

Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

To install Monit on Debian 10 GNU Linux (Buster) you need to add backports repository:

printf "%s\n" "deb http://ftp.de.debian.org/debian buster-backports main" | \
sudo tee /etc/apt/sources.list.d/buster-backports.list

Then update package list:

sudo apt update

And install buster-backports and monit package:

sudo apt install -t buster-backports monit

To start monit service and show running status use commands:

sudo systemctl start monit
sudo systemctl status monit

If you want to enable auto start monit when system starts use command:

sudo systemctl enable monit

Now let’s configure monit to monitoring Apache2 and Nginx services. Open monit configuration file:

sudo vim /etc/monit/monitrc

To change monitoring interval change option:

set daemon 120

To send email if monitored services is down edit this options:

set mailserver your.mail.server
set alert your.mail.address

You can enable Web-interface where you can view information about monitoring services. By default monit starts on 2812 port. Enable this two lines and change administrator password:

set httpd port 2812 and
allow admin:monit # require user 'admin' with password 'monit'

Don’t forget to open port 2812 in firewall and restart monit service:

sudo systemctl restart monit

Now open http://your-site.com:2812 and see monit web interface:

If you want to monitor some custom services on your server go to /etc/monit/conf-available and copy that configuration files to /etc/monit/conf.d: