[Basic environment] Ubuntu basic configuration and Docker installation and usage records

PS: This article mainly records the installation software and usage process, and only briefly records the system installation.

For detailed records, please refer to:
https://blog.csdn.net/m0_46983541/article/details/126936850

Mirror download

Alibaba Cloud mirror station image download:
https://mirrors.aliyun.com/ubuntu-releases/20.04/You
can download it according to your needs:
image.png

Record of key installation steps

Typical installation method selection:
image.png

Operating system selection:

image.png

Basic configuration selection:
I usually choose a single file. As for the multiple files mentioned to facilitate moving the virtual machine, I have not actually tested it.
image.png

The difference between storing single-dimensional files and multiple files is that there are more files in the directory when storing, such as the following picture:
image.png

Virtual machine editor:
tips: Here you can choose the image you do not want to install, adjust the disk hard disk size, etc.
image.png

language selection:
image.png

Installation selection, update installation can be installed after changing the source as needed. Minimize the installation first.
image.png

Install now:
image.png

Just click the left mouse button on the time zone and select Shanghai.
image.png

Configure account and password information:
image.png
Software installation:
Tips: If the network is slow, you can skip subsequent installation
image.png
. Restart after completion:
image.png
Tips after restart:
image.png
Solution:
Cancel the connection and return to the Ubuntu startup page and press Enter.
image.png
Basic installation is completed:
image.png

It is recommended to take a snapshot first to facilitate system restoration if any problems occur during subsequent installations.

Change mirror source

basic commands

sudo  cp   /etc/apt/sources.list   /etc/apt/sources.list.bak ### 备份sources.list
sudo gedit  /etc/apt/sources.list  ##编辑源文件

## 镜像源信息ubuntu20版本
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

##更新软件包列表
sudo apt update 
## 更新软件
sudo apt-get upgrade  

Docker installation

##更新软件包列表
sudo apt update 

## 更新软件
sudo apt-get upgrade

安装Docker依赖
sudo apt install apt-transport-https ca-certificates curl software-properties-common 

添加Docker官方GPG密钥用于软件包验证。
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

添加Docker存储库
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

安装Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

启动Docker服务
sudo systemctl start docker

添加自动启动Docker服务
sudo systemctl enable docker

打印Docker版本查看是否安装成功
docker --version

安装docker-compose
sudo apt install docker-compose

添加加速镜像
sudo mkdir -p /etc/docker

下面从“sudo”到“EOF”一起复制粘贴到命令行使用
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://gnm7t52a.mirror.aliyuncs.com"]
}
EOF

sudo systemctl daemon-reload(win10以上系统使用wls可以忽略这个命令)
sudo systemctl restart docker(win10以上系统使用service docker restart替代)

Troubleshooting

1. The installation page is too small to see and click Next.
You can use the Tab key on the keyboard to switch selections. Just press Enter to switch to this option.
2. Some index files failed to download. If you ignore them, the old index file will be used instead.
Check whether the network connection is successful
image.png
or run the following command and update

sudo sed -i 's/cn.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list 

Guess you like

Origin blog.csdn.net/weixin_54430466/article/details/132318086