dayi的大键盘
dayi的大键盘

云与虚拟化_实验1

云与虚拟化_实验1

实验1

下载使用虚拟机

然后快照回溯到init

https://cmd.dayi.ink/uploads/upload_fb46c84354c605062469bdbdcf830673.png

网络:

推荐改为NAT模式:

https://cmd.dayi.ink/uploads/upload_9b4c95ab3546d7680135bf7f6661edab.png

开机就好啦

实验1 安装和使用Docker

登录名:

root
openstack

步骤1、2 关闭防火墙和SELinux

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

# 关闭SELinux
setenforce 0
# i 进入输入模式,ESC+:wq 退出编辑模式
vi /etc/selinux/config

把SELINUX 改为: SELINUX=disabled

https://cmd.dayi.ink/uploads/upload_4036003eb2eb370837fc6b625f344d8c.png

步骤3 修改网卡配置信息

可能更简单方法

nmtui
https://cmd.dayi.ink/uploads/upload_e421c7f8a780c5dc09942be28723d0cc.png

改信息:

改成自动然后删掉IP

https://cmd.dayi.ink/uploads/upload_4267ce6d7a051be733a3fc4f88257b3f.png
【俩ESC】
reboot

登录后输入

ip addr

这个就是IP地址啦

https://cmd.dayi.ink/uploads/upload_8d7fcddd52ebff8095e60fd634155a48.png

修改DNS

vi /etc/sysconfig/network-scripts/ifcfg-ens33

加入DNS1=114.114.114.114

https://cmd.dayi.ink/uploads/upload_a6dafce70d295a6176b9ea875e908554.png

重启下网络

https://cmd.dayi.ink/uploads/upload_74ef226c869f599c74bb89a818bac915.png

测试与外网的连通性。

[root@node-a ~]# ping -c 4 www.sina.com.cn
PING ww1.sinaimg.cn.w.alikunlun.com (27.221.120.196) 56(84) bytes of data.
64 bytes from 27.221.120.196 (27.221.120.196): icmp_seq=1 ttl=128 time=1.07 ms
64 bytes from 27.221.120.196 (27.221.120.196): icmp_seq=2 ttl=128 time=0.348 ms
64 bytes from 27.221.120.196 (27.221.120.196): icmp_seq=3 ttl=128 time=0.553 ms
64 bytes from 27.221.120.196 (27.221.120.196): icmp_seq=4 ttl=128 time=0.449 ms

--- ww1.sinaimg.cn.w.alikunlun.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 4015ms
rtt min/avg/max/mdev = 0.348/0.606/1.074/0.279 ms
[root@node-a ~]#
https://cmd.dayi.ink/uploads/upload_5ab86260f4a0ce10cb41ed5d0f8153e3.png

SSH连接

在cmd里

ssh [email protected] (这里是你的ip)

输入yes
https://cmd.dayi.ink/uploads/upload_788e24d602a43cb0277e40b3e97c60fa.png

4.更新yum仓库信息

yum -y update
https://cmd.dayi.ink/uploads/upload_2cae344883455ea74200a6092d6f32c8.png

5. 配置时间同步

yum –y install ntpdate
ntpdate ntp.aliyun.com
https://cmd.dayi.ink/uploads/upload_37bf3af3c0b7443604f714d17d8140f6.png

6 7 8. 安装docker

yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2

# 中科大镜像源
yum-config-manager --add-repo http://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo

yum makecache fast
https://cmd.dayi.ink/uploads/upload_78022765aba0853c66c845bd9a211ebc.png

选择并且安装

yum list docker-ce --showduplicates | sort -r

安装

yum install –y docker-ce.x86_64 3:24.0.6-1.el7
https://cmd.dayi.ink/uploads/upload_a654c8e4ce819f4d5d481ee944fe23fb.png
https://cmd.dayi.ink/uploads/upload_3dca66f686398038d50b9bf533f008c7.png

11.开机自启、开机启动


systemctl start docker
systemctl enable docker
https://cmd.dayi.ink/uploads/upload_374bc6ff87835c737c063161c599b027.png

12. 查看docker进程

ps -ef | grep docker
docker version
https://cmd.dayi.ink/uploads/upload_5b36fbc33e369422a852b053eedab946.png
[root@node-a ~]# ps -ef | grep docker
root       2024      1  0 15:29 ?        00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root       2171   1452  0 15:30 pts/0    00:00:00 grep --color=auto docker
[root@node-a ~]# docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:35:25 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:34:28 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24
  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[root@node-a ~]#

12.镜像加速器


vi /etc/docker/daemon.json

i 输入 ESC -> :wq 保存


{
  "registry-mirrors": ["https://x3n9jrcg.mirror.aliyuncs.com"]
}
https://cmd.dayi.ink/uploads/upload_83185599d7289864d5da05dc792fe0bb.png

13. 重启docker


[root@node-a ~]# systemctl daemon-reload
[root@node-a ~]#
[root@node-a ~]# systemctl restart docker
[root@node-a ~]#
https://cmd.dayi.ink/uploads/upload_6c5bc74d6a968102224245487a28d5d8.png

14. 下载镜像以便于测试

docker run -dit -p 80:80 nginx:latest
https://cmd.dayi.ink/uploads/upload_5a55d20f185bce2cb0d635832eb351f5.png

打开网页测试:

https://cmd.dayi.ink/uploads/upload_d487078c811d28840d7c12c5a7a53ac6.png

实验1-2

1. 步骤1:在可联网的主机上制作docker本地安装包。

附录

删除全部容器

docker rm -f $(docker ps -aq)

-q 是ID

发表回复

textsms
account_circle
email

dayi的大键盘

云与虚拟化_实验1
# 云与虚拟化_实验1 ## 实验1 ### 下载使用虚拟机 然后快照回溯到init ![](https://cmd.dayi.ink/uploads/upload_fb46c84354c605062469bdbdcf830673.png) ### 网络: …
扫描二维码继续阅读
2023-11-23