Ubuntu 设置系统时区
Mar 29, 2021
最简单直接的方法: timedatectl set-timezone Asia/Shanghai 传统方法: tzselect 按提示逐步操作: Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 2) Americas 3) Antarctica 4) Asia 5) Atlantic Ocean 6) Australia 7) Europe 8) Indian Ocean 9) Pacific Ocean 10) coord - I want to use geographical coordinates. 11) TZ - I want to specify the timezone using the Posix TZ format. #? 4 Please select a country whose clocks agree with yours. 1) Afghanistan 18) Israel 35) Palestine 2) Armenia 19) Japan 36) Philippines 3) Azerbaijan 20) Jordan 37) Qatar 4) Bahrain 21) Kazakhstan 38) Russia 5) Bangladesh 22) Korea (North) 39) Saudi Arabia 6) Bhutan 23) Korea (South) 40) Singapore 7) Brunei 24) Kuwait 41) Sri Lanka 8) Cambodia 25) Kyrgyzstan 42) Syria 9) China 26) Laos 43) Taiwan 10) Cyprus 27) Lebanon 44) Tajikistan 11) East Timor 28) Macau 45) Thailand 12) Georgia 29) Malaysia 46) Turkmenistan 13) Hong Kong 30) Mongolia 47) United Arab Emirates 14) India 31) Myanmar (Burma) 48) Uzbekistan 15) Indonesia 32) Nepal 49) Vietnam 16) Iran 33) Oman 50) Yemen 17) Iraq 34) Pakistan #? 9 Please select one of the following timezones. 1) Beijing Time 2) Xinjiang Time #? 1 The following information has been given: China Beijing Time Therefore TZ='Asia/Shanghai' will be used. Selected time is now: Mon Mar 29 12:53:57 CST 2021. Universal Time is now: Mon Mar 29 04:53:57 UTC 2021. Is the above information OK? 1) Yes 2) No #? 1 You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts: Asia/Shanghai 最后设置系统时区: …
备份和恢复 Docker 镜像
Mar 28, 2021
备份 Image docker save nginx | gzip > nginx.tar.gz 恢复 Image gunzip --stdout nginx.tar.gz | docker load 官方参考资料 https://docs.docker.com/engine/reference/commandline/load/ https://docs.docker.com/engine/reference/commandline/save/
macOS 上备份和还原树莓派系统
Mar 28, 2021
备份树莓派就是把 SD 卡数据备份,恢复就是还原数据到 SD 卡,类似于以前的 GHOST 备份。 使用 diskutil list 查找 SD 卡设备: ... /dev/disk5 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *32.0 GB disk5 1: Windows_FAT_32 system-boot 268.4 MB disk5s1 2: Linux 31.7 GB disk5s2 备份系统 sudo dd bs=4m if=/dev/disk5 | gzip > RaspiOS.img.gz 备份完成后,输出结果: …
Docker buildx 编译多架构镜像
Mar 27, 2021
编译多架构镜像类似于源码编译里面的跨平台交叉编译,在一台宿主机器上编译出多个不同架构的镜像, 在不同架构上使用的时候直接 docker pull 就可以拉取到与本机架构相符的镜像。 …
Docker 设置代理的方式
Mar 27, 2021
docker pull & push 执行 docker pull ... 和 docker push ... 命令时,是由守护进程 dockerd 执行任务,所以代理需要设置给 dockerd sudo mkdir -p /etc/systemd/system/docker.service.d sudo vim /etc/systemd/system/docker.service.d/proxy.conf proxy.conf 可以是任意名称,后缀不能改。 [Service] Environment="HTTP_PROXY=http://10.211.55.2:7890" Environment="HTTPS_PROXY=http://10.211.55.2:7890" Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp" 修改后需要重启服务: …
在树莓派上开启 WIFI 连接
Mar 25, 2021
先查看一下目前的网络设备接口: ls /sys/class/net eth0 lo wlan0 编辑 /etc/netplan/50-cloud-init.yaml,添加你的 WIFI 名称和密码: # This file is generated from information provided by the datasource. Changes # to it will not persist across an instance reboot. To disable cloud-init's # network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config: disabled} network: ethernets: eth0: dhcp4: true optional: true version: 2 wifis: wlan0: optional: true dhcp4: true dhcp6: true access-points: "YOUR-WIFI-NAME": password: "YOUR-WIFI-PASSWD" 保存后,依次执行以下命令: …
在 Ubuntu 上安装 Docker 的方法
Mar 24, 2021
Docker 的客户端和容器的运行时现在分开为不同的包里,要安装 Docker 需要同时安装这三个包: sudo apt-get install docker-ce docker-ce-cli containerd.io 卸载旧版本 docker、 docker.io 和 docker-engine 是旧版本的 Docker,如果之前安装过,则需要先卸载掉: …
Ubuntu 20.04 使用自定义的 DNS 设置
Mar 22, 2021
修改 /etc/systemd/resolved.conf, 写入自定义的 DNS 地址,多个地址使用空格分隔: [Resolve] DNS=1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001 创建软连接覆盖系统的 resolv.conf,让系统使用 systemd-resolved 生成的配置: ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf 重启 systemd-resolved 服务,使配置生效: …
Linux 开启 TCP BBR 拥塞控制算法
Mar 20, 2021
检查内核版本 Linux 内核 4.9 开始支持 TCP BBR,先查看一下当前内核是否支持: uname -r 当前使用的内核版本: 5.4.0-67-generic 检查可用的控制算法 sysctl net.ipv4.tcp_available_congestion_control 输出为: net.ipv4.tcp_available_congestion_control = reno cubic tcp_bbr 模块没有被加载进来,所以 bbr 不在可用列表中。 加载 tcp_bbr: …
创建和解压 tar.xz 文件
Mar 17, 2021
创建压缩文件 tar -Jcvf filename.tar.xz dir_or_file 解压文件 tar -Jxvf filename.tar.xz