热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

优化后的标题:部署与配置Rancher操作系统指南

RancherOS是由RancherLabs开发的一款专为Docker设计的轻量级Linux发行版,提供了一个全面的Docker运行环境。其引导镜像仅20MB,非常适合在资源受限的环境中部署。本文将详细介绍如何在ESXi虚拟化平台上安装和配置RancherOS,帮助用户快速搭建高效、稳定的容器化应用环境。

RancherOS是由Rancher labs出品的一个专为Docker而生的精简版Linux,提供了一个完整的Docker运行环境。引导镜像仅有20MB大小,将其安装到ESXi虚拟机上导出之后,ova文件仅为300MB,比其他Linux发行版小的多。在我的工作环境中,需要将其安装至ESXi server,并向其他人分发。如果你有同样的需求,这篇文章也许可以或多或少帮助到你。英文文章,语法错误在所难免,欢迎批评指正。

To install RancherOS on your ESXi server, first of all, download rancheros ISO image from its website here

1. Create new Virtual Machine for RancherOS

On ESXi, create a new Virtual Machine with at least 1GB memory. After you created appliance, upload rancheros.iso to your ESXi datastore and set CD/DVD rom to use it.

2. Start rancheros

Once you clicked start button, the OS will boot up rapidly and prompt for login. Now rancheros is running in your RAM, you can login with credential rancher/rancher. Anything you change now will not be saved after you reboot. What we need is a docker ready OS so we need to install Rancher OS to our disk.

3. Prepare your cloud-config.yml

Before we install rancheros to our hard disk, you need to setup cloud-config first.

You also need to generate a new SSH key for cloud-config.yml file by following this article

Add your public key to cloud-config.yml file like following:

#cloud-config
ssh_authorized_keys:
- ssh-rsa #AB3NzaC1yc2E....Drinkey@JunkaitekiMacBook-Pro.local

This is for rancher os first boot configuration after installation, you can use your private key to connect this host.

Next, we are going to configure network before installation. Following is an example, you need to configure DNS, IP address of interface and default gateway.

rancher:
network:
dns:
nameservers:
- 172.23.0.5
- 119.6.6.6
interfaces:
eth*:
dhcp: false
eth0:
address: 10.138.103.63/24
gateway: 10.138.103.254
mtu: 1500

Make sure you only have one ethernet interface, current rancher os installer has problem when configuring multiple NICs.

Following is a complete example of cloud-config.yml.

#cloud-config
ssh_authorized_keys:
- ssh-rsa #AB3NzaC1yc2E....Drinkey@JunkaitekiMacBook-Pro.local
hostname: rancheros-cd01
rancher:
network:
dns:
nameservers:
- 119.6.6.6
interfaces:
eth*:
dhcp: false
eth0:
address: 10.138.103.63/24
gateway: 10.138.103.254
mtu: 1500

At last, you need to put your cloud-config.yml to rancher os. After you login, configure a accessible temporary IP address and default gateway on eth0, then scp your cloud-config.yml to it.

Following is an example

On RancherOS, configure IP and default gateway

$ sudo ip addr add 10.138.103.63/24 dev eth0
$ sudo route add default gw 10.138.103.254

On your local machine, copy your cloud-config.yml to RancherOS via SCP or other method.

4. Install

You should be all set if you done everything right in previous steps. Now we can call installer to initiate installation.

$ sudo rancheros-install -c cloud-config.yml -d /dev/sda

Installer will download rancher/os to your system and format /dev/sda. It could be some errors during installation, due to China GFW, keep retrying and you will success eventually.

At last, installer will prompt for reboot, after manual reboot you can configure own rancher os now.

5. Configuration

When rancher os came back, login interface would prompt several interface ip addresses. Now the old login credential rancher/rancher is not valid anymore, you can only use ssh with your private key to login

$ ssh -i wgid_rsa rancher@10.138.103.63

SSH will log you in directly without prompting for password. The private key should stay in your machine if this key-pair is not only for RancherOS connection. You can genenrate another key pair only for RancherOS first connection and you should distribute private key to other users. To enable multiple login, you need to enable ubuntu-console and configure password for user rancher

[rancher@rancheros-cd01 ~]$ sudo ros service list
disabled debian-console
disabled ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo ros service enable ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo ros service list
disabled debian-console
enabled ubuntu-console
[rancher@rancheros-cd01 ~]$ sudo reboot

