内网esxi主机上安装CoreOS虚拟机

CoreOS是一个为专门运行容器而设计的轻量级linux发行版,旨在通过轻量的系统架构和灵活的应用程序部署能力简化数据中心的维护成本和复杂度。它没有包管理工具,运行容器化应用以提供服务;默认双系统分区,可自动升级内核;用systemd管理系统和服务。包含最强组件etcd,提供统一的全局数据集并实现服务发现功能.
RedHat收购CoreOS后,将其改名为Container Linux by CoreOS,融合其Tectonic(企业级kubernets),提供大规模容器编排管理方案。

下面尝试内网esxi主机上安装CoreOS虚拟机:CoreOS installed on disk
它的硬盘安装同其它linux发行版完全不同,详叙如下:

#下载镜像
https://stable.release.core-os.net/amd64-usr/current/coreos_production_iso_image.iso

#新建vm(至少2G内存,10G硬盘)从cdrom启动
默认以core用户自动登录

#切换到root账号
sudo su - root

网络配置
cd /etc/systemd/network/
vi static.network
[Match]
Name=ens192

[Network]
Address=172.16.7.58/24
Gateway=172.16.7.254
DNS=172.16.7.10

systemctl restart systemd-networkd

passwd core
#修改完密码后即可用xshell登录了

#查看各版本
rkt version
docker -v
uname -r 
cat /etc/motd

#切换到另一台VM上,同网段172.16.7.70搭建http服务centos7:yum install -y httpd && sytemctl start httpd
cd /var/www/html
mkdir 1855.4.0
cd 1855.4.0
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_image.bin.bz2
wget https://stable.release.core-os.net/amd64-usr/current/coreos_production_image.bin.bz2.sig
wget https://stable.release.core-os.net/amd64-usr/current/version.txt

#回到CoreOS的vm上开始安装,直接在根目录编辑初始化文件
vi init.ymal

#cloud-config
hostname: coreos01
coreos:
  units:
    - name: static.network
      content: |
        [Match]
        Name=ens192

        [Network]
        Address=172.16.7.58/24
        Gateway=172.16.7.254
        DNS=172.16.7.10
        
users:
  - name: core
    passwd: 7mKFO.0Lp2JTI(在另一台linux上生成openssl passwd回车,输入你要设置的密码,再次输入后回车即生成)
  - groups:
    - sudo
    - docker

coreos-install -d /dev/sda -c init.ymal -b http://172.16.7.70

提示localhost ~ # coreos-install -d /dev/sda -c init.ymal -b http://172.16.7.70
2018/10/18 08:02:03 Checking availability of "local-file"
2018/10/18 08:02:03 Fetching user-data from datasource of type "local-file"
/usr/bin/coreos-install: Image URL unavailable: http://172.16.7.70/1855.4.0/coreos_production_image.bin.bz2
Error: return code 1 from exit 1
#所以http服务器的网站根目录需要建目录1855.4.0,并将之前下载的三个文件都移动到该目录

localhost ~ # coreos-install -d /dev/sda -c init.ymal -b http://172.16.7.70
2018/10/18 08:03:07 Checking availability of "local-file"
2018/10/18 08:03:07 Fetching user-data from datasource of type "local-file"
Downloading the signature for http://172.16.7.70/1855.4.0/coreos_production_image.bin.bz2...
2018-10-18 08:03:08 URL:http://172.16.7.70/1855.4.0/coreos_production_image.bin.bz2.sig [566/566] -> "/tmp/coreos-install.xk2czEpzzX/coreos_production_image.bin.bz2.sig" [1]
Downloading, writing and verifying coreos_production_image.bin.bz2...
2018-10-18 08:05:46 URL:http://172.16.7.70/1855.4.0/coreos_production_image.bin.bz2 [389058368/389058368] -> "-" [1]
gpg: Signature made Tue Sep 11 00:12:07 2018 UTC
gpg:                using RSA key 4D7241B14AA47290515D6A8D7FB32ABC0638EB2F
gpg: key 50E0885593D2DCB4 marked as ultimately trusted
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Good signature from "CoreOS Buildbot (Offical Builds) <buildbot@coreos.com>" [ultimate]
Installing cloud-config...
Success! CoreOS Container Linux stable 1855.4.0 is installed on /dev/sda
#看到提示成功安装即OK了,enjoy it!

重启系统后,输入core和你设置的密码即可登录,当然建议还是用key比较安全,init.ymal设置如下

users:
  - name: core
    ssh-authorized-keys:
      - ssh-rsa #你的ssh-rsa秘钥
  - groups:
      - sudo
      - docker

当然也可以直接下载官方的OVA模板(推荐,以上适合裸机安装,在esxi上需要集成vmtools,而ova上集成好了,方便快捷)
https://stable.release.core-os.net/amd64-usr/current/coreos_production_vmware_ova.ova
然后再vmware导入OVF模板即可
只是不知道默认账号core的密码,所以在启动的时候BootLoader界面按e
在最后一行 添加coreos.autologin,按F10启动即可
随后sudo su root,设置ip,修改core的密码,之后就可用xshell登录了

转载于:https://my.oschina.net/u/2404183/blog/2249149

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值