暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PVE下(debian)的docker的安装

戈多眼中的世界 2022-07-05
13090

最近突然的直接对于docker比较感兴趣,主要是收到@please@D家庭监控图的影响,想在家里也搞一个,不过咱是搞安全做合规的,对于这种运维专业是在搞不懂,所以在万能的google 和百度的帮助下整理一下,也发出来方便大家学习。

1、PVE的安装,就不用使用直接使用的DD安装就可以了,可以下载PVE客户端,通过mac 的DD命令 或 window的引导盘做成启动盘。就可以PVE系统就好了,这个比较简单就不详细写了。

2、然后在pve通过模板的lxc的模式安装,在其提示的模板中选择debian或者其他的liunx系统进行安装。 

3、以模板方式安装完系统后。不要忙着启动服务器,需要在新安装的服务器下键入(模板cd etc/pve/lxc/),寻找你在建立的准备安装系统的模板编号的文件conf,在其内输入:

lxc.apparmor.profile: unconfined

lxc.cgroup.devices.allow: a

lxc.cap.drop:


4、完成后就可以登录系统了,然后登录的lxc中输入如下配置:

     dpkg-reconfigure tzdata 更改时区

      vi etc/ssh/sshd_config  实现其他主机SSH可访问

    改 permitrootlogin  为  yes

  在默认状态下,debian或者乌班图都存在默认的方向键不好用的情况下,在这种情况下,就可以使用以下的命令 ,就可以愉快的使用键盘快乐的玩耍了。

    vi  etc/vim/vimrc.tiny

  set nocompatible

   setbackspace=2

此外小提示,在设定模板的时,其网关可以考虑使用能访问外部网络的,不然你就要替换国内源了。

然后就是传统的安装了:

apt-get update  此时可能会有报错。

错误如下:

: Repository 'http://security.debian.orgbuster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'

N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

N: Repository 'http://ftp.debian.org/debianbuster InRelease' changed its 'Version' value from '10.7' to '10.12'

E: Repository 'http://ftp.debian.org/debianbuster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'

在此情况下:输入 :apt-get --allow-releaseinfo-change update  

如出现了

Reading package lists... Done

N: Repository 'http://ftp.debian.org/debianbuster InRelease' changed its 'Version' value from '10.7' to '10.12'

N: Repository 'http://ftp.debian.org/

 

使用  apt-get update --allow-releaseinfo-change 进行升级

如果再次使用测试 apt-get update 进行升级直至不报错,那么就可以下一步了。

apt-get install 的命令,安装如下控件

ca-certificates

curl

gnupg

lsb-release

安装无错后,就可以增加密钥了。

curl -fsSLhttps://download.docker.com/linux/debian/gpg|(sudo) apt-key add -

这个里面需要提示的是,如果你使用的不是debian,需要将密钥换成你系统的系统名字,此外由于是测试安装,且为自用,所以我的系统是直接使用root登录的,因此无需使用sudo。

然后可以设定存储库了


置稳定存储库 

Echo  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]https://download.docker.com/linux/debian
$(lsb_release -cs) stable" | tee etc/apt/sources.list.d/docker.list > /dev/null


然后再次 apt-get update

apt-get update

E: Malformed entry 1 in list file etc/apt/sources.list.d/docker.list (Suite)

E: The list of sources could not be read.

 

使用 rm etc/apt/sources.list.d/docker.list 清除它


如果 在 apt-get update 没有报错,就可以使用如下的命令进行安装了

 

apt-get install docker-ce docker-ce-cli containerd.io -y  安装docker

 

可能会报错

 

: Package 'docker-ce' has no installation candidate

E: Unable to locate package docker-ce-cli

E: Unable to locate package containerd.io

E: Couldn't find any package by glob 'containerd.io'

E: Couldn't find any package by regex 'containerd.io'

 

看提示 应该是少了 docker-ce 补丁  安装对应的补丁

 

add-apt-repository\"deb [arch=amd64] https://download.docker.com/linux/debian\$(lsb_release -cs) \stable"


会说没有 add-apt-repository  命令使用如下的命令进行安装 apt-get install software-properties-common


add-apt-repository \

 "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian \

$(lsb_release -cs) \stable"

这个地方 我使用的是其他的一个源头,理论上换docker源头也行,只不过我只是想安装玩玩,所以就不找了。


然后再用apt-get update 如果没有报错,就可以通过如下的命令进行安装了。


apt-get install docker-ce docker-ce-cli containerd.io


就可以愉快的玩耍了

 

 


 

 

 





 



 


 

 







文章转载自戈多眼中的世界,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论