CoreOS是一個爲專門運行容器而設計的輕量級linux發行版,旨在經過輕量的系統架構和靈活的應用程序部署能力簡化數據中心的維護成本和複雜度。它沒有包管理工具,運行容器化應用以提供服務;默認雙系統分區,可自動升級內核;用systemd管理系統和服務。包含最強組件etcd,提供統一的全局數據集並實現服務發現功能.
RedHat收購CoreOS後,將其更名爲Container Linux by CoreOS,融合其Tectonic(企業級kubernets),提供大規模容器編排管理方案。
下面嘗試內網esxi主機上安裝CoreOS虛擬機:CoreOS installed on disk
它的硬盤安裝同其它linux發行版徹底不一樣,詳敘以下:html
#下載鏡像
https://stable.release.core-os.net/amd64-usr/current/coreos_production_iso_image.isolinux
#新建vm(至少2G內存,10G硬盤)從cdrom啓動
默認以core用戶自動登陸docker
#切換到root帳號
sudo su - rootshell
網絡配置
cd /etc/systemd/network/
vi static.network
[Match]
Name=ens192centos
[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.txtssh
#回到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登陸了