After reboot, setup new password for user rancher, then you should be able to login from anywhere if you have correct username and password.

Now a lightweight docker ready system is deployed on your ESXi machine.

You can login with account rancher/password. If it didn’t work, you can share the newly generated ssh key pair to your users, it will cause no security issue, because the key pair is only for connecting exported RancherOS. After first login, user can replace his/her own public SSH key in RancherOS authorized_keys file.

Rancher OS also privoded configuration and upgrade approaches and will be described in another document.


推荐阅读
  • 在项目需要国际化处理时,即支持多种语言切换的功能,通常有两种方案:单个包和多个包。本文将重点讨论单个包的实现方法。 ... [详细]
  • 在 Ubuntu 22.04 LTS 上部署 Jira 敏捷项目管理工具
    Jira 敏捷项目管理工具专为软件开发团队设计,旨在以高效、有序的方式管理项目、问题和任务。该工具提供了灵活且可定制的工作流程,能够根据项目需求进行调整。本文将详细介绍如何在 Ubuntu 22.04 LTS 上安装和配置 Jira。 ... [详细]
  • 本文详细介绍了如何在ARM架构的目标设备上部署SSH服务端,包括必要的软件包下载、交叉编译过程以及最终的服务配置与测试。适合嵌入式开发人员和系统集成工程师参考。 ... [详细]
  • RTThread线程间通信
    线程中通信在裸机编程中,经常会使用全局变量进行功能间的通信,如某些功能可能由于一些操作而改变全局变量的值,另一个功能对此全局变量进行读取& ... [详细]
  • 我自己做了一个网站图片的抓取,感觉速度有点慢抓取4000张图片可能得用15分钟左右的时间,我百度看用线程可以加快抓取,然后创建了5个线程抓取,但是5个线程是同步执行同样的操作一个图片就 ... [详细]
  • 2023年最新指南:如何在PHP中屏蔽警告和错误
    本文详细介绍了如何在PHP中屏蔽警告和错误,包括多种方法和最佳实践,帮助开发者提升代码质量和安全性。 ... [详细]
  • 一、Tomcat安装后本身提供了一个server,端口配置默认是8080,对应目录为:..\Tomcat8.0\webapps二、Tomcat8.0配置多个端口,其实也就是给T ... [详细]
  • Hadoop的文件操作位于包org.apache.hadoop.fs里面,能够进行新建、删除、修改等操作。比较重要的几个类:(1)Configurati ... [详细]
  • 本文介绍了如何在 Vue 3 组合 API 中正确设置 setup() 函数的 TypeScript 类型,以避免隐式 any 类型的问题。 ... [详细]
  • 在JavaWeb开发中,文件上传是一个常见的需求。无论是通过表单还是其他方式上传文件,都必须使用POST请求。前端部分通常采用HTML表单来实现文件选择和提交功能。后端则利用Apache Commons FileUpload库来处理上传的文件,该库提供了强大的文件解析和存储能力,能够高效地处理各种文件类型。此外,为了提高系统的安全性和稳定性,还需要对上传文件的大小、格式等进行严格的校验和限制。 ... [详细]
  • 理解浏览器历史记录(2)hashchange、pushState
    阅读目录1.hashchange2.pushState本文也是一篇基础文章。继上文之后,本打算去研究pushState,偶然在一些信息中发现了锚点变 ... [详细]
  • 本文探讨了如何通过Service Locator模式来简化和优化在B/S架构中的服务命名访问,特别是对于需要频繁访问的服务,如JNDI和XMLNS。该模式通过缓存机制减少了重复查找的成本,并提供了对多种服务的统一访问接口。 ... [详细]
  • 本文将从基础概念入手,详细探讨SpringMVC框架中DispatcherServlet如何通过HandlerMapping进行请求分发,以及其背后的源码实现细节。 ... [详细]
  • 探索百度WebFE团队打造的强大HTML5上传插件Web Uploader
    本文将详细介绍由百度WebFE团队开发的Web Uploader,这是一款集成了HTML5与Flash技术的上传组件,以其卓越的用户体验和强大的功能著称。 ... [详细]
  • 本文介绍了如何解决 ChinaASP.Upload 错误 '80040002',即必须添加版权信息的问题,并提供了详细的步骤和注意事项。 ... [详细]
author-avatar
手机用户2502853847
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有