Deepin15 升级PHP


方法一:直接使用add-apt-repository

在deepin15中,安装失败了,所以我使用了方法二

itaken@itaken-PC:~$ sudo add-apt-repository ppa:ondrej/php
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 93, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Deepin/camel

方法二:在/etc/apt/sources.list.d/中添加php.list源文件

itaken@itaken-PC:~$ sudo apt clean
itaken@itaken-PC:~$ cd /etc/apt/sources.list.d/
itaken@itaken-PC:/etc/apt/sources.list.d$ sudo touch php.list
itaken@itaken-PC:/etc/apt/sources.list.d$ ll
总用量 4.0K
-rw-r--r-- 1 root root   0 9月  18 14:28 php.list
itaken@itaken-PC:/etc/apt/sources.list.d$ sudo vim php.list 
# https://origin.sury.org/php/
deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ buster main

还需要添加key

itaken@itaken-PC:/etc/apt/sources.list.d$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E5267A6C
Executing: /tmp/apt-key-gpghome.QaLmY1FZG3/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E5267A6C
gpg: failed to start the dirmngr '/usr/bin/dirmngr': 没有那个文件或目录
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.QaLmY1FZG3/S.dirmngr' failed: 没有那个文件或目录
gpg: keyserver receive failed: No dirmngr

如果提示gpg: keyserver receive failed: No dirmngr,则需要直接安装dirmngr即可

itaken@itaken-PC:/etc/apt/sources.list.d$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
Executing: /tmp/apt-key-gpghome.leBv4KBzDQ/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
gpg: failed to start the dirmngr '/usr/bin/dirmngr': 没有那个文件或目录
gpg: connecting dirmngr at '/run/user/1000/gnupg/d.jf8hk9yw4nm6wt78tiwm6ryi/S.dirmngr' failed: 没有那个文件或目录
gpg: keyserver receive failed: No dirmngr
itaken@itaken-PC:/etc/apt/sources.list.d$ sudo apt-get install dirmngr
正在读取软件包列表... 1%
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
建议安装:
  dbus-user-session tor
下列【新】软件包将被安装:
  dirmngr
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 597 kB 的归档。
解压缩后会消耗 1,114 kB 的额外空间。
获取:1 http://packages.deepin.com/deepin camel/main amd64 dirmngr amd64 2.1.18-8~deb9u4 [597 kB]
已下载 597 kB,耗时 20秒 (29.1 kB/s) 
正在选中未选择的软件包 dirmngr。
(正在读取数据库 ... 系统当前共安装有 214864 个文件和目录。)
正准备解包 .../dirmngr_2.1.18-8~deb9u4_amd64.deb  ...
正在解包 dirmngr (2.1.18-8~deb9u4) ...
正在处理用于 man-db (2.7.6.1-2) 的触发器 ...
正在设置 dirmngr (2.1.18-8~deb9u4) ...
itaken@itaken-PC:/etc/apt/sources.list.d$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4F4EA0AAE5267A6C
Executing: /tmp/apt-key-gpghome.2MhNnQSrdh/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 4F4EA0AAE5267A6C
gpg: key 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg:               imported: 1

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录