[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# vim /etc/selinux/config
[root@localhost yum.repos.d]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only s.e.l.e.c.ted processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost yum.repos.d]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost yum.repos.d]# yum list docker-ce --showduplicates
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
Determining fastest mirrors
base: mirrors.aliyun.com
extras: mirrors.aliyun.com
u.p.d.a.t.es: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
dvd | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
u.p.d.a.t.es | 2.9 kB 00:00:00
(1/8): dvd/group_gz | 166 kB 00:00:00
(2/8): dvd/primary_db | 3.1 MB 00:00:00
(3/8): docker-ce-stable/7/x86_64/u.p.d.a.t.einfo | 55 B 00:00:05
(4/8): base/7/x86_64/group_gz | 153 kB 00:00:05
(5/8): extras/7/x86_64/primary_db | 253 kB 00:00:05
(6/8): docker-ce-stable/7/x86_64/primary_db | 152 kB 00:00:05
(7/8): base/7/x86_64/primary_db | 6.1 MB 00:00:07
(8/8): u.p.d.a.t.es/7/x86_64/primary_db | 27 MB 00:00:12
可安装的软件包
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos
此处省略安装包一万字
[root@localhost yum.repos.d]#yum install -y docker-ce ##不加ce版本不一样
后面略-----全安装内容
已安装:
docker-ce.x86_64 3:26.1.4-1.el7
作为依赖被安装:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.6.33-3.1.el7
docker-buildx-plugin.x86_64 0:0.14.1-1.el7 docker-ce-cli.x86_64 1:26.1.4-1.el7
docker-ce-rootless-extras.x86_64 0:26.1.4-1.el7 docker-compose-plugin.x86_64 0:2.27.1-1.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
作为依赖被升级:
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libsemanage.x86_64 0:2.5-14.el7
libsemanage-python.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7
policycoreutils.x86_64 0:2.5-34.el7 policycoreutils-python.x86_64 0:2.5-34.el7
selinux-policy.noarch 0:3.13.1-268.el7_9.2 selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2
setools-libs.x86_64 0:3.3.8-4.el7
完毕!
[root@localhost yum.repos.d]# systemctl start docker
[root@localhost yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost yum.repos.d]# docker version
Client: Docker Engine - Community
Version: 26.1.4 ----版本号一致,同时显示客户端和服务端,表示成功安装
API version: 1.45
Go version: go1.21.11
Git commit: 5650f9b
Built: Wed Jun 5 11:32:04 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.4 ----版本号
API version: 1.45 (minimum version 1.24)
Go version: go1.21.11
Git commit: de5c9cf
Built: Wed Jun 5 11:31:02 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.33
GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@localhost yum.repos.d]# vim /etc/docker/daemon.json
[root@localhost yum.repos.d]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://x3n9jrcg.mirror.aliyuncs.com"]
}
这两个选下面一个就行
{
"registry-mirrors":["https://a88uijg4.mirror.aliyuncs.com","https://docker.lmirror.top","https://docker.m.daocloud.io", "https://hub.uuuadc.top","https://docker.anyhub.us.kg","https://dockerhub.jobcher.com","https://dockerhub.icu","https://docker.ckyl.me","https://docker.awsl9527.cn","https://docker.laoex.link"],
"insecure-registries":["192.168.40.62","harbor"]
}
[root@localhost yum.repos.d]# systemctl daemon-reload
[root@localhost yum.repos.d]# systemctl restart docker
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bc0965b23a04: Pull complete
650ee30bbe5e: Pull complete
8cc1569e58f5: Pull complete
362f35df001b: Pull complete
13e320bf29cd: Pull complete
7b50399908e1: Pull complete
57b64962dd94: Pull complete
Digest: sha256:fb197595ebe76b9c0c14ab68159fd3c08bd067ec62300583543f0ebda353b5be
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost yum.repos.d]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 66f8bdd3810c 3 weeks ago 192MB
[root@localhost yum.repos.d]# docker run -dit -p 80:80 nginx:latest
13d2792219d4814533c3993dd2c27fb502077b18060d10e3d20e16478bb79314
[root@localhost yum.repos.d]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13d2792219d4 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp practical_lovelace
[root@localhost yum.repos.d]#ip addr SHOW
阿里巴巴开源镜像站
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# systemctl stop firewalld
[root@localhost yum.repos.d]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost yum.repos.d]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)------防火墙关闭
Docs: man:firewalld(1)
12月 19 16:09:49 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
12月 19 16:09:50 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
12月 19 17:16:37 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
12月 19 17:16:38 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# vim /etc/selinux/config
[root@localhost yum.repos.d]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only s.e.l.e.c.ted processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost yum.repos.d]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost yum.repos.d]# yum list docker-ce --showduplicates
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
Determining fastest mirrors
base: mirrors.aliyun.com
extras: mirrors.aliyun.com
u.p.d.a.t.es: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
dvd | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
u.p.d.a.t.es | 2.9 kB 00:00:00
(1/8): dvd/group_gz | 166 kB 00:00:00
(2/8): dvd/primary_db | 3.1 MB 00:00:00
(3/8): docker-ce-stable/7/x86_64/u.p.d.a.t.einfo | 55 B 00:00:05
(4/8): base/7/x86_64/group_gz | 153 kB 00:00:05
(5/8): extras/7/x86_64/primary_db | 253 kB 00:00:05
(6/8): docker-ce-stable/7/x86_64/primary_db | 152 kB 00:00:05
(7/8): base/7/x86_64/primary_db | 6.1 MB 00:00:07
(8/8): u.p.d.a.t.es/7/x86_64/primary_db | 27 MB 00:00:12
可安装的软件包
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos
此处省略安装包一万字
[root@localhost yum.repos.d]#yum install -y docker-ce ##不加ce版本不一样
后面略-----全安装内容
已安装:
docker-ce.x86_64 3:26.1.4-1.el7
作为依赖被安装:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.6.33-3.1.el7
docker-buildx-plugin.x86_64 0:0.14.1-1.el7 docker-ce-cli.x86_64 1:26.1.4-1.el7
docker-ce-rootless-extras.x86_64 0:26.1.4-1.el7 docker-compose-plugin.x86_64 0:2.27.1-1.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
作为依赖被升级:
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libsemanage.x86_64 0:2.5-14.el7
libsemanage-python.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7
policycoreutils.x86_64 0:2.5-34.el7 policycoreutils-python.x86_64 0:2.5-34.el7
selinux-policy.noarch 0:3.13.1-268.el7_9.2 selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2
setools-libs.x86_64 0:3.3.8-4.el7
完毕!
[root@localhost yum.repos.d]# systemctl start docker
[root@localhost yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost yum.repos.d]# docker version
Client: Docker Engine - Community
Version: 26.1.4 ----版本号一致,同时显示客户端和服务端,表示成功安装
API version: 1.45
Go version: go1.21.11
Git commit: 5650f9b
Built: Wed Jun 5 11:32:04 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.4 ----版本号
API version: 1.45 (minimum version 1.24)
Go version: go1.21.11
Git commit: de5c9cf
Built: Wed Jun 5 11:31:02 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.33
GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@localhost yum.repos.d]# vim /etc/docker/daemon.json
[root@localhost yum.repos.d]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://x3n9jrcg.mirror.aliyuncs.com"]
}
这两个选下面一个就行
{
"registry-mirrors":["https://a88uijg4.mirror.aliyuncs.com","https://docker.lmirror.top","https://docker.m.daocloud.io", "https://hub.uuuadc.top","https://docker.anyhub.us.kg","https://dockerhub.jobcher.com","https://dockerhub.icu","https://docker.ckyl.me","https://docker.awsl9527.cn","https://docker.laoex.link"],
"insecure-registries":["192.168.40.62","harbor"]
}
[root@localhost yum.repos.d]# systemctl daemon-reload
[root@localhost yum.repos.d]# systemctl restart docker
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bc0965b23a04: Pull complete
650ee30bbe5e: Pull complete
8cc1569e58f5: Pull complete
362f35df001b: Pull complete
13e320bf29cd: Pull complete
7b50399908e1: Pull complete
57b64962dd94: Pull complete
Digest: sha256:fb197595ebe76b9c0c14ab68159fd3c08bd067ec62300583543f0ebda353b5be
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost yum.repos.d]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 66f8bdd3810c 3 weeks ago 192MB
[root@localhost yum.repos.d]# docker run -dit -p 80:80 nginx:latest
13d2792219d4814533c3993dd2c27fb502077b18060d10e3d20e16478bb79314
[root@localhost yum.repos.d]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13d2792219d4 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp practical_lovelace
[root@localhost yum.repos.d]#ip addr SHOW
CentOS系统DNS服务器配置场景化实训
场景描述:
某公司内部网络需要部署一台DNS服务器,用于为内部网络中的计算机提供内部网络和Internet的域名解析服务。公司内部网络的DNS域名为example.com,需要在CentOS 7系统上配置这台DNS服务器。
任务要求:
1. 安装并配置BIND软件,以搭建DNS服务器。
2. 创建正向和反向查找区域,并添加相应的资源记录。
3. 测试DNS服务器的域名解析功能。
步骤及答案:
一、安装BIND软件
[root@localhost ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo CentOS-x86_64-kernel.repo
CentOS-Debuginfo.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv C bak
[root@localhost yum.repos.d]# touch dvd.repo
[root@localhost yum.repos.d]# vi dvd.repo
[root@localhost yum.repos.d]# cat dvd.repo
[dvd]
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# yum install bind -y
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
Loading mirror speeds from cached hostfile
dvd | 3.6 kB 00:00:00
(1/2): dvd/group_gz | 153 kB 00:00:00
(2/2): dvd/primary_db | 3.3 MB 00:00:00
软件包 32:bind-export-libs-9.11.4-26.P2.el7.x86_64 已安装并且是最新版本
软件包 32:bind-libs-9.11.4-26.P2.el7.x86_64 已安装并且是最新版本
软件包 32:bind-utils-9.11.4-26.P2.el7.x86_64 已安装并且是最新版本
软件包 32:bind-license-9.11.4-26.P2.el7.noarch 已安装并且是最新版本
软件包 32:bind-libs-lite-9.11.4-26.P2.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 bind.x86_64.32.9.11.4-26.P2.el7 将被 安装
--> 正在处理依赖关系 python-ply,它被软件包 32:bind-9.11.4-26.P2.el7.x86_64 需要
---> 软件包 bind-chroot.x86_64.32.9.11.4-26.P2.el7 将被 安装
---> 软件包 bind-dyndb-ldap.x86_64.0.11.1-7.el7 将被 安装
---> 软件包 bind-pkcs11.x86_64.32.9.11.4-26.P2.el7 将被 安装
---> 软件包 bind-pkcs11-libs.x86_64.32.9.11.4-26.P2.el7 将被 安装
---> 软件包 bind-pkcs11-utils.x86_64.32.9.11.4-26.P2.el7 将被 安装
--> 正在检查事务
---> 软件包 python-ply.noarch.0.3.4-11.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================================
Package 架构 版本 源 大小
=======================================================================================
正在安装:
bind x86_64 32:9.11.4-26.P2.el7 dvd 2.3 M
bind-chroot x86_64 32:9.11.4-26.P2.el7 dvd 92 k
bind-dyndb-ldap x86_64 11.1-7.el7 dvd 121 k
bind-pkcs11 x86_64 32:9.11.4-26.P2.el7 dvd 361 k
bind-pkcs11-libs x86_64 32:9.11.4-26.P2.el7 dvd 1.1 M
bind-pkcs11-utils x86_64 32:9.11.4-26.P2.el7 dvd 208 k
为依赖而安装:
python-ply noarch 3.4-11.el7 dvd 123 k
事务概要
=======================================================================================
安装 6 软件包 (+1 依赖软件包)
总下载量:4.3 M
安装大小:10 M
Downloading packages:
---------------------------------------------------------------------------------------
总计 43 MB/s | 4.3 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 32:bind-pkcs11-libs-9.11.4-26.P2.el7.x86_64 1/7
正在安装 : 32:bind-pkcs11-utils-9.11.4-26.P2.el7.x86_64 2/7
正在安装 : python-ply-3.4-11.el7.noarch 3/7
正在安装 : 32:bind-9.11.4-26.P2.el7.x86_64 4/7
正在安装 : 32:bind-pkcs11-9.11.4-26.P2.el7.x86_64 5/7
正在安装 : bind-dyndb-ldap-11.1-7.el7.x86_64 6/7
正在安装 : 32:bind-chroot-9.11.4-26.P2.el7.x86_64 7/7
验证中 : 32:bind-chroot-9.11.4-26.P2.el7.x86_64 1/7
验证中 : python-ply-3.4-11.el7.noarch 2/7
验证中 : bind-dyndb-ldap-11.1-7.el7.x86_64 3/7
验证中 : 32:bind-pkcs11-libs-9.11.4-26.P2.el7.x86_64 4/7
验证中 : 32:bind-9.11.4-26.P2.el7.x86_64 5/7
验证中 : 32:bind-pkcs11-utils-9.11.4-26.P2.el7.x86_64 6/7
验证中 : 32:bind-pkcs11-9.11.4-26.P2.el7.x86_64 7/7
已安装:
bind.x86_64 32:9.11.4-26.P2.el7
bind-chroot.x86_64 32:9.11.4-26.P2.el7
bind-dyndb-ldap.x86_64 0:11.1-7.el7
bind-pkcs11.x86_64 32:9.11.4-26.P2.el7
bind-pkcs11-libs.x86_64 32:9.11.4-26.P2.el7
bind-pkcs11-utils.x86_64 32:9.11.4-26.P2.el7
作为依赖被安装:
python-ply.noarch 0:3.4-11.el7
完毕!
1.查看网卡
ip addr 或者 ifconfig
2.查看网络配置
cat /etc/sysconfig/network-s.c.r.i.p.ts/ifcfg-ens33 (注:ens33为网卡,可能有一定变化)
2.5备份
cp ifcfg-ens33 ifcfg-ens33.bak
3.编辑网络配置
vim /etc/sysconfig/network-s.c.r.i.p.ts/ifcfg-ens33
将BOOTPROTO=dhcp改为BOOTPROTO=static
ONBOOT=no改为ONBOOT=yes
IPADDR=192.168.43.129
NETMASK=255.255.255.0
GATEWAY=192.168.43.2
DNS1=8.8.8.8
打完后按Esc,输入:wq保存并退出
后面再重启网络服务
输入systemcrl restart network
验证
用自己的物理机ping虚拟机,也可以用虚拟机ping物理机
[root@localhost ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo CentOS-x86_64-kernel.repo
CentOS-Debuginfo.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv C bak
[root@localhost yum.repos.d]# ls
bak
[root@localhost yum.repos.d]# vi dvd.repo
[root@localhost yum.repos.d]# cat dvd.repo
[dvd]
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
正在清理软件源: dvd
Cleaning up list of fastest mirrors
Other repos take up 205 M of disk space (use --verbose for details)
[root@localhost yum.repos.d]# yum install vsftpd ftp -y
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
Determining fastest mirrors
dvd | 3.6 kB 00:00:00
(1/2): dvd/group_gz | 153 kB 00:00:00
(2/2): dvd/primary_db | 3.3 MB 00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 ftp.x86_64.0.0.17-67.el7 将被 安装
---> 软件包 vsftpd.x86_64.0.3.0.2-28.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=======================================================================================
Package 架构 版本 源 大小
=======================================================================================
正在安装:
ftp x86_64 0.17-67.el7 dvd 61 k
vsftpd x86_64 3.0.2-28.el7 dvd 172 k
事务概要
=======================================================================================
安装 2 软件包
总下载量:232 k
安装大小:449 k
Downloading packages:
---------------------------------------------------------------------------------------
总计 3.3 MB/s | 232 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : ftp-0.17-67.el7.x86_64 1/2
正在安装 : vsftpd-3.0.2-28.el7.x86_64 2/2
验证中 : vsftpd-3.0.2-28.el7.x86_64 1/2
验证中 : ftp-0.17-67.el7.x86_64 2/2
已安装:
ftp.x86_64 0:0.17-67.el7 vsftpd.x86_64 0:3.0.2-28.el7
完毕!
[root@localhost yum.repos.d]# rpm -qa | grep vsftpd
vsftpd-3.0.2-28.el7.x86_64
[root@localhost yum.repos.d]# rpm -qa | grep ftp
ftp-0.17-67.el7.x86_64
vsftpd-3.0.2-28.el7.x86_64
[root@localhost yum.repos.d]# ip addr |grep ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
inet 192.168.42.128/24 brd 192.168.42.255 scope global noprefixroute dynamic ens33
[root@localhost yum.repos.d]# system
system-config-abrt systemd-firstboot
system-config-printer systemd-hwdb
system-config-printer-applet systemd-inhibit
systemctl systemd-loginctl
systemd-analyze systemd-machine-id-setup
systemd-ask-password systemd-notify
systemd-cat systemd-nspawn
systemd-cgls systemd-path
systemd-cgtop systemd-run
systemd-coredumpctl systemd-stdio-bridge
systemd-delta systemd-sysv-convert
systemd-detect-virt systemd-tmpfiles
systemd-escape systemd-tty-ask-password-agent
[root@localhost yum.repos.d]# systemctl stop firewalld
[root@localhost yum.repos.d]# senteforce 0
bash: senteforce: 未找到命令...
[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# systemctl restart vsftpd
[root@localhost yum.repos.d]# ftp 192.168.42.128
Connected to 192.168.42.128 (192.168.42.128).
220 (vsFTPd 3.0.2)
Name (192.168.42.128:root):
530 Permission denied.
Login failed.
ftp> bye
421 Timeout.
阿里巴巴开源镜像站
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# systemctl stop firewalld
[root@localhost yum.repos.d]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost yum.repos.d]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)------防火墙关闭
Docs: man:firewalld(1)
12月 19 16:09:49 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
12月 19 16:09:50 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
12月 19 17:16:37 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
12月 19 17:16:38 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# vim /etc/selinux/config
[root@localhost yum.repos.d]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only s.e.l.e.c.ted processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost yum.repos.d]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost yum.repos.d]# yum list docker-ce --showduplicates
已加载插件:fastestmirror, langpacks
源 'dvd' 在配置文件中未指定名字,使用标识代替
Determining fastest mirrors
base: mirrors.aliyun.com
extras: mirrors.aliyun.com
u.p.d.a.t.es: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
dvd | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
u.p.d.a.t.es | 2.9 kB 00:00:00
(1/8): dvd/group_gz | 166 kB 00:00:00
(2/8): dvd/primary_db | 3.1 MB 00:00:00
(3/8): docker-ce-stable/7/x86_64/u.p.d.a.t.einfo | 55 B 00:00:05
(4/8): base/7/x86_64/group_gz | 153 kB 00:00:05
(5/8): extras/7/x86_64/primary_db | 253 kB 00:00:05
(6/8): docker-ce-stable/7/x86_64/primary_db | 152 kB 00:00:05
(7/8): base/7/x86_64/primary_db | 6.1 MB 00:00:07
(8/8): u.p.d.a.t.es/7/x86_64/primary_db | 27 MB 00:00:12
可安装的软件包
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos
此处省略安装包一万字
[root@localhost yum.repos.d]#yum install -y docker-ce ##不加ce版本不一样
后面略-----全安装内容
已安装:
docker-ce.x86_64 3:26.1.4-1.el7
作为依赖被安装:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.6.33-3.1.el7
docker-buildx-plugin.x86_64 0:0.14.1-1.el7 docker-ce-cli.x86_64 1:26.1.4-1.el7
docker-ce-rootless-extras.x86_64 0:26.1.4-1.el7 docker-compose-plugin.x86_64 0:2.27.1-1.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
作为依赖被升级:
libselinux.x86_64 0:2.5-15.el7 libselinux-python.x86_64 0:2.5-15.el7
libselinux-utils.x86_64 0:2.5-15.el7 libsemanage.x86_64 0:2.5-14.el7
libsemanage-python.x86_64 0:2.5-14.el7 libsepol.x86_64 0:2.5-10.el7
policycoreutils.x86_64 0:2.5-34.el7 policycoreutils-python.x86_64 0:2.5-34.el7
selinux-policy.noarch 0:3.13.1-268.el7_9.2 selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2
setools-libs.x86_64 0:3.3.8-4.el7
完毕!
[root@localhost yum.repos.d]# systemctl start docker
[root@localhost yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost yum.repos.d]# docker version
Client: Docker Engine - Community
Version: 26.1.4 ----版本号一致,同时显示客户端和服务端,表示成功安装
API version: 1.45
Go version: go1.21.11
Git commit: 5650f9b
Built: Wed Jun 5 11:32:04 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.4 ----版本号
API version: 1.45 (minimum version 1.24)
Go version: go1.21.11
Git commit: de5c9cf
Built: Wed Jun 5 11:31:02 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.33
GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@localhost yum.repos.d]# vim /etc/docker/daemon.json
[root@localhost yum.repos.d]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://x3n9jrcg.mirror.aliyuncs.com"]
}
这两个选下面一个就行
{
"registry-mirrors":["https://a88uijg4.mirror.aliyuncs.com","https://docker.lmirror.top","https://docker.m.daocloud.io", "https://hub.uuuadc.top","https://docker.anyhub.us.kg","https://dockerhub.jobcher.com","https://dockerhub.icu","https://docker.ckyl.me","https://docker.awsl9527.cn","https://docker.laoex.link"],
"insecure-registries":["192.168.40.62","harbor"]
}
[root@localhost yum.repos.d]# systemctl daemon-reload
[root@localhost yum.repos.d]# systemctl restart docker
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bc0965b23a04: Pull complete
650ee30bbe5e: Pull complete
8cc1569e58f5: Pull complete
362f35df001b: Pull complete
13e320bf29cd: Pull complete
7b50399908e1: Pull complete
57b64962dd94: Pull complete
Digest: sha256:fb197595ebe76b9c0c14ab68159fd3c08bd067ec62300583543f0ebda353b5be
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost yum.repos.d]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 66f8bdd3810c 3 weeks ago 192MB
[root@localhost yum.repos.d]# docker run -dit -p 80:80 nginx:latest
13d2792219d4814533c3993dd2c27fb502077b18060d10e3d20e16478bb79314
[root@localhost yum.repos.d]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13d2792219d4 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp practical_lovelace
[root@localhost yum.repos.d]#ip addr SHOW