软体
Ubuntu 系统常用软体安装相关指令及常用软体
add-apt-repository 指令找不到
sudo: add-apt-repository: command not found
在出现上述指令找不到时,可以安装下列套件,就可以找到这个指令了
sudo apt-get install software-properties-common
GPG error: https://dl.yarnpkg.com/debian stable InRelease NO_PUBKEY E074D16EB6FF4DE3
在执行 sudo apt-get update
时,出现 NO_PUBKEY
的错误讯息
$ 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.
执行更新 key 即可修復这个问题
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
列出所有已安装套件
sudo apt list --installed
sudo apt list --installed | less
强制安装套件,略过 cli 询问是否安装
在安装套件时,常常会遇到 cli 需要询问是否继续安装,像是:
$ 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]
如果要跳过询问的话,可以在参数加入 -y
,这样就可以跳过被询问的步骤直接安装
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.
参考资料
- GPG error: https://dl.yarnpkg.com/debian stable InRelease NO_PUBKEY E074D16EB6FF4DE3 · Issue #4453 · yarnpkg/yarn · GitHub
- How to List Installed Packages on Ubuntu | Linuxize