CoreOS is a minimal Linux system that uses Linux containers to manage services at a higher level of abstraction. A single service's code and all dependencies are packaged within a container that can be run on one or many CoreOS machines.
CoreOS are essentially based on docker containers.
I invite you to read the CoreOS documentation on : https://coreos.com/docs/
I also invite you to watch a real case of deploying CoreOS : https://youtu.be/vEpV56iglyc
First download the last ISO file on CoreOS website.
When you booted on the system run this command to configure the proxy to be able to download all update and final install
sudo -i export http_proxy="http://proxy.YOURDOMAIN.lan:9876"
sudo -i export https_proxy="https://proxy.YOURDOMAIN.lan:9876"
By using this simple command you will install it on your disk however you need to configure a password first or you will be not able to login to the system
sudo -i coreos-install -d /dev/sda -C stableHere the option of COREOS-INSTALL
-d DEVICE Install CoreOS to the given device.-V VERSION Version to install (e.g. current)-C CHANNEL Release channel to use (e.g. beta)-o OEM OEM type to install (e.g. openstack)-c CLOUD Insert a cloud-init config to be executed on boot.-t TMPDIR Temporary location with enough space to download images.-v Super verbose,fordebugging.
-b BASEURL URL to the image mirror
CoreOS enable you to have a script configuration to allow you to quickly deploy it.
Here the documentation I use to write the config file : https://coreos.com/os/docs/latest/cloud-config.html#configuration-file
When running the fist installation I use this simple script :
#cloud-confighostname: NAME OF YOUR SERVERusers:- name: rootpasswd: $6$rounds=4096$MpWe4fTP6BKFuM$hp3jCdndGnuhMMi59cyXlHY7tewmCF8LLuClLhw0V8lvlLFRHXfWD4ujm3hM5gm5x9El06ubEAg1HulESKk081
This config file will just allow you to configure the root password to Soleil just after the installation.
to install CoreOS with the script run the this command
sudo -i coreos-install -d /dev/sda -C stable -c cloud-config-file
By default, All the installation are make on a single disk with no LVM on it, so I decide to put the /var on a second disk with LVM
Make sure to add the second disk to your CoreOS VM.
I make a configuration script after CoreOS have been booted to configure the disk and download the new configuration file to always mount the disk :
#!/bin/shif["$(id -u)"!="0"]; then
echo"This script must be run as root"1>&2
exit1
fiecho" Change the SSH KEY"
rm /etc/ssh/ssh_host_*systemctl restart sshd-keygen.serviceecho" Create the disk on LVM "
pvcreate /dev/sdbecho" Create the LVM, VG and LV "
vgcreate vg_var /dev/sdblvcreate -L 40G -n lv_var vg_varmkfs.ext4 /dev/vg_var/lv_varecho" Create mount point for the new disk on /media/data "
mkdir /media/dataecho" Mount the new LV to /media/data "
mount /dev/vg_var/lv_var /media/dataecho" modify the /var/lib/coreos-install/user_data to mount the new disk on every reboot "
wget http://10.101.0.106/coreos/cloud-config
cp /dev/null/var/lib/coreos-install/user_data
cat cloud-config >> /var/lib/coreos-install/user_dataHere the downloaded configuration file that mount the disk and enable docker :
#cloud-confighostname: cor-pdt-toolboxusers:- name: root
passwd: $6$rounds=4096$MpWe4fTP6BKFuM$hp3jCdndGnuhMMi59cyXlHY7tewmCF8LLuClLhw0V8lvlLFRHXfWD4ujm3hM5gm5x9El06ubEAg1HulESKk081
coreos:units:
- name: media-data.mount
command: start
content: |
[Mount]
What=/dev/vg_var/lv_var
Where=/media/data
Type=ext4
write_files:- path: /etc/systemd/system/docker.service.d/http-proxy.conf
owner: core:core
permissions:0644
content: |
[Service]
Environment="HTTP_PROXY=http://proxy.YOURDOMAIN.lan:9876"
Environment="HTTPS_PROXY=http://proxy.YOURDOMAIN.lan:9876"
- path: /etc/systemd/system/basic.target.wants/systemd-reboot.timer
content: |
[Unit]
Description=Daily reboot
[Timer]
OnCalendar=daily
[Install]
WantedBy=basic.target
coreos:units:
- name: docker.service
command: restartpvs
write_files:- path: /etc/ssh/sshd_config
permissions:0600
owner: root:root
content: |
# Use most defaultsforsshd configuration.
UsePrivilegeSeparation sandbox
Subsystem sftp internal-sftp
ClientAliveInterval180
UseDNS no
PermitRootLogin yes
PasswordAuthentication yes
write_files:- path: /etc/systemd/journald.conf
content: |
[Journal]
SystemMaxUse=50M
The CoreOS node are now ready to use