markdown 使用coreos设置hetzner机器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用coreos设置hetzner机器相关的知识,希望对你有一定的参考价值。

This gist describes how to set up a new machine running coreos.

# Create an ssh key

```
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_kartoza99
```

Get the public key:

```
cat ~/.ssh/id_rsa_kartoza99.pub
```

Which should look something like this:

```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD1ITKW9bFItMTZtMCIWZTpIZLstYxBoq2ccwkAPElw9WQmJxItHWdbIrkQ87FSDpaxQhD6tqnkisx4OQ+0oDxnYIf16eNvEGS1ab+lQy/wZnRQHbtvJ/uHTqRctfqorKozt1m2yuTFISEtmGzjfcb02tKigOXls2O8kqHvYHzxo+d044vXxaHb7538iGqmBzUwYiLcaNC3xuM2pqBpTTjcz7Pn1C8mynmrUxt0CUwjagaWJtrWgM42M5RYWzJPNUJwxsdwlbjn8v7VsqyWyZ+7QzLKgbZ/8C5VUbGCCVGRJj3tJxUsptf75BETvZtd0dLubRADXhsA5Y/4lotyRNdZ timlinux@channel
```

**Note:** The key above is just a dummy I made for this walkthrough, it is not actually used anywhere in production.

Also add an entry for your server to your ~/.ssh/config file like this:

```
Host kartoza99
   User core
   IdentityFile /home/timlinux/.ssh/id_rsa_kartoza99
   Port 22
   HostName 1.2.3.4
```

*change `1.2.3.4` to the IP of your server


# Create a coreos node key

Go to https://discovery.etcd.io/new and you will be issued a key e.g.

```
https://discovery.etcd.io/72521f10095c8e57b6885852ad46bbee
```

**Note:** The key above is just a dummy I made for this walkthrough, it is not actually used anywhere in production.


# Generate the coreos config file

Log in to a rescue system on your server and create a coreos config file (``config.yml``) like this:

```
#cloud-config

hostname: demo

ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD1ITKW9bFItMTZtMCIWZTpIZLstYxBoq2ccwkAPElw9WQmJxItHWdbIrkQ87FSDpaxQhD6tqnkisx4OQ+0oDxnYIf16eNvEGS1ab+lQy/wZnRQHbtvJ/uHTqRctfqorKozt1m2yuTFISEtmGzjfcb02tKigOXls2O8kqHvYHzxo+d044vXxaHb7538iGqmBzUwYiLcaNC3xuM2pqBpTTjcz7Pn1C8mynmrUxt0CUwjagaWJtrWgM42M5RYWzJPNUJwxsdwlbjn8v7VsqyWyZ+7QzLKgbZ/8C5VUbGCCVGRJj3tJxUsptf75BETvZtd0dLubRADXhsA5Y/4lotyRNdZ timlinux@channel

coreos:
    etcd:
        - https://discovery.etcd.io/72521f10095c8e57b6885852ad46bbee

```

# Setup coreos

**PLEASE NOTE: Your entire hard drive will be wiped!!!!**

```
wget https://raw.githubusercontent.com/coreos/init/master/bin/coreos-install
chmod +x coreos-install
./coreos-install -d /dev/sda -C stable -c config.yml
```

After a little while you should see this:

```
Success! CoreOS stable current is installed on /dev/sda
```


# Reboot and test login

```

```

then from your local machine:

```
ssh-keygen -f "/home/foouser/.ssh/known_hosts" -R 1.2.3.4
ssh kartoza99
```

*change `1.2.3.4` to the IP of your server


# Set up your docker helpers

```
mkdir bin
cd bin
git clone https://github.com/kartoza/docker-helpers.git
cd -
rm ~/.bashrc
cat ../../usr/share/skel/.bashrc > ~/.bashrc
echo "export PATH=\$PATH:/home/core/bin/docker-helpers" >> ~/.bashrc
source ~/.bashrc
```

You will now be able to use my docker helpers as short cut commands (
see https://github.com/kartoza/docker-helpers/blob/master/README.md).


# Set up fig 

```
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-Linux-x86_64 > bin/fig
chmod +x bin/fig
echo "export PATH=\$PATH:/home/core/bin" >> ~/.bashrc
source ~/.bashrc
```


以上是关于markdown 使用coreos设置hetzner机器的主要内容,如果未能解决你的问题,请参考以下文章

markdown coreOS iTerm2 completition

markdown Docker CoreOS

markdown 安装Kubernetes CoreOS

coreOS 系统上的子域

构建官方CoreOS COSA 镜像并构建 CoreOS

aws opswork 是不是支持 CoreOS