Deploy my web-youtube-downloader in my Azure VM!
Tags: azuretrialhack, microsoft, azure
Published: 2022-03-06 08:22:47

---
title: Deploy my web-youtube-downloader in my Azure VM!
published: true
description: My submission to the Microsoft Azure Trial Hackathon on DEV!
tags: azuretrialhack, microsoft, azure
---

### Instructions

I use the Azure Virtual Machines to deploy my we-base YouTube downloader and it can help developers to download the specific YouTube video easily via my website :)!

### Overview of My Submission

Here are my quick steps to complete this repository

- Creating a Azure VM and use the Ubuntu 20.04 LTS via the Azure portal.
- Using the SSH client to login the remote server.
- Installing the PHP 8.1, Nginx and other required PHP packages with `apt-get` command.
- Cloning the GitHub repository with `git` command.
- Running the `build.sh` shell script.

Here are snippets about my running command histories:

```Bash
lee@lee-VirtualBox:~$ ssh peterli@20.121.186.160
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.13.0-1014-azure x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Mar  6 05:41:26 UTC 2022

  System load:  0.0               Processes:             127
  Usage of /:   4.8% of 28.90GB   Users logged in:       0
  Memory usage: 3%                IPv4 address for eth0: 10.0.0.4
  Swap usage:   0%

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


Last login: Sun Mar  6 05:34:06 2022 from 114.32.26.216
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

peterli@web-youtube-downloader:~$ sudo apt-get update
Hit:1 http://azure.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8628 kB]
Get:6 http://azure.archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:11 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1608 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [14.8 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [905 kB]
Get:14 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [201 kB]
Get:15 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [20.2 kB]
Get:16 http://azure.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [23.7 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [7312 B]
Get:18 http://azure.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [580 B]
Get:19 http://azure.archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [42.2 kB]
Get:20 http://azure.archive.ubuntu.com/ubuntu focal-backports/main Translation-en [10.1 kB]
Get:21 http://azure.archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [864 B]
Get:22 http://azure.archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:23 http://azure.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [22.7 kB]
Get:24 http://azure.archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [15.4 kB]
Get:25 http://azure.archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [804 B]
Get:26 http://azure.archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:27 http://azure.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [1275 kB]
Get:28 http://azure.archive.ubuntu.com/ubuntu focal-security/main Translation-en [224 kB]
Get:29 http://azure.archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [9732 B]
Get:30 http://azure.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [680 kB]
Get:31 http://azure.archive.ubuntu.com/ubuntu focal-security/universe Translation-en [117 kB]
Get:32 http://azure.archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [13.2 kB]
Get:33 http://azure.archive.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [20.7 kB]
Get:34 http://azure.archive.ubuntu.com/ubuntu focal-security/multiverse Translation-en [5196 B]
Get:35 http://azure.archive.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [500 B]
Fetched 19.8 MB in 3s (6263 kB/s)
Reading package lists... Done
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  open-vm-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 647 kB of archives.
After this operation, 952 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 open-vm-tools amd64 2:11.3.0-2ubuntu0~ubuntu20.04.2 [647 kB]
Fetched 647 kB in 0s (6344 kB/s)
(Reading database ... 57736 files and directories currently installed.)
Preparing to unpack .../open-vm-tools_2%3a11.3.0-2ubuntu0~ubuntu20.04.2_amd64.deb ...
Unpacking open-vm-tools (2:11.3.0-2ubuntu0~ubuntu20.04.2) over (2:11.0.5-4) ...
Setting up open-vm-tools (2:11.3.0-2ubuntu0~ubuntu20.04.2) ...
Installing new version of config file /etc/vmware-tools/tools.conf.example ...
Installing new version of config file /etc/vmware-tools/vgauth.conf ...
Removing obsolete conffile /etc/vmware-tools/vm-support ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo add-apt-repository ppa:ondrej/php -y
Hit:1 http://azure.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [23.9 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [101 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main Translation-en [33.6 kB]
Fetched 159 kB in 1s (142 kB/s)
Reading package lists... Done
peterli@web-youtube-downloader:~$ sudo add-apt-repository ppa:ondrej/nginx -y
Hit:1 http://azure.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease
Get:5 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal InRelease [23.8 kB]
Hit:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease
Get:7 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 Packages [5892 B]
Get:8 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main Translation-en [6104 B]
Fetched 35.8 kB in 1s (44.1 kB/s)
Reading package lists... Done
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo apt-get install php8.1-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpcre2-8-0 php-common php8.1-common php8.1-opcache php8.1-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php-common php8.1-cli php8.1-common php8.1-opcache php8.1-readline
The following packages will be upgraded:
  libpcre2-8-0
1 upgraded, 5 newly installed, 0 to remove and 6 not upgraded.
Need to get 3313 kB of archives.
After this operation, 15.9 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 libpcre2-8-0 amd64 10.39-2+ubuntu20.04.1+deb.sury.org+1 [202 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php-common all 2:92+ubuntu20.04.1+deb.sury.org+2 [16.3 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-common amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [1091 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-opcache amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [332 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-readline amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [12.8 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-cli amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [1659 kB]
Fetched 3313 kB in 3s (1243 kB/s)
(Reading database ... 57751 files and directories currently installed.)
Preparing to unpack .../libpcre2-8-0_10.39-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre2-8-0:amd64 (10.39-2+ubuntu20.04.1+deb.sury.org+1) over (10.34-7) ...
Setting up libpcre2-8-0:amd64 (10.39-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php-common.
(Reading database ... 57751 files and directories currently installed.)
Preparing to unpack .../php-common_2%3a92+ubuntu20.04.1+deb.sury.org+2_all.deb ...
Unpacking php-common (2:92+ubuntu20.04.1+deb.sury.org+2) ...
Selecting previously unselected package php8.1-common.
Preparing to unpack .../php8.1-common_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-common (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-opcache.
Preparing to unpack .../php8.1-opcache_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-opcache (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-readline.
Preparing to unpack .../php8.1-readline_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-readline (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-cli.
Preparing to unpack .../php8.1-cli_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-cli (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Setting up php-common (2:92+ubuntu20.04.1+deb.sury.org+2) ...
Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer.
Setting up php8.1-common (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/calendar.ini with new version

Creating config file /etc/php/8.1/mods-available/ctype.ini with new version

Creating config file /etc/php/8.1/mods-available/exif.ini with new version

Creating config file /etc/php/8.1/mods-available/fileinfo.ini with new version

Creating config file /etc/php/8.1/mods-available/ffi.ini with new version

Creating config file /etc/php/8.1/mods-available/ftp.ini with new version

Creating config file /etc/php/8.1/mods-available/gettext.ini with new version

Creating config file /etc/php/8.1/mods-available/iconv.ini with new version

Creating config file /etc/php/8.1/mods-available/pdo.ini with new version

Creating config file /etc/php/8.1/mods-available/phar.ini with new version

Creating config file /etc/php/8.1/mods-available/posix.ini with new version

Creating config file /etc/php/8.1/mods-available/shmop.ini with new version

Creating config file /etc/php/8.1/mods-available/sockets.ini with new version

Creating config file /etc/php/8.1/mods-available/sysvmsg.ini with new version

Creating config file /etc/php/8.1/mods-available/sysvsem.ini with new version

Creating config file /etc/php/8.1/mods-available/sysvshm.ini with new version

Creating config file /etc/php/8.1/mods-available/tokenizer.ini with new version
Setting up php8.1-readline (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/readline.ini with new version
Setting up php8.1-opcache (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/opcache.ini with new version
Setting up php8.1-cli (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php8.1 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar8.1 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar8.1 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/8.1/cli/php.ini with new version
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Processing triggers for php8.1-cli (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo apt-get install curl php8.1-xml php8.1-curl php8.1-xml php8.1-mbstrin
g php8.1-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version (7.68.0-1ubuntu2.7).
curl set to manually installed.
The following additional packages will be installed:
  libonig5 libzip4
The following NEW packages will be installed:
  libonig5 libzip4 php8.1-curl php8.1-mbstring php8.1-xml php8.1-zip
0 upgraded, 6 newly installed, 0 to remove and 6 not upgraded.
Need to get 753 kB of archives.
After this operation, 2595 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libonig5 amd64 6.9.4-1 [142 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 libzip4 amd64 1.7.3-1+ubuntu20.04.1+deb.sury.org+2 [55.1 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-curl amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [33.7 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-mbstring amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [392 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-xml amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [106 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-zip amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [24.2 kB]
Fetched 753 kB in 2s (431 kB/s)
Selecting previously unselected package libonig5:amd64.
(Reading database ... 57864 files and directories currently installed.)
Preparing to unpack .../0-libonig5_6.9.4-1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.4-1) ...
Selecting previously unselected package libzip4:amd64.
Preparing to unpack .../1-libzip4_1.7.3-1+ubuntu20.04.1+deb.sury.org+2_amd64.deb ...
Unpacking libzip4:amd64 (1.7.3-1+ubuntu20.04.1+deb.sury.org+2) ...
Selecting previously unselected package php8.1-curl.
Preparing to unpack .../2-php8.1-curl_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-curl (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-mbstring.
Preparing to unpack .../3-php8.1-mbstring_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-mbstring (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-xml.
Preparing to unpack .../4-php8.1-xml_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-xml (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.1-zip.
Preparing to unpack .../5-php8.1-zip_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-zip (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libzip4:amd64 (1.7.3-1+ubuntu20.04.1+deb.sury.org+2) ...
Setting up php8.1-curl (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/curl.ini with new version
Setting up php8.1-xml (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/dom.ini with new version

Creating config file /etc/php/8.1/mods-available/simplexml.ini with new version

Creating config file /etc/php/8.1/mods-available/xml.ini with new version

Creating config file /etc/php/8.1/mods-available/xmlreader.ini with new version

Creating config file /etc/php/8.1/mods-available/xmlwriter.ini with new version

Creating config file /etc/php/8.1/mods-available/xsl.ini with new version
Setting up php8.1-zip (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/zip.ini with new version
Setting up libonig5:amd64 (6.9.4-1) ...
Setting up php8.1-mbstring (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/mods-available/mbstring.ini with new version
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Processing triggers for php8.1-cli (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo apt-get install -y nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core geoip-database libfontconfig1 libgd3 libgeoip1 libjbig0
  libjpeg-turbo8 libjpeg8 libnginx-mod-brotli libnginx-mod-http-geoip libnginx-mod-http-image-filter
  libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-ssl-ct libnginx-mod-stream
  libnginx-mod-stream-geoip libtiff5 libwebp6 libxpm4 nginx-common nginx-core
Suggested packages:
  libgd-tools geoip-bin fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core geoip-database libfontconfig1 libgd3 libgeoip1 libjbig0
  libjpeg-turbo8 libjpeg8 libnginx-mod-brotli libnginx-mod-http-geoip libnginx-mod-http-image-filter
  libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-ssl-ct libnginx-mod-stream
  libnginx-mod-stream-geoip libtiff5 libwebp6 libxpm4 nginx nginx-common nginx-core
0 upgraded, 23 newly installed, 0 to remove and 6 not upgraded.
Need to get 5859 kB of archives.
After this operation, 18.8 MB of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 fonts-dejavu-core all 2.37-1 [1041 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 fontconfig-config all 2.13.1-2ubuntu3 [28.8 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 geoip-database all 20191224-2 [3029 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 libgd3 amd64 2.3.0-2+ubuntu20.04.1+deb.sury.org+1 [135 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libfontconfig1 amd64 2.13.1-2ubuntu3 [114 kB]
Get:6 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libjpeg-turbo8 amd64 2.0.3-0ubuntu1.20.04.1 [117 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2194 B]
Get:8 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libjbig0 amd64 2.1-3.1build1 [26.7 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libwebp6 amd64 0.6.1-2ubuntu0.20.04.1 [185 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libtiff5 amd64 4.1.0+git191117-2ubuntu0.20.04.2 [162 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libxpm4 amd64 1:3.5.12-1 [34.0 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libgeoip1 amd64 1.6.12-6build1 [70.5 kB]
Get:13 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 nginx-common all 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [60.9 kB]
Get:14 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-brotli amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [35.9 kB]
Get:15 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-http-geoip amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [33.6 kB]
Get:16 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-http-image-filter amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [37.2 kB]
Get:17 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-http-xslt-filter amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [35.4 kB]
Get:18 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-mail amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [67.6 kB]
Get:19 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-ssl-ct amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [33.1 kB]
Get:20 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-stream amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [90.6 kB]
Get:21 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 libnginx-mod-stream-geoip amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [32.9 kB]
Get:22 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 nginx-core amd64 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [459 kB]
Get:23 http://ppa.launchpad.net/ondrej/nginx/ubuntu focal/main amd64 nginx all 1.20.1-2+ubuntu20.04.1+deb.sury.org+1 [28.0 kB]
Fetched 5859 kB in 4s (1507 kB/s)
Preconfiguring packages ...
Selecting previously unselected package fonts-dejavu-core.
(Reading database ... 57922 files and directories currently installed.)
Preparing to unpack .../00-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../01-fontconfig-config_2.13.1-2ubuntu3_all.deb ...
Unpacking fontconfig-config (2.13.1-2ubuntu3) ...
Selecting previously unselected package geoip-database.
Preparing to unpack .../02-geoip-database_20191224-2_all.deb ...
Unpacking geoip-database (20191224-2) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../03-libfontconfig1_2.13.1-2ubuntu3_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../04-libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../05-libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../06-libjbig0_2.1-3.1build1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1build1) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../07-libwebp6_0.6.1-2ubuntu0.20.04.1_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2ubuntu0.20.04.1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../08-libtiff5_4.1.0+git191117-2ubuntu0.20.04.2_amd64.deb ...
Unpacking libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.2) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../09-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../10-libgd3_2.3.0-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libgd3:amd64 (2.3.0-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libgeoip1:amd64.
Preparing to unpack .../11-libgeoip1_1.6.12-6build1_amd64.deb ...
Unpacking libgeoip1:amd64 (1.6.12-6build1) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../12-nginx-common_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_all.deb ...
Unpacking nginx-common (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-brotli.
Preparing to unpack .../13-libnginx-mod-brotli_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-brotli (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-http-geoip.
Preparing to unpack .../14-libnginx-mod-http-geoip_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-http-geoip (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../15-libnginx-mod-http-image-filter_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../16-libnginx-mod-http-xslt-filter_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../17-libnginx-mod-mail_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-mail (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-ssl-ct.
Preparing to unpack .../18-libnginx-mod-ssl-ct_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-ssl-ct (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../19-libnginx-mod-stream_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-stream (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package libnginx-mod-stream-geoip.
Preparing to unpack .../20-libnginx-mod-stream-geoip_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libnginx-mod-stream-geoip (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../21-nginx-core_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking nginx-core (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../22-nginx_1.20.1-2+ubuntu20.04.1+deb.sury.org+1_all.deb ...
Unpacking nginx (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up nginx-common (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libjbig0:amd64 (2.1-3.1build1) ...
Setting up libnginx-mod-http-xslt-filter (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libwebp6:amd64 (0.6.1-2ubuntu0.20.04.1) ...
Setting up fonts-dejavu-core (2.37-1) ...
Setting up libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Setting up libnginx-mod-brotli (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libgeoip1:amd64 (1.6.12-6build1) ...
Setting up geoip-database (20191224-2) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up libnginx-mod-mail (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up fontconfig-config (2.13.1-2ubuntu3) ...
Setting up libnginx-mod-stream (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libnginx-mod-ssl-ct (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libnginx-mod-stream-geoip (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libnginx-mod-http-geoip (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.2) ...
Setting up libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Setting up libgd3:amd64 (2.3.0-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up libnginx-mod-http-image-filter (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up nginx-core (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Setting up nginx (1.20.1-2+ubuntu20.04.1+deb.sury.org+1) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ sudo apt-get install -y git
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.25.1-1ubuntu3.2).
git set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
peterli@web-youtube-downloader:~$
peterli@web-youtube-downloader:~$ cd /var/www/html/
peterli@web-youtube-downloader:/var/www/html$ sudo git clone https://github.com/peter279k/web-youtube-downloader
Cloning into 'web-youtube-downloader'...
remote: Enumerating objects: 109, done.
remote: Counting objects: 100% (109/109), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 109 (delta 59), reused 80 (delta 31), pack-reused 0
Receiving objects: 100% (109/109), 15.44 KiB | 1.71 MiB/s, done.
Resolving deltas: 100% (59/59), done.
peterli@web-youtube-downloader:/var/www/html$
peterli@web-youtube-downloader:/var/www/html$ cd web-youtube-downloader/
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo apt-get install dos2unix
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  dos2unix
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 374 kB of archives.
After this operation, 1342 kB of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 dos2unix amd64 7.4.0-2 [374 kB]
Fetched 374 kB in 0s (15.5 MB/s)
Selecting previously unselected package dos2unix.
(Reading database ... 58185 files and directories currently installed.)
Preparing to unpack .../dos2unix_7.4.0-2_amd64.deb ...
Unpacking dos2unix (7.4.0-2) ...
Setting up dos2unix (7.4.0-2) ...
Processing triggers for man-db (2.9.1-1) ...
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo ./build.sh
Cloning Web YouTube Downloader...
Cloning into 'youtube-downloader'...
remote: Enumerating objects: 574, done.
remote: Counting objects: 100% (189/189), done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 574 (delta 118), reused 107 (delta 107), pack-reused 385
Receiving objects: 100% (574/574), 139.40 KiB | 17.42 MiB/s, done.
Resolving deltas: 100% (336/336), done.
All settings correct for using Composer
Downloading...

Composer (version 2.2.7) successfully installed to: /var/www/html/web-youtube-downloader/composer.phar
Use it: php composer.phar

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 2 installs, 0 updates, 0 removals
As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' or '7z' may remediate them.
  - Installing athlon1600/php-curl-client (v1.1.3): Extracting archive
  - Installing athlon1600/php-curl-file-downloader (v1.0.2): Extracting archive
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
dos2unix: *.html: No such file or directory
dos2unix: Skipping *.html, not a regular file.
dos2unix: *.php: No such file or directory
dos2unix: Skipping *.php, not a regular file.
Building Web YouTube Downloader has been done.
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo vim /etc/nginx/sites-available/def
ault
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo systemctl reload nginx.service
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo apt-get install php8.1-fpm -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php8.1-fpm
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1669 kB of archives.
After this operation, 5608 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.1-fpm amd64 8.1.3-1+ubuntu20.04.1+deb.sury.org+1 [1669 kB]
Fetched 1669 kB in 1s (2444 kB/s)
Selecting previously unselected package php8.1-fpm.
(Reading database ... 58285 files and directories currently installed.)
Preparing to unpack .../php8.1-fpm_8.1.3-1+ubuntu20.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.1-fpm (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
Setting up php8.1-fpm (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.1/fpm/php.ini with new version
Created symlink /etc/systemd/system/multi-user.target.wants/php8.1-fpm.service → /lib/systemd/system/php8.1-fpm.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for php8.1-fpm (8.1.3-1+ubuntu20.04.1+deb.sury.org+1) ...
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo vim /etc/nginx/sites-available/default
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ cat /etc/nginx/sites-available/default
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html/web-youtube-downloader/youtube-downloader/public;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$ sudo systemctl reload nginx.service
peterli@web-youtube-downloader:/var/www/html/web-youtube-downloader$
```

- After running these above commands, open the web browser and enter the `20.121.186.160` it will get the following picture:

![IP with web browser](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gasjs5vc8zli9sv04cm.png)

### Submission Category: 

The category is about Computing Captains and I use the [Azure Virtual Machines](https://azure.microsoft.com/en-us/services/virtual-machines/) to deploy my Web YouTube Downloader!


### Link to Code on GitHub

Here is the link about I develop and use in this post:

{% github peter279k/web-youtube-downloader %}


### Additional Resources / Info

- The completed running command histories are available on above section.
- Here is the useful [reference](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal) to let me know how to create the virtual machine in Azure Portal :).
- My completed picture for Azure VM description is as follows:

![Azure VM decription](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd8ylgqjns2da6qa49ty.png)