RancherOS

RancherOS是由Rancher labs出品的一个专为Docker而生的精简版Linux,

提供了一个完整的Docker运行环境。

RancherOS系统镜像下载地址:https://github.com/rancher/os

系统要求:内存必须在2GB以上。

系统镜像启动完成之后登录账号:rancher  密码:rancher

安装图解:

RancherOS

RancherOS

系统镜像启动完成

RancherOS

登录用户名密码都是rancher

添加IP地址:

sudo ip addr add 192.168.21.133/24 dev eth0

或者

sudo ifconfig eth0 192.168.21.133 netmask 255.255.255.0

添加网关:

sudo route add default gw 192.168.21.2

修改DNS:

sudo vi /etc/resolv.conf

nameserver 8.8.8.8

nameserver 8.8.4.4

:wq! #保存退出

使用ssh客户端远程连接服务器

配置ssh远程秘钥登录,把rancheros安装到硬盘之后,必须使用秘钥登录,否则无法操作服务器,在控制台也无法使用密码登录。

ssh-keygen -t rsa #配置秘钥登录

将生成的公钥id_rsa.pub写到cloud-config.yml文件中

RancherOS

cd /home/rancher/.ssh/

cat id_rsa.pub #公钥

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD1T22ANdfXPKWM1o8Crgnjy9yEjBj7SCKmSvsPcVLITGTkEIbInh61wpYo51TPyHJjPtEBfjeXZ7D8wQpGQPcNpFydwSK9Nec7jedSRHIEOQKGuayK12D61FhKQSXopt9PsFaZ7efzlFvo/HAlCMJqM1O4IHbeDfdF9iR/lVirku087JApvZyfpGn9a2v6Je11psG2AnZqvGggNFfTpszs1KsGtFrvy/c/iQEeayH0dj5bsL2lQw4me/YRLTSk9a0ApZknpSEoY51RWwT975coa9xTMy3C6rMhpiI14R/PNljVj/4h/T5g0B2shjeCcZEAwq0NKuOvlqmApMEqv0/n rancher@rancher

cat id_rsa #私钥,保存好,后面登录系统要用到。

-----BEGIN RSA PRIVATE KEY-----

MIIEowIBAAKCAQEA9U9tgDXX1zyljNaPAq4J48vchIwY+0gipkr7D3FSyExk5BCG

yJ4etcKWKOdUz8hyYz7RAX43l2ew/MEKRkD3DaRcncEivTXnO43nUkRyBDkChrms

itdg+tRYSkE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zudmV02p8rdLvTVDw8e0RFz02

r8KHO4aqp27GmcN8Ch38PQKBgB2bh4Pj7YJM15TXmtRLlDTZBB4hgUBbAjjHpJln

EvY15HdL7k5gyy7V/lVf7gD2eidxDW6oka4xIeqOC7wBXR6Q5cF2+ElSeinGeQKJ

Dm1lHJe7m0BYexJx+AuIhzrrjqDyNBx8dIeNkkailia7zCyASMJ3SSfPz746RwSH

y+tNAoGBAJKXA1V4oDeKoUNO08ABMyOsCfG41ETZBN1rLNQCtNP54wTGgK0pFzNX

AOXnTsEEy3QN3u84z9Fl7fzfYaFCQhXBrxqDAkZbt4ufmVMvJg4cDdr+AvdBMbDH

z48T7OeimFQLYEUZPfgSc+cwoZiuQv3eVzD/7ll91QLoT5+IIykR

-----END RSA PRIVATE KEY-----

vi cloud-config.yml #编辑文件,按照格式把id_rsa.pub的内容粘贴进来

#cloud-config

ssh_authorized_keys:

- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc008sjby03bDODhvU1/cXn+oouNRdzrVtOgVpwlSz4QwWS4Fk22w39KGWB9NXnc3Dg5mnis4Ony+v0FvANp2yQKJq4YUUMar2F/e350rAb6Bp1M+gk50zf7mFjG9SciW71DpejPzzFun1HxPCipa0FMFIG3sn3eOgoRrLRJoSrJogMRIZVy0VPi7vNoMcOwqApXxqoC4ncKnmrqlcfeqokJ8qu/i177m35kMv3ixh9BzsUo+O/Bge72Zx/sgrtxoR/KCzbXt3VYIxtKfNkZshqqnRkRFTMNmndEVTuSIZiV61YhBX6af7LfrKpr/0cII+J8DEfL7AjMq2GH1wrFJ7 rancher@rancher

:wq! #保存退出

把rancheros安装到硬盘

sudo ros install -c cloud-config.yml -d /dev/sda #输入y安装,如果有错误,是因为网络原因,多试几次。

RancherOS

RancherOS

直到安装完成,系统提示重新启动。

把安装镜像去掉,让系统从硬盘启动。

/dev/sda 是本地磁盘

可以用命令查看

sudo fdisk -l