一抬菊花

V1

2023/05/09阅读:20主题:默认主题

Linux笔记Day02

一、需要能做到的基础操作

1.下载镜像:centos7.5 centos7.6 centos7.9

https://developer.aliyun.com/mirror/

2.自己尝试安装

3.docker wget

4.安装系统时候修改网络

OpenEuler linux 5.10的内核版本 支持ARM 支持X86

  1. ISO发布包
  2. 虚拟机镜像
  3. 容器镜像
  4. 嵌入式镜像
  5. repo源
  6. OpenEuler镜像下载地址 https://repo.openeuler.org/
  7. 查看系统版本
[root@vm002-165 ~]# cat /etc/system-release
openEuler release 22.03 (LTS-SP1)
  1. 查看内核版本
[root@vm002-165 ~]# cat /proc/version 
Linux version 5.10.0-136.12.0.86.oe2203sp1.x86_64 (root@dc-64g.compass-ci) (gcc_old (GCC) 10.3.1, GNU ld (GNU Binutils) 2.37) #1 SMP Tue Dec 27 17:50:15 CST 2022
  1. 查看设备状态信息脚本
[root@vm002-165 ~]# cat /etc/profile.d/system-info.sh
#/bin/bash
#Copyright (c) [2019] Huawei Technologies Co., Ltd.
#generic-release is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
#     http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.

# Welcome
welcome=$(uname -r)

# Memory
memory_total=$(cat /proc/meminfo | awk '/^MemTotal:/ {printf($2)}')
memory_free=$(cat /proc/meminfo | awk '/^MemFree:/ { printf($2)}')
buffers=$(cat /proc/meminfo | awk '/^Buffers:/ { printf($2)}')
cached=$(cat /proc/meminfo | awk '/^Cached:/ { printf($2)}')
sreclaimable=$(cat /proc/meminfo | awk '/^SReclaimable:/ { printf($2)}')
swap_total=$(cat /proc/meminfo | awk '/^SwapTotal:/ { printf($2)}')
swap_free=$(cat /proc/meminfo | awk '/^SwapFree:/ { printf($2)}')


if [ $memory_total -gt 0 ]
then
    memory_usage=`echo "scale=1; ($memory_total - $memory_free - $buffers - $cached - $sreclaimable) * 100.0 / $memory_total" |bc`
    memory_usage="${memory_usage}%"
else
    memory_usage=0.0%
fi

# Swap memory
if [ $swap_total -gt 0 ]
then
    swap_mem=`echo "scale=1; ($swap_total - $swap_free) * 100.0 / $swap_total" |bc`
    swap_mem="${swap_mem}%"
else
    swap_mem=0.0%
fi

# Usage
usageof=$(df -h / | awk '/\// {print $(NF-1)}')

# System load
load_average=$(awk '{print $1}' /proc/loadavg)

# WHO I AM
whoiam=$(whoami)

# Time
time_cur=$(date)

# Processes
processes=$(ps aux | wc -l)

# Users
user_num=$(users | wc -w)

# Ip address
ip_pre=""
if [ -x "/sbin/ip" ]
then
    ip_pre=$(/sbin/ip a | grep inet | grep -v "127.0.0.1" | grep -v inet6 | awk '{print $2}')
fi

