ubuntu いろいろ

ちょっと lightsail 上に ubuntu を setup しながら色々とメモ書きを。

# do-release-upgrade

あとは /etc 下の conflict を適当に解決1)していく。

visudo とかすると nano 起動しちゃうのを vi に変更する。

# update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor
) in manual mode

$EDOTIR とかでなく /usr/bin/editor なる symlink があるのね……

ufw よくわからん。

# apt install iptables-persistent

lightsail だと基本なにやっても ssh 接続で、所謂コンソールが取れない(取れる?)ので、iptables の設定は失敗するとヤバい。ので、snapshot 取るなりなんなりしてから作業。 INPUT のデフォルトポリシーを DROP にした時点で死んでしまう気がしたので /etc/iptables/rules.v4 とか /etc/iptables/rules.v6 とかをいじってリブートした。

……雑に ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime とかやってはイカンのか(別にそれでも動くんだろうけど……)

# ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Sep 17 01:13 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
# timedatectl set-timezone Asia/Tokyo
# ls -l /etc/localtime
lrwxrwxrwx 1 root root 32 Sep 17 12:00 /etc/localtime -> ../usr/share/zoneinfo/Asia/Tokyo
# date
Mon Sep 17 12:00:28 JST 2018

/etc/systemd/timesync.conf で同期先を設定できる模様

NTP=ip.addr.of.ntp
# systemctl restart systemd-timesyncd
# journalctl -e
  :
  :
Nov 18 12:13:12 ubuntu systemd[1]: Stopping Network Time Synchronization...
Nov 18 12:13:12 ubuntu systemd[1]: Stopped Network Time Synchronization.
Nov 18 12:13:12 ubuntu systemd[1]: Starting Network Time Synchronization...
Nov 18 12:13:12 ubuntu systemd[1]: Started Network Time Synchronization.
Nov 18 12:13:12 ubuntu systemd-timesyncd[2174]: Synchronized to time server ip.addr.of.ntp:123 (ip.addr.of.ntp).

別に必須じゃないけれど、今回使ってる lightsail インスタンスが mem:512 なので、この後ちょっとなんかしようとするとすぐメモリ不足で落ちるので……

# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
# chmod 600 /swapfile
# mkswap -L swap01 /swapfile
# swapon /swapfile
# free -m
              total        used        free      shared  buff/cache   available
Mem:            479          93         322           0          64         369
Swap:          1023           0        1023

1)
gentoo で言うところの dispatch-conf みたいな。
  • wiki/linux/ubuntu_misc
  • 最終更新: 2019/02/17 15:59