CoreOS 初识之安装

来源:互联网 发布:为数据而生 pdf 编辑:程序博客网 时间:2024/05/16 18:44

CoreOS 初识之安装

硬盘安装CoreOS,以下步骤经过VMware环境验证通过。步骤:

1、从如下地址下载CoreOS的镜像:https://coreos.com/docs/running-coreos/platforms/iso/
2、使用VMware等虚拟化软件建立虚拟机,以1步骤中下载到的镜像作为启动源。启动Live OS镜像。
3、系统启动后,修改root用户的密码:

coreos1

4、使用ssh客户端工具登录该Live系统,其中登录帐号为root。
5、准备翻墙方案,参考《如何使用Google等网站查资料》。
6、在Live系统里,配置wget的代理:
在/root目录下创建.wgetrc文件:

cd /rootvi .wgetrchttp-proxy=192.168.1.112:2516

保存后,退出即可。

7、准备用于CoreOS系统登录的ssh-key pair。使用ssh-keygen工具或者其他密钥对生成工具得到一个rsa格式的密钥。

8、配置cloud-config.yaml,在/root目录下创建该文件。内容为:

#cloud-config hostname: myhost coreos:    etcd:        addr: $private_ipv4:4001    peer-addr: $private_ipv4:7001  units:    - name: etcd.service      command: start    - name: fleet.service      command: start    - name: static.network      content: |        [Match]        Name=eno1         [Network]        Address=192.168.1.122/24        Gateway=192.168.1.1        DNS=192.168.1.2        DNS=192.168.1.3users:    - name: core    ssh-authorized-keys:       - ssh-rsa 你的public key   - groups:      - sudo      - docker

其中,ssh-rsa字段后面填写第7步骤得到的密钥对的公钥。

9、在当前Live系统中执行如下命令来安装CoreOS系统到硬盘:

root@localhost ~ # coreos-install -d /dev/sda -C stable -c ./cloud-config.yamlDownloading the signature for http://stable.release.core-os.net/amd64-usr/444.5.0/coreos_production_image.bin.bz2...2014-11-16 14:54:12 URL:http://stable.release.core-os.net/amd64-usr/444.5.0/coreos_production_image.bin.bz2.sig [543/543] ->;; "/tmp/coreos-install.VCqFgBwwkh/coreos_production_image.bin.bz2.sig" [1]Downloading, writing and verifying coreos_production_image.bin.bz2...

执行安装命令后,工具会自动到网站下载CoreOS的硬盘镜像,并安装到硬盘上面。由于使用了代理服务器,因此安装过程非常缓慢,等待足够长的时间后,会提示安装成功。重启系统,默认情况下是从硬盘启动刚安装好的CoreOS。系统会cloud-config.yaml的配置来生成core用户的登录密钥,启动完成后登录。

10、使用core用户,在xshell工具即可登录。必须使用密钥方式才能登录,其中加载的userkey为7步骤中生成的私钥。

0 0
原创粉丝点击