echo -e "\n"
echo -e "Welcome to $welcome\n"
echo -e "System information as of time: \t$time_cur\n"
echo -e "System load: \t\033[0;33;40m$load_average\033[0m"
echo -e "Processes: \t$processes"
echo -e "Memory used: \t$memory_usage"
echo -e "Swap used: \t$swap_mem"
echo -e "Usage On: \t$usageof"
for line in $ip_pre
do
    ip_address=${line%/*}
    echo -e "IP address: \t$ip_address"
done
echo -e "Users online: \t$user_num"
if [ "$whoiam" == "root" ]
then
    echo -e "\n"
else
    echo -e "To run a command as administrator(user \"root\"),use \"sudo <command>\"."
fi

[root@vm002-165 ~]
  1. 运行.sh脚本
[root@vm002-165 ~]# sh /etc/profile.d/system-info.sh


Welcome to 5.10.0-136.12.0.86.oe2203sp1.x86_64

System information as of time:  2023年 05月 07日 星期日 20:38:13 CST

System load:  0.00
Processes:  142
Memory used:  6.7%
Swap used:  0%
Usage On:  6%
IP address:  192.168.31.165
Users online:  1


[root@vm002-165 ~]# . /etc/profile.d/system-info.sh


Welcome to 5.10.0-136.12.0.86.oe2203sp1.x86_64

System information as of time:  2023年 05月 07日 星期日 20:38:23 CST

System load:  0.00
Processes:  141
Memory used:  6.7%
Swap used:  0%
Usage On:  6%
IP address:  192.168.31.165
Users online:  1
  1. 查看cpu信息 [root@vm002-165 ~]# lscpu
  2. 查看内存信息 [root@vm002-165 ~]# lsmem

二、常用命令

查看cpu

lscpu

查看内存

lsmem

查看硬件磁盘

lsblk

查看空闲空余信息

free -m

cat命令

[root@vm002-165 ~]# cat /etc/os-release 
NAME="openEuler"
VERSION="22.03 (LTS-SP1)"  
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 (LTS-SP1)"
ANSI_COLOR="0;31"

查看IP地址

[root@vm002-164 ~]# ifconfig
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.31.164  netmask 255.255.255.0  broadcast 192.168.31.255
        inet6 fe80::41e9:8293:b5f3:62ac  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:93:80:f4  txqueuelen 1000  (Ethernet)
        RX packets 8325  bytes 1150759 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 704  bytes 70954 (69.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 32  bytes 2592 (2.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2592 (2.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:6f:26:ec  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@vm002-164 ~]# ip addr list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:93:80:f4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.164/24 brd 192.168.31.255 scope global noprefixroute ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::41e9:8293:b5f3:62ac/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:6f:26:ec brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:6f:26:ec brd ff:ff:ff:ff:ff:ff
[root@vm002-164 ~]# hostname -I
192.168.31.164 

更新软件包

dnf update功能等同于yum update

dnf install ukui -y

systemctl set-default graphical.target 重启reboot

三、安装docker

在线安装

wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

cd /etc/yum.repos.d/

ls

yum install docker-ce -y

cd /var/run/

ls

rm -rf yum.pid

cd

yum install docker-ce -y

cat /etc/redhat-release

systemctl restart docker

docker version

history

离线安装

yum search ifconfig

https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

docker-ce 
container.io
docker-ce0cli
container-selinux
[root@vm002-164 /]#  yum localinstall ./*.rpm 
已加载插件:fastestmirror
正在检查 ./containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
./containerd.io-1.6.21-3.1.el7.x86_64.rpm:不更新已安装的软件包。
正在检查 ./container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
./container-selinux-2.107-3.el7.noarch.rpm:不更新已安装的软件包。
正在检查 ./docker-ce-23.0.6-1.el7.x86_64.rpm: 3:docker-ce-23.0.6-1.el7.x86_64
./docker-ce-23.0.6-1.el7.x86_64.rpm 将作为 3:docker-ce-23.0.5-1.el7.x86_64 的更新
正在检查 ./docker-ce-cli-23.0.6-1.el7.x86_64.rpm: 1:docker-ce-cli-23.0.6-1.el7.x86_64
./docker-ce-cli-23.0.6-1.el7.x86_64.rpm 将作为 1:docker-ce-cli-23.0.5-1.el7.x86_64 的更新
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.3.23.0.5-1.el7 将被 升级
---> 软件包 docker-ce.x86_64.3.23.0.6-1.el7 将被 更新
---> 软件包 docker-ce-cli.x86_64.1.23.0.5-1.el7 将被 升级
---> 软件包 docker-ce-cli.x86_64.1.23.0.6-1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================
 Package                      架构                  版本                            源                                                 大小
============================================================================================================================================
正在更新:
 docker-ce                    x86_64                3:23.0.6-1.el7                  /docker-ce-23.0.6-1.el7.x86_64                     94 M
 docker-ce-cli                x86_64                1:23.0.6-1.el7                  /docker-ce-cli-23.0.6-1.el7.x86_64                 35 M

事务概要
============================================================================================================================================
升级  2 软件包

总计:129 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 1:docker-ce-cli-23.0.6-1.el7.x86_64                                                                                     1/4 
  正在更新    : 3:docker-ce-23.0.6-1.el7.x86_64                                                                                         2/4 
  清理        : 3:docker-ce-23.0.5-1.el7.x86_64                                                                                         3/4 
  清理        : 1:docker-ce-cli-23.0.5-1.el7.x86_64                                                                                     4/4 
  验证中      : 1:docker-ce-cli-23.0.6-1.el7.x86_64                                                                                     1/4 
  验证中      : 3:docker-ce-23.0.6-1.el7.x86_64                                                                                         2/4 
  验证中      : 3:docker-ce-23.0.5-1.el7.x86_64                                                                                         3/4 
  验证中      : 1:docker-ce-cli-23.0.5-1.el7.x86_64                                                                                     4/4 

更新完毕:
  docker-ce.x86_64 3:23.0.6-1.el7                                    docker-ce-cli.x86_64 1:23.0.6-1.el7                                   

完毕!
[root@vm002-164 /]#  yum localinstall ./*.rpm -y
已加载插件:fastestmirror
正在检查 ./containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
./containerd.io-1.6.21-3.1.el7.x86_64.rpm:不更新已安装的软件包。
正在检查 ./container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
./container-selinux-2.107-3.el7.noarch.rpm:不更新已安装的软件包。
正在检查 ./docker-ce-23.0.6-1.el7.x86_64.rpm: 3:docker-ce-23.0.6-1.el7.x86_64
./docker-ce-23.0.6-1.el7.x86_64.rpm:不更新已安装的软件包。
[root@vmooo1 ~]# yum localinstall ./*.rpm -y
已加载插件:fastestmirror
正在检查 ./containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
./containerd.io-1.6.21-3.1.el7.x86_64.rpm 将被安装
正在检查 ./container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
./container-selinux-2.107-3.el7.noarch.rpm 将被安装
正在检查 ./docker-ce-23.0.6-1.el7.x86_64.rpm: 3:docker-ce-23.0.6-1.el7.x86_64
./docker-ce-23.0.6-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-ce-cli-23.0.6-1.el7.x86_64.rpm: 1:docker-ce-cli-23.0.6-1.el7.x86_64
./docker-ce-cli-23.0.6-1.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.107-3.el7 将被 安装
---> 软件包 containerd.io.x86_64.0.1.6.21-3.1.el7 将被 安装
---> 软件包 docker-ce.x86_64.3.23.0.6-1.el7 将被 安装
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-23.0.6-1.el7.x86_64 需要
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
base                                                                                                                 | 3.6 kB  00:00:00     
extras                                                                                                               | 2.9 kB  00:00:00     
updates                                                                                                              | 2.9 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                          |  21 MB  00:00:20     
---> 软件包 docker-ce-cli.x86_64.1.23.0.6-1.el7 将被 安装
--> 正在处理依赖关系 docker-buildx-plugin,它被软件包 1:docker-ce-cli-23.0.6-1.el7.x86_64 需要
--> 正在处理依赖关系 docker-compose-plugin,它被软件包 1:docker-ce-cli-23.0.6-1.el7.x86_64 需要
--> 解决依赖关系完成
错误:软件包:1:docker-ce-cli-23.0.6-1.el7.x86_64 (/docker-ce-cli-23.0.6-1.el7.x86_64)
          需要:docker-buildx-plugin
错误:软件包:3:docker-ce-23.0.6-1.el7.x86_64 (/docker-ce-23.0.6-1.el7.x86_64)
          需要:docker-ce-rootless-extras
错误:软件包:1:docker-ce-cli-23.0.6-1.el7.x86_64 (/docker-ce-cli-23.0.6-1.el7.x86_64)
          需要:docker-compose-plugin
 您可以尝试添加 --skip-broken 选项来解决该问题
 您可以尝试执行:rpm -Va --nofiles --nodigest
[root@vmooo1 ~]# yum update -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 bpftool.x86_64.0.3.10.0-1160.88.1.el7 将被 升级
---> 软件包 bpftool.x86_64.0.3.10.0-1160.90.1.el7 将被 更新
---> 软件包 kernel.x86_64.0.3.10.0-1160.90.1.el7 将被 安装
---> 软件包 kernel-tools.x86_64.0.3.10.0-1160.88.1.el7 将被 升级
---> 软件包 kernel-tools.x86_64.0.3.10.0-1160.90.1.el7 将被 更新
---> 软件包 kernel-tools-libs.x86_64.0.3.10.0-1160.88.1.el7 将被 升级
---> 软件包 kernel-tools-libs.x86_64.0.3.10.0-1160.90.1.el7 将被 更新
---> 软件包 libwebp.x86_64.0.0.3.0-10.el7_9 将被 升级
---> 软件包 libwebp.x86_64.0.0.3.0-11.el7 将被 更新
---> 软件包 python-perf.x86_64.0.3.10.0-1160.88.1.el7 将被 升级
---> 软件包 python-perf.x86_64.0.3.10.0-1160.90.1.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================
 Package                              架构                      版本                                       源                          大小
============================================================================================================================================
正在安装:
 kernel                               x86_64                    3.10.0-1160.90.1.el7                       updates                     52 M
正在更新:
 bpftool                              x86_64                    3.10.0-1160.90.1.el7                       updates                    8.5 M
 kernel-tools                         x86_64                    3.10.0-1160.90.1.el7                       updates                    8.2 M
 kernel-tools-libs                    x86_64                    3.10.0-1160.90.1.el7                       updates                    8.1 M
 libwebp                              x86_64                    0.3.0-11.el7                               updates                    170 k
 python-perf                          x86_64                    3.10.0-1160.90.1.el7                       updates                    8.2 M

事务概要
============================================================================================================================================
安装  1 软件包
升级  5 软件包

总下载量:85 M
Downloading packages:
No Presto metadata available for updates
警告:/var/cache/yum/x86_64/7/updates/packages/bpftool-3.10.0-1160.90.1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEYA 
bpftool-3.10.0-1160.90.1.el7.x86_64.rpm 的公钥尚未安装
(1/6): bpftool-3.10.0-1160.90.1.el7.x86_64.rpm                                                                       | 8.5 MB  00:00:07     
(2/6): kernel-tools-3.10.0-1160.90.1.el7.x86_64.rpm                                                                  | 8.2 MB  00:00:07     
(3/6): kernel-tools-libs-3.10.0-1160.90.1.el7.x86_64.rpm                                                             | 8.1 MB  00:00:07     
(4/6): libwebp-0.3.0-11.el7.x86_64.rpm                                                                               | 170 kB  00:00:00     
(5/6): python-perf-3.10.0-1160.90.1.el7.x86_64.rpm                                                                   | 8.2 MB  00:00:07     
(6/6): kernel-3.10.0-1160.90.1.el7.x86_64.rpm                                                                        |  52 MB  00:00:49     
--------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                        1.7 MB/s |  85 MB  00:00:49     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-9.2009.1.el7.centos.x86_64 (@updates)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : kernel-tools-libs-3.10.0-1160.90.1.el7.x86_64                                                                          1/11 
  正在更新    : kernel-tools-3.10.0-1160.90.1.el7.x86_64                                                                               2/11 
  正在更新    : libwebp-0.3.0-11.el7.x86_64                                                                                            3/11 
  正在更新    : python-perf-3.10.0-1160.90.1.el7.x86_64                                                                                4/11 
  正在更新    : bpftool-3.10.0-1160.90.1.el7.x86_64                                                                                    5/11 
  正在安装    : kernel-3.10.0-1160.90.1.el7.x86_64                                                                                     6/11 
  清理        : kernel-tools-3.10.0-1160.88.1.el7.x86_64                                                                               7/11 
  清理        : kernel-tools-libs-3.10.0-1160.88.1.el7.x86_64                                                                          8/11 
  清理        : libwebp-0.3.0-10.el7_9.x86_64                                                                                          9/11 
  清理        : python-perf-3.10.0-1160.88.1.el7.x86_64                                                                               10/11 
  清理        : bpftool-3.10.0-1160.88.1.el7.x86_64                                                                                   11/11 
  验证中      : kernel-tools-3.10.0-1160.90.1.el7.x86_64                                                                               1/11 
  验证中      : kernel-3.10.0-1160.90.1.el7.x86_64                                                                                     2/11 
  验证中      : bpftool-3.10.0-1160.90.1.el7.x86_64                                                                                    3/11 
  验证中      : python-perf-3.10.0-1160.90.1.el7.x86_64                                                                                4/11 
  验证中      : libwebp-0.3.0-11.el7.x86_64                                                                                            5/11 
  验证中      : kernel-tools-libs-3.10.0-1160.90.1.el7.x86_64                                                                          6/11 
  验证中      : python-perf-3.10.0-1160.88.1.el7.x86_64                                                                                7/11 
  验证中      : kernel-tools-libs-3.10.0-1160.88.1.el7.x86_64                                                                          8/11 
  验证中      : kernel-tools-3.10.0-1160.88.1.el7.x86_64                                                                               9/11 
  验证中      : libwebp-0.3.0-10.el7_9.x86_64                                                                                         10/11 
  验证中      : bpftool-3.10.0-1160.88.1.el7.x86_64                                                                                   11/11 

已安装:
  kernel.x86_64 0:3.10.0-1160.90.1.el7                                                                                                      

更新完毕:
  bpftool.x86_64 0:3.10.0-1160.90.1.el7    kernel-tools.x86_64 0:3.10.0-1160.90.1.el7    kernel-tools-libs.x86_64 0:3.10.0-1160.90.1.el7   
  libwebp.x86_64 0:0.3.0-11.el7            python-perf.x86_64 0:3.10.0-1160.90.1.el7    

完毕!
[root@vmooo1 ~]# yum localinstall ./*.rpm -y
已加载插件:fastestmirror
正在检查 ./containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
./containerd.io-1.6.21-3.1.el7.x86_64.rpm 将被安装
正在检查 ./container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
./container-selinux-2.107-3.el7.noarch.rpm 将被安装
正在检查 ./docker-ce-23.0.6-1.el7.x86_64.rpm: 3:docker-ce-23.0.6-1.el7.x86_64
./docker-ce-23.0.6-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-ce-cli-23.0.6-1.el7.x86_64.rpm: 1:docker-ce-cli-23.0.6-1.el7.x86_64
./docker-ce-cli-23.0.6-1.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.107-3.el7 将被 安装
---> 软件包 containerd.io.x86_64.0.1.6.21-3.1.el7 将被 安装
---> 软件包 docker-ce.x86_64.3.23.0.6-1.el7 将被 安装
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-23.0.6-1.el7.x86_64 需要
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
---> 软件包 docker-ce-cli.x86_64.1.23.0.6-1.el7 将被 安装
--> 正在处理依赖关系 docker-buildx-plugin,它被软件包 1:docker-ce-cli-23.0.6-1.el7.x86_64 需要
--> 正在处理依赖关系 docker-compose-plugin,它被软件包 1:docker-ce-cli-23.0.6-1.el7.x86_64 需要
--> 解决依赖关系完成
错误:软件包:1:docker-ce-cli-23.0.6-1.el7.x86_64 (/docker-ce-cli-23.0.6-1.el7.x86_64)
          需要:docker-buildx-plugin
错误:软件包:3:docker-ce-23.0.6-1.el7.x86_64 (/docker-ce-23.0.6-1.el7.x86_64)
          需要:docker-ce-rootless-extras
错误:软件包:1:docker-ce-cli-23.0.6-1.el7.x86_64 (/docker-ce-cli-23.0.6-1.el7.x86_64)
          需要:docker-compose-plugin
 您可以尝试添加 --skip-broken 选项来解决该问题
 您可以尝试执行:rpm -Va --nofiles --nodigest
[root@vmooo1 ~]#  ^C
[root@vmooo1 ~]# yum localinstall ./*.rpm -y
已加载插件:fastestmirror
正在检查 ./containerd.io-1.6.21-3.1.el7.x86_64.rpm: containerd.io-1.6.21-3.1.el7.x86_64
./containerd.io-1.6.21-3.1.el7.x86_64.rpm 将被安装
正在检查 ./container-selinux-2.107-3.el7.noarch.rpm: 2:container-selinux-2.107-3.el7.noarch
./container-selinux-2.107-3.el7.noarch.rpm 将被安装
正在检查 ./docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm: docker-buildx-plugin-0.10.4-1.el7.x86_64
./docker-buildx-plugin-0.10.4-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-ce-23.0.6-1.el7.x86_64.rpm: 3:docker-ce-23.0.6-1.el7.x86_64
./docker-ce-23.0.6-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-ce-cli-23.0.6-1.el7.x86_64.rpm: 1:docker-ce-cli-23.0.6-1.el7.x86_64
./docker-ce-cli-23.0.6-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-ce-rootless-extras-23.0.6-1.el7.x86_64.rpm: docker-ce-rootless-extras-23.0.6-1.el7.x86_64
./docker-ce-rootless-extras-23.0.6-1.el7.x86_64.rpm 将被安装
正在检查 ./docker-compose-plugin-2.6.0-3.el7.x86_64.rpm: docker-compose-plugin-2.6.0-3.el7.x86_64
./docker-compose-plugin-2.6.0-3.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.107-3.el7 将被 安装
---> 软件包 containerd.io.x86_64.0.1.6.21-3.1.el7 将被 安装
---> 软件包 docker-buildx-plugin.x86_64.0.0.10.4-1.el7 将被 安装
---> 软件包 docker-ce.x86_64.3.23.0.6-1.el7 将被 安装
---> 软件包 docker-ce-cli.x86_64.1.23.0.6-1.el7 将被 安装
---> 软件包 docker-ce-rootless-extras.x86_64.0.23.0.6-1.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-23.0.6-1.el7.x86_64 需要
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.bupt.edu.cn
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-23.0.6-1.el7.x86_64 需要
---> 软件包 docker-compose-plugin.x86_64.0.2.6.0-3.el7 将被 安装
--> 正在检查事务
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================
 Package                            架构            版本                      源                                                       大小
============================================================================================================================================
正在安装:
 container-selinux                  noarch          2:2.107-3.el7             /container-selinux-2.107-3.el7.noarch                    40 k
 containerd.io                      x86_64          1.6.21-3.1.el7            /containerd.io-1.6.21-3.1.el7.x86_64                    114 M
 docker-buildx-plugin               x86_64          0.10.4-1.el7              /docker-buildx-plugin-0.10.4-1.el7.x86_64                53 M
 docker-ce                          x86_64          3:23.0.6-1.el7            /docker-ce-23.0.6-1.el7.x86_64                           94 M
 docker-ce-cli                      x86_64          1:23.0.6-1.el7            /docker-ce-cli-23.0.6-1.el7.x86_64                       35 M
 docker-ce-rootless-extras          x86_64          23.0.6-1.el7              /docker-ce-rootless-extras-23.0.6-1.el7.x86_64           19 M
 docker-compose-plugin              x86_64          2.6.0-3.el7               /docker-compose-plugin-2.6.0-3.el7.x86_64                25 M
为依赖而安装:
 fuse-overlayfs                     x86_64          0.7.2-6.el7_8             extras                                                   54 k
 fuse3-libs                         x86_64          3.6.1-4.el7               extras                                                   82 k
 slirp4netns                        x86_64          0.4.3-4.el7_8             extras                                                   81 k

事务概要
============================================================================================================================================
安装  7 软件包 (+3 依赖软件包)

总计:340 M
总下载量:218 k
安装大小:340 M
Downloading packages:
(1/3): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                       |  54 kB  00:00:00     
(2/3): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                             |  82 kB  00:00:00     
(3/3): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                          |  81 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                        507 kB/s | 218 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 2:container-selinux-2.107-3.el7.noarch                                                                                 1/10 
  正在安装    : containerd.io-1.6.21-3.1.el7.x86_64                                                                                    2/10 
  正在安装    : docker-compose-plugin-2.6.0-3.el7.x86_64                                                                               3/10 
  正在安装    : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                       4/10 
  正在安装    : docker-buildx-plugin-0.10.4-1.el7.x86_64                                                                               5/10 
  正在安装    : 1:docker-ce-cli-23.0.6-1.el7.x86_64                                                                                    6/10 
  正在安装    : fuse3-libs-3.6.1-4.el7.x86_64                                                                                          7/10 
  正在安装    : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                    8/10 
  正在安装    : 3:docker-ce-23.0.6-1.el7.x86_64                                                                                        9/10 
  正在安装    : docker-ce-rootless-extras-23.0.6-1.el7.x86_64                                                                         10/10 
  验证中      : fuse3-libs-3.6.1-4.el7.x86_64                                                                                          1/10 
  验证中      : 3:docker-ce-23.0.6-1.el7.x86_64                                                                                        2/10 
  验证中      : containerd.io-1.6.21-3.1.el7.x86_64                                                                                    3/10 
  验证中      : docker-ce-rootless-extras-23.0.6-1.el7.x86_64                                                                          4/10 
  验证中      : docker-buildx-plugin-0.10.4-1.el7.x86_64                                                                               5/10 
  验证中      : 1:docker-ce-cli-23.0.6-1.el7.x86_64                                                                                    6/10 
  验证中      : 2:container-selinux-2.107-3.el7.noarch                                                                                 7/10 
  验证中      : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                       8/10 
  验证中      : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                    9/10 
  验证中      : docker-compose-plugin-2.6.0-3.el7.x86_64                                                                              10/10 

已安装:
  container-selinux.noarch 2:2.107-3.el7        containerd.io.x86_64 0:1.6.21-3.1.el7    docker-buildx-plugin.x86_64 0:0.10.4-1.el7        
  docker-ce.x86_64 3:23.0.6-1.el7               docker-ce-cli.x86_64 1:23.0.6-1.el7      docker-ce-rootless-extras.x86_64 0:23.0.6-1.el7   
  docker-compose-plugin.x86_64 0:2.6.0-3.el7   

作为依赖被安装:
  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8            fuse3-libs.x86_64 0:3.6.1-4.el7            slirp4netns.x86_64 0:0.4.3-4.el7_8           

完毕!
[root@vmooo1 ~]# systemctl restart docker
[root@vmooo1 ~]# docker -v
Docker version 23.0.6, build ef23cbc
[root@vmooo1 ~]# docker version
Client: Docker Engine - Community
 Version:           23.0.6
 API version:       1.42
 Go version:        go1.19.9
 Git commit:        ef23cbc
 Built:             Fri May  5 21:21:29 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.6
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.9
  Git commit:       9dbdbd4
  Built:            Fri May  5 21:20:38 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[root@vmooo1 ~]
ifconfig | grep inet | awk 'NR==1{print$2}'
172.17.0.1
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://wwte1lvf.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker pull centos:centos7
[root@vmooo1 ~]# docker pull centos:centos7
centos7: Pulling from library/centos
2d473b07cdd5: Pull complete 
Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987
Status: Downloaded newer image for centos:centos7
docker.io/library/centos:centos7
docker  images
[root@vmooo1 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
centos       centos7   eeb6ee3f44bd   20 months ago   204MB
[root@vmooo1 ~]# docker run -itd eeb6ee3f44bd /bin/bash
b156fdb5de6dfccfc55dfd761435e35c6d82d27d9ba20f855c97321d24e360be
[root@vmooo1 ~]# docker ps
CONTAINER ID   IMAGE          COMMAND       CREATED              STATUS              PORTS     NAMES
b156fdb5de6d   eeb6ee3f44bd   "/bin/bash"   About a minute ago   Up About a minute             magical_swirles
[root@vmooo1 ~]# docker exec -it b156fdb5de6d /bin/bash
[root@b156fdb5de6d /]# hostname
b156fdb5de6d
[root@b156fdb5de6d /]# hostname -i
172.17.0.2
[root@b156fdb5de6d /]# hostname -I
172.17.0.2 
[root@b156fdb5de6d /]
[root@b156fdb5de6d sysconfig]# yum search ifconfig
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                 | 3.6 kB  00:00:00     
extras                                                                                                               | 2.9 kB  00:00:00     
updates                                                                                                              | 2.9 kB  00:00:00     
(1/4): extras/7/x86_64/primary_db                                                                                    | 249 kB  00:00:00     
(2/4): base/7/x86_64/primary_db                                                                                      | 6.1 MB  00:00:00     
(3/4): base/7/x86_64/group_gz                                                                                        | 153 kB  00:00:01     
(4/4): updates/7/x86_64/primary_db                                                                                   |  21 MB  00:00:01     
============================================================ Matched: ifconfig =============================================================
net-tools.x86_64 : Basic networking tools
[root@b156fdb5de6d sysconfig]# yum localinstall net-tools -y
Loaded plugins: fastestmirror, ovl
Skipping: net-tools, filename does not end in .rpm.
Nothing to do
[root@b156fdb5de6d sysconfig]# yum install net-tools -y
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                        Arch                        Version                                         Repository                 Size
============================================================================================================================================
Installing:
 net-tools                      x86_64                      2.0-0.25.20131004git.el7                        base                      306 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total download size: 306 k
Installed size: 917 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.25.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for net-tools-2.0-0.25.20131004git.el7.x86_64.rpm is not installed
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm                                                                        | 306 kB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-9.2009.0.el7.centos.x86_64 (@CentOS)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                1/1 
  Verifying  : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                1/1 

Installed:
  net-tools.x86_64 0:2.0-0.25.20131004git.el7                                                                                               

Complete!
[root@b156fdb5de6d sysconfig]# systemctl restart ifconfig
Failed to get D-Bus connection: Operation not permitted
[root@b156fdb5de6d sysconfig]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
        RX packets 10344  bytes 29653265 (28.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6740  bytes 448756 (438.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@b156fdb5de6d sysconfig]

hub.docker.com

分类:

后端

标签:

运维部署

作者介绍

一抬菊花
V1