Software

Ubuntu Software

add-apt-repository command not found

sudo: add-apt-repository: command not found

If you see the message above, you can install software-properties-common package to find this command

sudo apt-get install software-properties-common

GPG error: https://dl.yarnpkg.com/debian stable InRelease NO_PUBKEY E074D16EB6FF4DE3

There is NO_PUBKEY message when run the sudo apt-get update command

$ sudo apt-get update
Hit:1 https://deb.nodesource.com/node_8.x xenial InRelease
Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:5 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Err:2 https://dl.yarnpkg.com/debian stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
Get:6 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [957 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:8 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Hit:9 http://ppa.launchpad.net/chris-lea/redis-server/ubuntu xenial InRelease
Hit:10 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Fetched 1282 kB in 1s (744 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
W: Some index files failed to download. They have been ignored, or old ones used instead.

You can update your key to fix this issue.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Show all the packages that we have already installed

sudo apt list --installed
sudo apt list --installed | less

Force to install package and skip the cli question

When you install some package. The cli sometime will ask you Do you want to continue? to make sure you really want to install this package.

$ sudo apt-get install php7.2-xml
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libzip4 php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-dev php7.2-fpm php7.2-gd php7.2-gmp php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pgsql php7.2-readline php7.2-soap php7.2-sqlite3 php7.2-zip
Suggested packages:
  dh-php
The following packages will be upgraded:
  libzip4 php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-dev php7.2-fpm php7.2-gd php7.2-gmp php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-pgsql php7.2-readline php7.2-soap php7.2-sqlite3 php7.2-xml
  php7.2-zip
22 upgraded, 0 newly installed, 0 to remove and 405 not upgraded.
Need to get 5,739 kB of archives.
After this operation, 64.5 kB of additional disk space will be used.
Do you want to continue? [Y/n]

If you want to skip all the question that system ask. You can add -y parameter in your command. Then you can skip all the question and install directly.

sudo apt-get install -y php7.2-xml

-y, –yes, –assume-yes

Automatic yes to prompts; assume “yes” as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

Reference