RancherOS是由Rancher labs出品的一個專為Docker而生的精簡版Linux,
提供了一個完整的Docker運行環(huán)境。
RancherOS系統(tǒng)鏡像下載地址:https://github.com/rancher/os
系統(tǒng)要求:內(nèi)存必須在2GB以上。
系統(tǒng)鏡像啟動完成之后登錄賬號:rancher 密碼:rancher
安裝圖解:
系統(tǒng)鏡像啟動完成
登錄用戶名密碼都是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
添加網(wǎng)關(guān):
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客戶端遠程連接服務(wù)器
配置ssh遠程秘鑰登錄,把rancheros安裝到硬盤之后,必須使用秘鑰登錄,否則無法操作服務(wù)器,在控制臺也無法使用密碼登錄。
ssh-keygen -t rsa #配置秘鑰登錄
將生成的公鑰id_rsa.pub寫到cloud-config.yml文件中
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 #私鑰,保存好,后面登錄系統(tǒng)要用到。
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA9U9tgDXX1zyljNaPAq4J48vchIwY+0gipkr7D3FSyExk5BCG
yJ4etcKWKOd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il7bCQ+0ghLtzTQMY6zk3C
5+iNpciDKngcUcq1yqY6qcPUWVA7NSbvx941UW4zudmV02p8rdLvTVDw8e0RFz02
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的內(nèi)容粘貼進來
#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安裝,如果有錯誤,是因為網(wǎng)絡(luò)原因,多試幾次。
直到安裝完成,系統(tǒng)提示重新啟動。
把安裝鏡像去掉,讓系統(tǒng)從硬盤啟動。
/dev/sda 是本地磁盤
可以用命令查看
sudo fdisk -l