基于ARM64架构飞腾2000CPU的浪潮CE3000F机器安装银河麒麟系统和Docker

缘起,折腾,结果

由于客户是保密事业单位,需要在国产机器国产系统上跑我们公司的应用,经过各种折腾才得知客户的系统版本和关键信息。结果一看是ARM64架构的国产CPU,我们之前所有基于x86的努力都白费了。

几经周折,我在咨询了麒麟,浪潮n个400客服之后,终于得到关键信息,FT-2000 CPU的CE3000F有现货,而且给客户的保密机最接近,而且可以安装银河麒麟开发版的系统,不过该机器无法安装NVIDIA的高级显卡,这个是另外一个故事了。

总的来说,功夫不负有心人,我最终在国产硬件和国产系统上成功跑了docker的hello-world

image-20211202135239964

image-20211202140547673

安装系统

x86的版本比较容易找到,可以在官网去注册下载 https://www.kylinos.cn/

也可以通过公网找到银河麒麟的各个版本系统,比如这里:https://blog.csdn.net/itas109/article/details/109453945

但是我们这边需要的ARM64的,而且要跟客户那边保密机内核一致的(方便开发),我通过打麒麟官网400的客服电话,终于拿到了好几个更多的400电话,问了亿点点人,最终是拿到了这个开发版的镜像,版本信息见第一个截图,内核4.4.131.D001.64.190906。我就省去大家的麻烦,直接通过百度网盘分享出来。

关键信息 链接: https://pan.baidu.com/s/1RCgqGhfJqGyiJlg9g9rE8g 提取码: 22d1

找到浪潮官方销售,咨询对方购买了CE3000F机器,对方确认可以出厂自带安装该系统,欣喜若狂(不是我不会装,只是不想再来亿点点的400这种折腾了,对方安装好,我直接用,跑docker不香么?)

破解密码

事实证明,我还是too simple,sometimes 拿衣服。我拿到机器后,看到该机器竟然还有光驱(外形可以参考这里https://item.jd.com/100029674296.html),可以怀旧一波了。上电,结果发现浪潮技术人员,没有给我发root密码,或者一般用户名和密码,我开机无法登陆。。。又是亿点点转接,找到技术人员手机号,打过去问到结果竟然是,这个您给的系统本来就是这样的,我也不知道在哪里设置密码,我以为您知道后台密码。大哥,黑人问号。。。挂断电话,只能自己破解密码了,实在不行就只能重装系统了。

搜索了好多链接,试了这种方式改Grub,https://blog.csdn.net/shijingrao0512/article/details/107108276,黑屏

最后通过这个方式成功破解

https://blog.csdn.net/weixin_39969976/article/details/112773679

关键信息 重点是要加入

console=tty0 init=/bin/bash

然后按F10启动,修改root密码,创建一般用户

安装Docker

如果是标准版的ARM64的docker,安装起来也容易,看docker官网一步步来就行了,但是这个是麒麟系统,没有对应的docker官方源。麒麟自己有,可以直接用sudo apt install docker.io来安装,但是安装之后无法运行。。。

我在安装docker的过程中,竟然可以遇到好几个错误。这个是最折腾人的,我一个个来分析解决。

1. 时间导致的问题

docker: Error response from daemon: Get “https://registry-1.docker.io/v2/”: x509: certificate has expired or is not yet valid: current time 2016-02-12T01:17:37+08:00 is before 2021-04-25T00:00:00Z.

root@Kylin:/data# date
2016年 02月 12日 星期五 01:17:42 CST

这个问题比较奇葩,每次重启,机器的时间就变成2016年了,就会导致证书时间问题。。。之前一直没有意识到

参考这两篇文章

https://blog.csdn.net/luhengs/article/details/111637787

https://zhuanlan.zhihu.com/p/77905195

修改时钟同步配置并开机启动即可解决

root@Kylin:/data# timedatectl
      Local time: 五 2016-02-12 01:17:56 CST
  Universal time: 四 2016-02-11 17:17:56 UTC
        RTC time: n/a
       Time zone: Asia/Shanghai (CST, +0800)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
        
###在下面配置文件中配入国家授时中心的地址
sonicning@Kylin:~$ cat /etc/systemd/timesyncd.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=ntp.ntsc.ac.cn
#FallbackNTP=ntp.ubuntu.com

root@Kylin:/data# systemctl restart systemd-timesyncd.service
Warning: systemd-timesyncd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
root@Kylin:/data# systemctl daemon-reload
root@Kylin:/data# systemctl restart systemd-timesyncd.service
root@Kylin:/data# sudo timedatectl set-ntp true
root@Kylin:/data# timedatectl
      Local time: 四 2021-12-02 11:06:23 CST
  Universal time: 四 2021-12-02 03:06:23 UTC
        RTC time: n/a
       Time zone: Asia/Shanghai (CST, +0800)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
root@Kylin:/data# systemctl enable systemd-timesyncd.service

2. docker版本太高导致的问题

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: set process label: open /proc/thread-self/attr/exec: no such file or directory: unknown.

银河麒麟的这个版本是基于Ubuntu基础上开发出来的,本以为安装最新的Ubuntu 20.04的ARM64架构的docker的deb包即可解决问题https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/arm64/,结果最后发现是版本太高了。

lsb_release -a 和 uname -a 指令仅能查看到麒麟版本和对应的Linux内核版本,是无法查到这个到底是基于Ubuntu哪个版本开发的。

我在参考这个链接https://www.cnblogs.com/NosenLiu/p/15032064.html之后,发现我这个麒麟系统是基于Ubuntu16.04版本的,希望麒麟的开发人员不要修改这个。

image-20211202150131573

然后参考了这个官方文档https://www.kylinos.cn/support/document/2.html之后决定安装Ubuntu16.04的ARM64架构的deb包,也只需要安装docker-ce_18.06.1,其他的docker组件都不需要安装。

image-20211202145531387

sudo apt install ca-certificates

wget --no-check-certificate https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/arm64/docker-ce_18.06.1~ce~3-0~ubuntu_arm64.deb

sudo dpkg -i docker-ce_18.06.1~ce~3-0~ubuntu_arm64.deb

systemctl enable docker

systemctl start docker

sudo docker run hello-world

于此,终于得到了前面的截图

3. 在selinux启用的前提下使用docker

这个是保密和安全的需求,要在selinux启用的情况下使用,这个就请大家参考这两个英文链接就好了,我就不赘述了。

https://jaosorior.dev/2018/selinux-and-docker-notes/

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/container_security_guide/docker_selinux_security_policy

关键信息

在daemon.json中加入如下部分并重启docker,确认docker info中有selinux信息

root@Kylin:~# cat /etc/docker/daemon.json
{
  "selinux-enabled": true
}
root@Kylin:~# systemctl daemon-reload
root@Kylin:~# systemctl restart docker
root@Kylin:~# docker info

image-20211202151334762

PS:在Ubuntu上卸载docker你一定会用到的链接,别问我卸载了多少次了。。。

https://www.cnblogs.com/shmily3929/p/12085163.html

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