文章目錄
- 一、安裝 Ubuntu 22.04.3
- 1. 簡介
- 2. 下載地址
- 3. 系統安裝
- 4. 系統配置
- 二、安裝 Docker
- 1. 安裝 docker
- 2. 安裝 docker compose
- 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賬戶密碼
sudo passwd root
1)輸入登錄賬戶密碼
2)輸入root賬戶密碼
- 設置root遠程可訪問
sudo chmod 777 /etc/ssh/sshd_config
vim /etc/ssh/sshd_config
service sshd restart
sshd_config 修改內容
Port 22
PermitRootLogin yes
PasswordAuthentication yes
vim 操作:編輯按“Insert”鍵,退出保存按“Esc”鍵,然后輸入:wq
- 設置DNS
cp /etc/resolv.conf /etc/resolv.conf1
rm /etc/resolv.conf
mv /etc/resolv.conf1 /etc/resolv.conf
vim /etc/resolv.conf
resolv.conf 添加內容
nameserver 223.6.6.6
nameserver 8.8.8.8
- 升級軟件包
sudo apt-get update -y
sudo apt-get full-upgrade -y
更新完成有提示框:按“Tab”鍵,選中OK后,回車確認
- 系統漏洞修復
sudo apt-get -y install cloud-init --only-upgrade
- 修改時間
apt install ntpsec-ntpdate
ntpdate time1.aliyun.com
sudo timedatectl set-timezone 'Asia/Shanghai'
- 添加定時任務
vim /etc/crontab
crontab 添加內容
0 */12 * * * ntpdate time1.aliyun.com
- 網卡IP配置
sudo chmod 777 /etc/netplan/00-installer-config.yaml
vim /etc/netplan/00-installer-config.yaml
00-installer-config.yaml 添加內容
network:ethernets:eno1:dhcp4: falseaddresses:- 192.168.1.123/24routes:- to: defaultvia: 192.168.1.1nameservers:addresses: [61.139.2.69,8.8.8.8]version: 2
二、安裝 Docker
1. 安裝 docker
apt install docker.io
docker version
2. 安裝 docker compose
apt install docker-compose
docker-compose version
3. 配置 docker
- /etc/docker/daemon.json
{"registry-mirrors": ["https://registry.docker-cn.com"]
}
- 重啟
systemctl daemon-reload && systemctl restart docker