无法在Ubuntu上安装PHP 8.0,E:仓库'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release'没有Release文件。

5

我正在尝试在Vultr的Ubuntu 22.04服务器上安装LEMP。 我可以使用命令sudo apt install -y nginx安装Nginx,没有问题。

但是当我尝试运行以下命令安装php8.0时:

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

我一直遇到错误 The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release' does not have a Release file.

运行sudo add-apt-repository ppa:ondrej/php命令后,这是我得到的结果。

root@ubuntu:~# sudo add-apt-repository ppa:ondrej/php
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main'
Description:
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Found existing deb entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding deb entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Found existing deb-src entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding key to /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg with fingerprint 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C
Get:1 http://us.clouds.archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 https://ppa.launchpadcontent.net/canonical-kernel-team/unstable/ubuntu jammy InRelease
Hit:4 http://us.clouds.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://us.clouds.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:6 http://us.clouds.archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,408 kB]
Ign:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Get:8 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [14.1 MB]
Err:9 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release
  404  Not Found [IP: 91.189.95.85 443]
Get:10 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe Translation-en [5,645 kB]
Get:11 http://us.clouds.archive.ubuntu.com/ubuntu jammy/universe amd64 c-n-f Metadata [286 kB]
Reading package lists... Done
E: The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

你有什么想法/建议,为什么会发生这种情况?我该如何做才能不同于以前?


1
我想你的问题可能是由于22.04尚未发布所致。如果你在这里看一下,你会发现没有jammy子目录。 - Alex Howansky
嗯... @AlexHowansky,我想知道为什么Vultr(以及更多的网站)上有关于如何在Ubuntu 2204上安装PHP8+的教程。https://www.vultr.com/es/docs/installing-configuring-and-securing-php-8-1-on-ubuntu-20-04 - Guntar
Alex Howansky,您对如何在22.04上安装php8.0有什么建议? - Guntar
等到22.04实际发布后再使用。或者使用22.10版本。或者从源代码编译。或者使用8.1版本。 - Alex Howansky
@AlexHowansky 我的Ubuntu服务器版本是22.0.4.1 LTS,我也仍然遇到这个问题? - Hesam Moosapour
显示剩余2条评论
1个回答

8

这个问题是由于ppa:ondrej/php存储库中22.10版本的结果尚未发布所导致的。通过ppa:ondrej/php即可解决此问题,但我已经找到了一个解决方案,虽然我不认为它是最佳方案。

nano /etc/apt/sources.list.d/ondrej-ubuntu-php-kinetic.list

然后添加这一行并保存。
deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main
#deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu/kinetic main

请尝试重新安装它。 PHP 7.2
sudo apt-get install php7.2 php7.2-fpm
sudo apt-get install php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl

PHP 8.0

sudo apt-get install php8.0 php8.0-fpm
sudo apt-get install php8.0-mysql php8.0-mbstring php8.0-xml php8.0-gd php8.0-curl

针对这个问题,我已经帮助了这些链接_01 链接_02

现在PHP已经成功安装,因此您可以轻松地切换PHP版本。

 sudo update-alternatives --config php

选择要输入数字的版本,现在检查PHP版本

php -v

感谢@Chinthaka。完美地工作了。刚刚在Ubuntu 22.04上安装了PHP 8.2.4。 - dougB
但如果您正在使用Ubuntu 22.04,这不是问题,您只需要安装php sudo add-apt-repository ppa:ondrej/php && sudo apt update,然后安装php(您想要的版本)。 - Chinthaka Sandaruwan
在添加存储库行后,您需要运行sudo apt update来安装软件包。 - Turbo19973

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接