首页 > 系统相关 >安装完成Ubuntu20.04之后设置时区

安装完成Ubuntu20.04之后设置时区

时间:2022-11-01 17:25:17浏览次数:76  
标签:Ubuntu20.04 dists 安装 Failed 设置 ubuntu com archive InRelease

系统版本

lsb_release -a

root@master:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

查看时间

date -R

时间不正确, 需要设置时区与同步时间

安装ntpdate 工具

安装失败,找不到 ntpdate 安装包


原因: 最新安装的Ubuntu版本,可能出现源设置不正确或者无法访问的情况。 清除历史数据, 更新源

更新源文件 /etc/apt/sources.list

如果是因为修改了官方默认源.恢复默认源. 或者 采用 清华、阿里等的镜像源
修改 /etc/apt/sources.list 之后, 执行

apt-get update

强制更新源索引出错Some index files failed to download. They have been ignored, or old ones used instead.

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/wireshark-dev/stable/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

访问 ping archive.ubuntu.com 确认是否可以访问, 若是不能访问则是网络问题。 重新设置一下网络

设置网络

首先

sudo vim /etc/systemd/resolved.conf
修改DNS如下:

复制代码
[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
复制代码
修改下如下配置文件

vim /etc/resolv.conf 
添加如下内容:

nameserver 8.8.8.8
 

然后重启:

reboot
重启完成后更新一下源就行:

sudo apt-get update

参考链接: [解决Some index files failed to download.They have been ignored, or old ones used instead报错](https://www.cnblogs.com/HGNET/p/15881892.html)

设置时区

方法一:选择时区
1.执行命令:
dpkg-reconfigure tzdata
2.选择Asia->Shanghai

防止系统重启后时区改变,执行下面一行命令
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
方法二:网上同步时间

安装ntpdate工具
sudo apt-get install ntpdate

使用工具通过互联网同步时间:
sudo ntpdate time.windows.com

设置ubuntu使用当地时间:
sudo hwclock --localtime --systohc

参考链接:
Ubuntu 常见问题汇总【持续更新】
安裝完成Ubuntu20.04之後要做的事

标签:Ubuntu20.04,dists,安装,Failed,设置,ubuntu,com,archive,InRelease
From: https://www.cnblogs.com/panie2015/p/16848430.html

相关文章

  • ubuntu20.04 更换清华源报错
    GVfsmetadataisnotsupported.FallbacktoTeplMetadataManager.EitherGVfsisnotcorrectlyinstalledorGVfsmetadataarenotsupportedonthisplatform.In......
  • 安装Dlib出错解决方案
    dlibsubprocess.CalledProcessError:Command'[‘cmake’,‘–build’,‘.’,‘–config’解决方案:pythonsetup.pyinstall--noDLIB_GIF_SUPPORT......
  • linux 安装配置mongodb
    注意博文中,有log文件,或者文件夹命令错误https://www.cnblogs.com/mnote/p/8979299.htmlhttps://www.jianshu.com/p/348615ebb7b6https://developer.aliyun.com/article......
  • 若依-登录白名单设置
    前言由于开发的页面需要以外链接的形式嵌入到其他的web网站,因此,需要将开发的页面设置为登录白名单,免去登录的步骤。  前端修改 添加路由白名单,让页面不跳转到登......
  • IDEA下载与安装,保姆级教程
    (这里写自定义目录标题)1.搜索idea2.选择官方网站以前idea的官网后面有官网俩字,现在没有了,你可以看他的具体网址,因为idea是==Jetbrains==公司的产品,找到这个域名的指定......
  • 常用设置时间格式
    fromatTime(val){ constdata=newDate(val) constYear=date.getFullYear() letMonth=date.getMonth()+1 Month=Month<10?'0'+Month:Month letDa......
  • 关于代理的设置
    环境变量设置代理全局设置代理就使用环境变量配置(这里只针对Linux或者Mac)vim/etc/profile--------------------------------------------http_proxy=IP:PORThttps_pr......
  • 三 docker安装rabbitMQ之springboot集成stomp,实现前端主动刷新
    一 场景分析对于一些需要数据同步的场景中,例如后台数据有变化,需要程序主动刷新前端界面的数据显示,这样能提供更好的用户数据交互,能第一时间了解到资源信息的变化,而不是......
  • CentOS7设置时间自动同步
    设置开机自动同步Internet时间,并作定时同步任务1、修改时区rm-rf/etc/localtimeln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtimevim/etc/sysconfig/clock......
  • vs2013配置python 安装第三方工具包
    这里以matplotlib安装为例。选择pip搜索camelcase进行安装。   ......