Created
August 1, 2014 09:17
-
-
Save hagix9/f99e5eec94507edf2635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.CoreOSのダウンロード | |
mkdir -p /opt/virt/kvm/ ; cd /opt/virt/kvm/ | |
wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 -O - | bzcat > core01.img | |
#wget http://beta.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 -O - | bzcat > core01.img | |
#wget http://stable.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2 -O - | bzcat > core01.img | |
2.XMLの作成 | |
vi core01.xml | |
<domain type='kvm'> | |
<name>coreos01</name> | |
<memory unit='KiB'>2097152</memory> | |
<currentMemory unit='KiB'>2097152</currentMemory> | |
<vcpu placement='static'>1</vcpu> | |
<os> | |
<type arch='x86_64' machine='pc'>hvm</type> | |
<boot dev='hd'/> | |
</os> | |
<features> | |
<acpi/> | |
<apic/> | |
<pae/> | |
</features> | |
<clock offset='utc'/> | |
<on_poweroff>destroy</on_poweroff> | |
<on_reboot>restart</on_reboot> | |
<on_crash>restart</on_crash> | |
<devices> | |
<emulator>/usr/bin/kvm-spice</emulator> | |
<disk type='file' device='disk'> | |
<driver name='qemu' type='qcow2'/> | |
<source file='/opt/virt/kvm/core01.img'/> | |
<target dev='vda' bus='virtio'/> | |
</disk> | |
<controller type='usb' index='0'> | |
</controller> | |
<interface type='network'> | |
<mac address='00:16:3e:ee:4d:cd'/> | |
<source network='default'/> | |
<model type='virtio'/> | |
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> | |
</interface> | |
<serial type='pty'> | |
<target port='0'/> | |
</serial> | |
<console type='pty'> | |
<target type='serial' port='0'/> | |
</console> | |
<input type='tablet' bus='usb'/> | |
<input type='mouse' bus='ps2'/> | |
<graphics type='vnc' port='-1' autoport='yes'/> | |
<sound model='ich6'> | |
</sound> | |
<video> | |
<model type='cirrus' vram='9216' heads='1'/> | |
</video> | |
<memballoon model='virtio'> | |
</memballoon> | |
</devices> | |
</domain> | |
3. Cloud-Initの設定 | |
guestmount -a core01.img -m /dev/sda9 -i --rw /mnt | |
mkdir /mnt/var/lib/coreos-install | |
vi /mnt/var/lib/coreos-install/user_data | |
#cloud-config | |
###/var/lib/coreos-install/user_data | |
hostname: core01 | |
users: | |
- name: core | |
passwd: $1$9993efE7$fwSl9DXl9XuDfD.9hsg8V. | |
#openssl passwd -1 | |
ssh_authorized_keys: | |
- ssh-rsa AAA.... | |
coreos: | |
etcd: | |
name: core01 | |
discovery: https://discovery.etcd.io/09a6f403a70b856d2651de6d96e1877b | |
addr: 192.168.10.100:4001 | |
peer-addr: 192.168.10.100:7001 | |
bind-addr: 0.0.0.0 | |
peer-heartbeat-interval: 200 | |
peer-election-timeout: 1000 | |
fleet: | |
public-ip: 192.168.10.100:4001 | |
agent_ttl: 120s | |
units: | |
- name: etcd.service | |
command: start | |
- name: docker.service | |
command: start | |
- name: fleet.service | |
command: start | |
write_files: | |
- path: /etc/systemd/network/10-static.network | |
content: | | |
[Match] | |
#Name=ens* | |
Name=eth0 | |
[Network] | |
Address=192.168.10.100/24 | |
Gateway=192.168.10.1 | |
DNS=192.168.10.1 | |
# - path: /etc/environment | |
# permissions: 0644 | |
# content: | | |
# export http_proxy=http://111.1.5.6:8888 | |
# export https_proxy=http://111.1.5.6:8888 | |
# export no_proxy=127.0.0.1,localhost,192.168.10.100,192.168.10.101,192.168.10.102 | |
# | |
# - path: /etc/profile.d/proxy.sh | |
# permissions: 0755 | |
# content: | | |
# export http_proxy=http://111.1.5.6:8888 | |
# export https_proxy=http://111.1.5.6:8888 | |
# export no_proxy=127.0.0.1,localhost,192.168.10.100,192.168.10.101,192.168.10.102 | |
# | |
# - path: /etc/systemd/system/docker.service | |
# content: | | |
# [Unit] | |
# Description=Docker Application Container Engine | |
# Documentation=http://docs.docker.io | |
# Requires=docker.socket | |
# | |
# [Service] | |
# Environment="HTTP_PROXY=http://111.1.5.6:8888" | |
# Environment="HTTPS_PROXY=http://111.1.5.6:8888" | |
# Environment="TMPDIR=/var/tmp/" | |
# ExecStartPre=/bin/mount --make-rprivate / | |
# LimitNOFILE=1048576 | |
# LimitNPROC=1048576 | |
# # Run docker but don't have docker automatically restart | |
# # containers. This is a job for systemd and unit files. | |
# ExecStart=/usr/bin/docker -d -s=btrfs -r=false -H fd:// | |
# | |
# [Install] | |
# WantedBy=multi-user.target | |
# | |
# - path: /etc/systemd/system/etcd.service | |
# content: | | |
# [Unit] | |
# Description=etcd | |
# | |
# [Service] | |
# User=etcd | |
# PermissionsStartOnly=true | |
# Environment="HTTP_PROXY=http://111.1.5.6:8888" | |
# Environment="HTTPS_PROXY=http://111.1.5.6:8888" | |
# Environment=ETCD_DATA_DIR=/var/lib/etcd ETCD_NAME=default | |
# ExecStart=/usr/bin/etcd | |
# Restart=always | |
# RestartSec=10s | |
# | |
# [Install] | |
# WantedBy=multi-user.target | |
# | |
# - path: /etc/systemd/system/fleet.service | |
# content: | | |
# [Unit] | |
# Description=fleet | |
# Wants=etcd.service | |
# After=etcd.service | |
# | |
# [Service] | |
# Environment="HTTP_PROXY=http://111.1.5.6:8888" | |
# Environment="HTTPS_PROXY=http://111.1.5.6:8888" | |
# ExecStart=/usr/bin/fleet | |
# Restart=always | |
# RestartSec=10s | |
# | |
# [Install] | |
# WantedBy=multi-user.target | |
cd ; umount /mnt | |
5.インストール | |
virsh create core01.xml | |
6.ログイン | |
ssh [email protected] | |
#.おまけ | |
cat /run/systemd/system/etcd.service.d/20-cloudinit.conf | |
systemctl daemon-reload | |
systemctl restart etcd | |
journalctl -f -u etcd | |
cp /usr/lib/systemd/system/etcd.service /etc/systemd/system/ | |
systemctl daemon-reload | |
systemctl restart fleet | |
journalctl -f -u fleet | |
#仮想マシンをクローンした場合 | |
rm /etc/machine-id | |
systemd-machine-id-setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment