0
点赞
收藏
分享

微信扫一扫

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

系统版本

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


设置时区

方法一:选择时区
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之後要做的事


作者:​​panie​​



举报

相关推荐

ubuntu20.04安装Pycharm

ubuntu20.04安装docker

ubuntu20.04安装QGIS

ubuntu20.04安装lightgbm

【ubuntu20.04安装redis】

Ubuntu20.04安装Django

0 条评论