Ubuntuがアプリケーションをインストールする時にUnable to locate packageが現れます...

2278 ワード

私はvps(海外サーバー)にphp 7をインストールしたときにこの問題に遭遇し、常にヒントを与えました.
Couldn't find any package by regex 'php7.0'
Unable to locate package php7.0
長い間探していましたが、ネット上の多くの解決策は:
$sudo add-apt-repository ppa:ondrej/php$sudo apt-get updateのインストール後$sudo apt-get install-y php 7を実行する.0 php7.0-mysql php7.0-curl php7.0-json php7.0-cgiですが、コードを実行した後も、次のプロンプトが表示されます.
Couldn't find any package by regex 'php7.0'
Unable to locate package php7.0
 
最後に解決策を見つけて、aptソースが間違っていると言って、アリ雲のソースに変えました.
cp/etc/apt/sources.list/etc/apt/sources.list.bak vi/etc/apt/sources.list sources.リストの内容は次のとおりです.
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

保存後に更新コマンドを実行し、aptソースを更新します.
sudo apt-get update
aptソースを更新した後、サードパーティのソースサポートを追加し、aptソースを再更新します.
add-apt-repository ppa:ondrej/php
sudo apt-get update
最後にphpのインストールを実行します.
sudo apt-get install -y php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-cgi