> ## Content Index
> Fetch the complete content index at: https://blog.k3s.9zf.net/llms.txt
> Use this file to discover other available public pages before exploring further.

# RancherOS安装手记
- URL: https://blog.k3s.9zf.net/rancheros-e5-ae-89-e8-a3-85-e6-89-8b-e8-ae-b0/
- Published: 2021-06-04T15:01:59.000Z
- Updated: 2021-06-04T15:01:59.000Z
- Author: liu
- Tags: Linux, #wordpress, #Import 2026-10-29 06:11

https://github.com/rancher/os 先现在所需镜像

虚拟机引导

默认直接登录了，sudo passwd rancher 修改默认密码，然后ifconfig查看ip

用ssh生成密钥，导出pub公钥，复制到下面替换

创建cloud-config.yml  
###cloud-config.yml 

rancher:  
docker:  
registry\_mirror: https://xxxx.mirror.aliyuncs.com 阿里云镜像加速  
network:  
interfaces:  
eth0:  
address: 192.168.123.219/24  
gateway: 192.168.123.1  
mtu: 1500  
dhcp: false  
dns:  
nameservers:  
\- 223.5.5.5  
\- 223.6.6.6

ssh\_authorized\_keys:  
\- ssh-rsa 密钥  
sudo fdisk -l 查看硬盘为/dev/sda

**sudo ros install –cloud-config cloud-config.yml –device /dev/sda** 

**安装到硬盘**

部署rancher

sudo docker run -d –restart=always –name=rancher -p 8080:8080 rancher/server:stable

登录后开启本地认证，然后添加主机，ip填自己，复制到ssh里执行后就能看到了。