LoginSignup
6

More than 5 years have passed since last update.

CloudAtCostにRancherOSをインストール

Last updated at Posted at 2015-12-08

インストール

現在の設定確認

  • CloudAtCost上のLinuxで作業。
  • IPアドレス、デフォルトゲートウェイをメモっておく。
  • Releases · rancher/os · GitHubからrancheros.isoをダウンロード
dd if=rancheros.iso of=/dev/sda bs=1M;sync;
  • OS再起動させるとRancherOSが起動します。

パーティション設定

パーティション
$ sudo fdisk -l /dev/sda

Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3c394a3d

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *          0    59391    59392   29M 17 Hidden HPFS/NTFS
/dev/sda2         59392  1038335   978944  478M 82 Linux Swap
/dev/sda3       1038336 20971519 19933184  9.5G 83 Linux
/dev/sda2をext4でフォーマット
mkswap /dev/sda2
mkfs.ext4 -L RANCHER_STATE /dev/sda3
reboot

IPアドレス設定

/usr/share/ros/os-config.yml
   network:
     dns:
       nameservers: [8.8.8.8, 8.8.4.4]
     interfaces:
-      eth*:
-        dhcp: true
+      eth0:
+        address: 222.222.222.222/24
+        gateway: 222.222.222.221
  • reboot

debian-consoleに切り替え

ros service enable debian-console
reboot

swap自動マウント

/etc/rc.local
+ /sbin/swapon /dev/sda2
  exit 0

sshd_config修正

/etc/ssh/sshd_config
- #PasswordAuthentication yes
+ PasswordAuthentication no

状態確認(debian-console上)

ディスク
$ df -h 
Filesystem      Size  Used Avail Use% Mounted on
overlay         9.3G  438M  8.4G   5% /
devtmpfs        233M     0  233M   0% /dev
tmpfs           247M     0  247M   0% /sys/fs/cgroup
/dev/sda3       9.3G  438M  8.4G   5% /opt
none            247M  236K  247M   1% /run
shm              64M     0   64M   0% /dev/shm
メモリ
$ free -m
             total       used       free     shared    buffers     cached
Mem:           492        278        214        108         10        186
-/+ buffers/cache:         80        411
Swap:          477          0        477

ファイアウォール(ufw)

sudo apt-get install -y ufw
/etc/default/ufw
- IPV6=yes
+ IPV6=no
ファイアウォール設定
ufw default deny
ufw allow 22
ufw enable
/etc/rc.local
+ /usr/sbin/ufw enable
ファイアウォール状態
# ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing)
New profiles: skip

To                         Action      From
--                         ------      ----
22                         ALLOW IN    Anywhere

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6