安装 Ubuntu 22.04.3 和 docker

文章目录

  • [一、安装 Ubuntu 22.04.3](#一、安装 Ubuntu 22.04.3)
    • [1. 简介](#1. 简介)
    • [2. 下载地址](#2. 下载地址)
    • [3. 系统安装](#3. 系统安装)
    • [4. 系统配置](#4. 系统配置)
  • [二、安装 Docker](#二、安装 Docker)
    • [1. 安装 docker](#1. 安装 docker)
    • [2. 安装 docker compose](#2. 安装 docker compose)
    • [3. 配置 docker](#3. 配置 docker)

一、安装 Ubuntu 22.04.3

1. 简介

Ubuntu 22.04.3 是Linux操作系统的一个版本。LTS 版本支持周期到2032年。

系统要求双核 CPU、4GB 内存和至少 25 GB 存储空间。

Linux kernel:5.15。

2. 下载地址

官网
ubuntu-22.04.3-live-server-amd64

3. 系统安装

4. 系统配置

  • 设置root账户密码
bash 复制代码
sudo passwd root

1)输入登录账户密码
2)输入root账户密码

  • 设置root远程可访问
bash 复制代码
sudo chmod 777 /etc/ssh/sshd_config
vim /etc/ssh/sshd_config
service sshd restart

sshd_config 修改内容

bash 复制代码
Port 22
PermitRootLogin yes
PasswordAuthentication yes

vim 操作:编辑按"Insert"键,退出保存按"Esc"键,然后输入:wq

  • 设置DNS
bash 复制代码
cp /etc/resolv.conf  /etc/resolv.conf1 
rm /etc/resolv.conf 
mv /etc/resolv.conf1  /etc/resolv.conf
vim /etc/resolv.conf 

resolv.conf 添加内容

bash 复制代码
nameserver 223.6.6.6
nameserver 8.8.8.8
  • 升级软件包
bash 复制代码
sudo apt-get update -y
sudo apt-get full-upgrade -y

更新完成有提示框:按"Tab"键,选中OK后,回车确认

  • 系统漏洞修复
bash 复制代码
sudo apt-get -y install cloud-init --only-upgrade
  • 修改时间
bash 复制代码
apt install ntpsec-ntpdate
ntpdate time1.aliyun.com
sudo timedatectl set-timezone 'Asia/Shanghai'
  • 添加定时任务
bash 复制代码
vim /etc/crontab

crontab 添加内容

bash 复制代码
0 */12 * * *    ntpdate time1.aliyun.com
  • 网卡IP配置
bash 复制代码
sudo chmod 777 /etc/netplan/00-installer-config.yaml
vim /etc/netplan/00-installer-config.yaml

00-installer-config.yaml 添加内容

bash 复制代码
network:
 ethernets:
   eno1:
     dhcp4: false
     addresses:
       - 192.168.1.123/24
     routes:
       - to: default
         via: 192.168.1.1
     nameservers:
       addresses: [61.139.2.69,8.8.8.8]
 version: 2

二、安装 Docker

1. 安装 docker

bash 复制代码
apt install docker.io
docker version

2. 安装 docker compose

bash 复制代码
apt install docker-compose
docker-compose version

3. 配置 docker

  • /etc/docker/daemon.json
bash 复制代码
{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}
  • 重启
bash 复制代码
systemctl daemon-reload && systemctl restart docker
相关推荐
HIT_Weston7 小时前
61、【Ubuntu】【Gitlab】拉出内网 Web 服务:Gitlab 配置审视(五)
前端·ubuntu·gitlab
dbitc7 小时前
WIN11把WSL2移动安装目录
linux·运维·ubuntu·wsl
weixin_462446238 小时前
Kali/ubuntu Linux 中彻底删除 Cursor 编辑器(含 dpkg 非空目录警告解决)
linux·ubuntu·cursor
liuwei2000009 小时前
Ubuntu 22.04 安装 ROS 2 Humble
linux·运维·ubuntu
郁大锤10 小时前
解决Ubuntu/Linux/Gnome 打开文件慢,使用chrome打开文件更慢/卡死问题
linux·ubuntu·卡顿
HIT_Weston14 小时前
60、【Ubuntu】【Gitlab】拉出内网 Web 服务:Gitlab 配置审视(四)
前端·ubuntu·gitlab
starvapour1 天前
Ubuntu硬盘的创建分区、格式化与挂载
linux·ubuntu
Better Bench1 天前
ThinkStation PGX Ubuntu aarch64架构上使用Docker 配置amd64架构镜像的深度学习环境并使用Vscode开发
ubuntu·docker·架构
weixin_449290011 天前
Ubuntu 系统上安装和配置 Go 语言运行环境
linux·ubuntu·golang
james bid2 天前
MacBook Pro 2015 上 XUbuntu 24.04 启用 eGPU (GeForce GTX 1080 Ti) 和核显黑屏问题解决
linux·ubuntu·macos·cuda·egpu