构建ubuntu base 出现apt update错误

apt-get update 错误
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
  Couldn't create temporary file /tmp/apt.conf.Kzzptk for passing config to apt-key
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Err:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
  Couldn't create temporary file /tmp/apt.conf.0UK24m for passing config to apt-key
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [83.3 kB]
Err:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
  Couldn't create temporary file /tmp/apt.conf.6Yqv5I for passing config to apt-key
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
Err:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
  Couldn't create temporary file /tmp/apt.conf.iGeQGJ for passing config to apt-key
Reading package lists... Done
W: GPG error: http://ports.ubuntu.com/ubuntu-ports bionic InRelease: Couldn't create temporary file /tmp/apt.conf.Kzzptk for passing config to apt-key
E: The repository 'http://ports.ubuntu.com/ubuntu-ports bionic InRelease' is not signed.
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.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease: Couldn't create temporary file /tmp/apt.conf.0UK24m for passing config to apt-key
E: The repository 'http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease' is not signed.
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.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease: Couldn't create temporary file /tmp/apt.conf.6Yqv5I for passing config to apt-key
E: The repository 'http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease' is not signed.
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.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease: Couldn't create temporary file /tmp/apt.conf.iGeQGJ for passing config to apt-key
E: The repository 'http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease' is not signed.
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.

解决办法:

chmod 1777 /tmp
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
要在Ubuntu上制作apt本地源,请按照以下步骤进行操作: 1.安装apt-mirror工具 ```bash sudo apt-get update sudo apt-get install apt-mirror ``` 2.创建一个目录来存储本地源文件 ```bash sudo mkdir /var/spool/apt-mirror ``` 3.编辑apt-mirror的配置文件 ```bash sudo nano /etc/apt/mirror.list ``` 在文件中添加以下内容: ```bash ############# config ################## # # set base_path /var/spool/apt-mirror # # set mirror_path $base_path/mirror # set skel_path $base_path/skel # set var_path $base_path/var # set cleanscript $var_path/clean.sh # set defaultarch <running host architecture> # set postmirror_script $var_path/postmirror.sh # set run_postmirror 0 set nthreads 20 set _tilde 0 # ############# end config ############## deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse deb-src http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse # Clean up clean http://archive.ubuntu.com/ubuntu clean http://security.ubuntu.com/ubuntu ``` 在这个文件中,你可以指定你要下载的Ubuntu版本和你的Ubuntu源的URL。 4.运行apt-mirror工具 ```bash sudo apt-mirror ``` 该命令将下载所有指定的软件包和依赖项,并将它们存储在/var/spool/apt-mirror目录下。 5.设置本地源 ```bash sudo nano /etc/apt/sources.list ``` 在文件中添加以下行: ```bash deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse deb-src file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb-src file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse deb-src file:/var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse deb file:/var/spool/apt-mirror/mirror/security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb-src file:/var/spool/apt-mirror/mirror/security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse ``` 6.更新本地源 ```bash sudo apt-get update ``` 现在你已经成功地在Ubuntu上制作了apt本地源。你可以在不需要连接到互联网的情况下使用这些本地源来安装软件包和更新系统。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值