Ubuntu 10.04 LTS (Lucid Lynx) AMI: Difference between revisions

 
(154 intermediate revisions by the same user not shown)
Line 1: Line 1:
[https://gienkin.jrc.or.jp/ http://s3.egrep.jp/jrclogo.gif]
'''EOLです'''
 
 


= 雑多なメモ =
= 雑多なメモ =
Line 8: Line 6:
== はじめの第一歩 ==
== はじめの第一歩 ==


<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
echo "Asia/Tokyo" | sudo tee /etc/timezone
echo "Asia/Tokyo" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
sudo dpkg-reconfigure --frontend noninteractive tzdata
Line 20: Line 18:
#  edit .bashrc
#  edit .bashrc
#    unset command_not_found_handle
#    unset command_not_found_handle
#    IGNOREEOF=26
# mkfs.ext3 /dev/sdf
# mkfs.ext3 /dev/sdf
# mkdir /opt
# mkdir /opt
Line 40: Line 39:
sudo aptitude install python-ipy
sudo aptitude install python-ipy
</syntaxhighlight>
</syntaxhighlight>
使わない Instance Store は mount しないようにしておきましょう。(メモリーの無駄なので)


== CloudFormation example for ubuntu ==
== CloudFormation example for ubuntu ==
Line 60: Line 61:
* ec2-init から cloud-init になって戸惑い
* ec2-init から cloud-init になって戸惑い
調査中...
調査中...
user-data で
<pre>
#cloud-config
apt_update: true
apt_upgrade: true
timezone: "Asia/Tokyo"
packages: 
- emacs23-nox
</pre>
(user-data に依存しすぎると、user-data がない IaaS の場合に困る。なので極力つかわないように考えるか...)


== 古い ec2-init からいただき ==
== 古い ec2-init からいただき ==
Line 68: Line 81:


ec2-set-hosts
ec2-set-hosts
<syntaxhighlight lang="python" enclose="pre">
<syntaxhighlight lang="python" enclose="div">
#!/usr/bin/python
#!/usr/bin/python
#
#
Line 97: Line 110:


base_url = 'http://169.254.169.254/%s/meta-data' % api_ver
base_url = 'http://169.254.169.254/%s/meta-data' % api_ver
my_hostname = urllib.urlopen('%s/local-hostname/' % base_url).read()
my_ip = urllib.urlopen('%s/local-ipv4/' % base_url).read()
my_ip = urllib.urlopen('%s/local-ipv4/' % base_url).read()
my_fqdn = os.popen("/bin/cat /etc/hostname").read().rstrip()
my_fqdn = os.popen("/bin/hostname -f").read().rstrip()
my_hostname = os.popen("/bin/hostname -s").read().rstrip()


# replace the ubuntu hostname in /etc/hosts
# replace the ubuntu hostname in /etc/hosts
Line 113: Line 126:
/usr/local/etc/bind/templates/hosts.tmpl
/usr/local/etc/bind/templates/hosts.tmpl
  127.0.0.1 localhost
  127.0.0.1 localhost
  #127.0.1.1 $hostname
  #127.0.1.1 $fqdn $hostname
  $localipv4 $fqdn  
  $localipv4 $fqdn $hostname
   
   
  # The following lines are desirable for IPv6 capable hosts
  # The following lines are desirable for IPv6 capable hosts
Line 126: Line 139:
ec2-set-dns-zone
ec2-set-dns-zone
(内部 DNS 設定用)(aptitude install python-ipy で IPy 導入前提)
(内部 DNS 設定用)(aptitude install python-ipy で IPy 導入前提)
<syntaxhighlight lang="python">
<syntaxhighlight lang="python" enclose="div">
#!/usr/bin/python
#!/usr/bin/python
#
#
Line 157: Line 170:
base_url = 'http://169.254.169.254/%s/meta-data' % api_ver
base_url = 'http://169.254.169.254/%s/meta-data' % api_ver
my_ip = urllib.urlopen('%s/local-ipv4/' % base_url).read()
my_ip = urllib.urlopen('%s/local-ipv4/' % base_url).read()
my_fqdn = os.popen("/bin/cat /etc/hostname").read().rstrip()
my_fqdn = os.popen("/bin/hostname -f").read().rstrip()
ip = IP(my_ip)
ip = IP(my_ip)
my_arpa = ip.reverseName().rstrip('.')
my_arpa = ip.reverseName().rstrip('.')
Line 254: Line 267:


hostname を設定する。
hostname を設定する。
  echo "host.example.com" | sudo tee /etc/hostname
  echo "host" | sudo tee /etc/hostname
  sudo /bin/hostname -F /etc/hostname
  sudo /bin/hostname -F /etc/hostname
'''host_name domain_name の debian 系の考え方'''
<pre>
/etc/hostname This file should only contain the hostname and not the full FQDN.
</pre>
FreeBSD の hostname 変数は FQDN 入れるんだがな。Linux というか debian の文化を調べてみよう...
[http://www.debian.org/doc/manuals/debian-reference/ch05.ja.html#_the_domain_name 第5章 ネットワークの設定]


EIPをアサインして、公開 DNS に登録する。
EIPをアサインして、公開 DNS に登録する。
* CDP ネタのメモ (CDPの卵)
テスト環境等で、グローバルネットワークでの名前空間(ドメイン名)が本番の名前空間(ドメイン名)と異なる環境の場合、本 Split DNS の構成に加えて mod_headers や varnish 等で Host ヘッダーを書き換え処理をする事と、レスポンスのURLを mod_substitute や mod_sed 等で書き換えする事により、サーバ内部の hostname を論理ドメイン名として抽象化して扱えるようになる。WordPress の様にドメイン名が Database 上に定義されている場合に便利。 (要検証)
varnish vcl はこんな感じか
<pre>
sub vcl_recv {
    set req.http.host = "www.example.com";
      :
    return (lookup);
}
</pre>
mod_sed の書き換えルールはこんな感じかな
<pre>
    <IfModule mod_sed.c>
      AddOutputFilter Sed html
      OutputSed "s/www\.example\.com/test.example.com/g"
    </IfModule>
</pre>


== hostname ==
== hostname ==
Line 292: Line 333:
は無視すれば良い。
は無視すれば良い。


でも、気になる場合は環境に合わせて、resolver 系コンフィグレーションを変更すれば良い。
でも、気になる場合は環境に合わせて、hosts や resolver 系コンフィグレーションを変更すれば良い。


EC2 では /etc/resolv.conf の domain と search 行を消すか、/etc/hostname のドメイン名を指定すれば良い。
debian, ubuntu では /etc/hosts をちゃんと書くこと。
IPADDRESS <host_name>.<domain_name> <host_name>
 
また /etc/resolv.conf の domain と search 行を消すか、ドメイン名を指定する。(DNS Resolver の挙動も合わせる意味で)


ec2 の dhcp 環境では、
ec2 の dhcp 環境では、
Line 338: Line 382:


どうも、/etc/sysctl.d/ に配置しても、ipv6 系は反映されないようだ。なので kernel option で殺す。
どうも、/etc/sysctl.d/ に配置しても、ipv6 系は反映されないようだ。なので kernel option で殺す。
大規模サーバの都市伝説 ;)
<pre>
kernel.sem=250 32000 128 1024
kernel.msgmni=256
kernel.shmmax=268435456
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65500
#
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.core.rmem_default=262144
net.core.wmem_default=262144
#
net.core.netdev_max_backlog=30000
net.core.somaxconn=65535
net.ipv4.tcp_max_orphans=262144
net.ipv4.tcp_max_syn_backlog=65535
net.ipv4.tcp_fin_timeout=3
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1
</pre>


== kernel options ==
== kernel options ==
Line 344: Line 416:
/etc/default/grub は /usr/sbin/update-grub-legacy-ec2 で読み込んでいるが、GRUB2 用がインストールされているので無視
/etc/default/grub は /usr/sbin/update-grub-legacy-ec2 で読み込んでいるが、GRUB2 用がインストールされているので無視


grub legacy では '# ' に仕込むという変な仕様
debian の grub legacy では '# ' に仕込むという変な仕様


/boot/grub/menu.lst を変更
/boot/grub/menu.lst を変更
Line 352: Line 424:


  sudo update-grub-legacy-ec2
  sudo update-grub-legacy-ec2
で反映
で反映????


☆注意☆
☆注意☆
Line 359: Line 431:
  install the package maintainer's version
  install the package maintainer's version
を選択すること。(でないと、これからの update の際に menu.lst が更新されない)
を選択すること。(でないと、これからの update の際に menu.lst が更新されない)
echo 'grub-legacy-ec2 grub/update_grub_changeprompt_threeway select install_new' | sudo debconf-set-selections
echo 'grub-legacy-ec2 grub/update_grub_changeprompt_threeway seen true' | sudo debconf-set-selections
これでは逝けないようだ...
<pre>
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_subst "grub/update_grub_changeprompt_threeway" BASENAME menu.lst
db_subst "grub/update_grub_changeprompt_threeway" FILE /var/run/grub/menu.lst
db_go || true
</pre>
こんなので試したが、対話メニューが出てしまうな? まだ調査中...
<pre>
ucf --purge /var/run/grub/menu.lst
ucfr --purge grub /var/run/grub/menu.lst
update-grub-legacy-ec2
</pre>


メモ
メモ
Line 378: Line 470:
* grub/update_grub_changeprompt_threeway: install_new
* grub/update_grub_changeprompt_threeway: install_new
</pre>
</pre>
export DEBIAN_FRONTEND=noninteractive


  man 1 ucf
  man 1 ucf
== apparmor ==
普通じゃない設定をしたら、整合性を合わせないといけない
<syntaxhighlight lang="text" enclose="div">
  /ebs/var/lib/mysql/ r,
  /ebs/var/lib/mysql/** rwk,
  /dev/shm/ rw,
  /dev/shm/** rwkl,
</syntaxhighlight>


== 定番パッケージ ==
== 定番パッケージ ==
=== cron-apt ===
=== cron-apt / unattended-upgrades ===
<syntaxhighlight>
<syntaxhighlight lang="text" enclose="div">
sudo aptitude install cron-apt
sudo aptitude install cron-apt
  edit .....
  edit .....
</syntaxhighlight>
</syntaxhighlight>
unattended-upgrades というのもあるのね。
このパッケージはデフォルトで入ってる模様。
cron-apt から unattended-upgrades に換えましたが、やっぱり微妙に使い勝手が悪いので、また cron-apt を使うことにしました。
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude install postfix
sudo aptitude install mailx
</syntaxhighlight>
[https://help.ubuntu.com/community/AutomaticSecurityUpdates AutomaticSecurityUpdates]
/etc/apt/apt.conf.d/10periodic
<pre>
APT::Periodic::Enable "1";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "5";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::RandomSleep "1800";
</pre>
/etc/apt/apt.conf.d/50unattended-upgrades
<pre>
Unattended-Upgrade::Allowed-Origins {
"Ubuntu lucid-security";
"Ubuntu lucid-updates";
};
</pre>
デバッグ
stamp_file を削除
<pre>
rm /var/lib/apt/periodic/*
</pre>
/etc/apt/apt.conf.d/10periodic に
<pre>
APT::Periodic::RandomSleep "18";    (実行待ち時間を短くする)
APT::Periodic::Verbose "1";            (デバッグログを表示)
</pre>
unattended-upgrade --dry-run -d


=== いろいろ ===
=== いろいろ ===
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude install php-pear
sudo aptitude install php-pear
sudo aptitude install apache2-prefork-dev
sudo aptitude install apache2-prefork-dev
Line 400: Line 548:
== Zimbra 系メモ ==
== Zimbra 系メモ ==
Sending Mail from Terminal (optional)
Sending Mail from Terminal (optional)
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
wget http://ubuntu.lnix.net/misc/mta-dummy/mta-dummy_1.0_all.deb  
wget http://ubuntu.lnix.net/misc/mta-dummy/mta-dummy_1.0_all.deb  
dpkg -i mta-dummy_1.0_all.deb
dpkg -i mta-dummy_1.0_all.deb
Line 410: Line 558:
== WordPress 系メモ ==
== WordPress 系メモ ==
とりあえずパッケージでいれて設定だけいただく
とりあえずパッケージでいれて設定だけいただく
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude -y install wordpress
sudo aptitude -y install wordpress
sudo /bin/bash /usr/share/doc/wordpress/examples/setup-mysql -n WORDPRESSDBNAME HOSTNAME
sudo /bin/bash /usr/share/doc/wordpress/examples/setup-mysql -n WORDPRESSDBNAME HOSTNAME
Line 422: Line 570:


node
node
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude install munin-node
sudo aptitude install munin-node
sudo aptitude install munin-plugins-extra
sudo aptitude install munin-plugins-extra
Line 429: Line 577:
sudo aptitude install libtext-csv-xs-perl
sudo aptitude install libtext-csv-xs-perl
</syntaxhighlight>
</syntaxhighlight>
(2012/11/06 の security patch で)
/var/lib/munin から /var/lib/munin-node に変わった


server
server
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude install munin
sudo aptitude install munin
</syntaxhighlight>
</syntaxhighlight>


お手軽 サービス・死活監視
お手軽 サービス・死活監視
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo aptitude install monit
sudo aptitude install monit
</syntaxhighlight>
</syntaxhighlight>
Line 471: Line 622:
bind ^h
bind ^h
bind h
bind h
</pre>
.tmux.conf (tmux の方が楽かな...)
<pre>
# Set the prefix to C-t.
#  for Emacsian
unbind C-b
set -g prefix C-t
bind C-t send-prefix
</pre>
</pre>


Line 477: Line 637:
Host *
Host *
   #ForwardAgent yes
   #ForwardAgent yes
   TCPKeepAlive yes
   TCPKeepAlive no
   ServerAliveInterval 15
   ServerAliveInterval 60
   ServerAliveCountMax 60
   ServerAliveCountMax 15
</pre>
</pre>


Line 486: Line 646:
  [http://www.varnish-cache.org/installation/ubuntu Installation on Ubuntu]
  [http://www.varnish-cache.org/installation/ubuntu Installation on Ubuntu]


<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
echo "deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-2.1" | sudo tee /etc/apt/sources.list.d/varnish.list
echo "deb http://repo.varnish-cache.org/ubuntu/ lucid varnish-2.1" | sudo tee /etc/apt/sources.list.d/varnish.list
wget -qO - http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
wget -qO - http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
Line 495: Line 655:


あんちょくな daily backup script
あんちょくな daily backup script
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
#!/bin/sh
#!/bin/sh


if [ "`/bin/cat /proc/partitions | /bin/fgrep sdp`" ]; then
if [ "`/bin/cat /proc/partitions | /bin/fgrep sdp`" ]; then
     /sbin/tune2fs -c -1 -i 0 /dev/sdp > /dev/null 2>&1
     /sbin/tune2fs -c -1 -i 0 /dev/sdp > /dev/null 2>&1
     /sbin/e2label /dev/sda1 uec-rootfs
     /sbin/e2label /dev/sda1 cloudimg-rootfs
     if [ "`/bin/cat /proc/mounts | /bin/fgrep sdp`" ]; then
     if [ "`/bin/cat /proc/mounts | /bin/fgrep sdp`" ]; then
echo "Warn: /dev/sdp is already mounted."
echo "Warn: /dev/sdp is already mounted."
Line 553: Line 713:
         "ec2:DescribeSnapshotAttribute",
         "ec2:DescribeSnapshotAttribute",
         "ec2:DescribeSnapshots",
         "ec2:DescribeSnapshots",
        "ec2:ModifySnapshotAttribute",
        "ec2:ResetSnapshotAttribute"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}
</pre>
ubuntu 12.04 Precise では boto が 2.2.2 になっていた。tag 系の処理が追加されていて、嬉しいのだけど、すこしはまった。
上記の Policy に tag 系を追加する事
<pre>
{
  "Statement": [
    {
      "Action": [
        "ec2:CreateSnapshot",
        "ec2:DeleteSnapshot",
        "ec2:DescribeRegions",
        "ec2:DescribeSnapshotAttribute",
        "ec2:DescribeSnapshots",
        "ec2:DescribeVolumes",
        "ec2:DescribeTags",
        "ec2:CreateTags",
         "ec2:ModifySnapshotAttribute",
         "ec2:ModifySnapshotAttribute",
         "ec2:ResetSnapshotAttribute"
         "ec2:ResetSnapshotAttribute"
Line 565: Line 752:


MySQL を noninteractive でインストール。(対話型でパスワードを聞かれるのを自動設定する)
MySQL を noninteractive でインストール。(対話型でパスワードを聞かれるのを自動設定する)
<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
echo 'mysql-server-5.1 mysql-server/root_password password PASSWORD' | sudo debconf-set-selections
echo 'mysql-server-5.1 mysql-server/root_password password PASSWORD' | sudo debconf-set-selections
echo 'mysql-server-5.1 mysql-server/root_password seen true' | sudo debconf-set-selections
echo 'mysql-server-5.1 mysql-server/root_password seen true' | sudo debconf-set-selections
Line 575: Line 762:




NICのアクセラレーション設定を無効にする
NICのアクセラレーション設定を無効にする (cloud-init の新バージョンと相性が悪い模様。これは rc.local に持って行くか...)
/etc/network/interfaces に追加
/etc/network/interfaces に追加
  post-up /usr/sbin/ethtool -K eth0 sg off
  post-up /usr/sbin/ethtool -K eth0 sg off
  post-up /usr/sbin/ethtool -K eth0 tso off
  post-up /usr/sbin/ethtool -K eth0 tso off


== root device 問題 ==
== root device 問題 ==
boot する root device の指定が LABEL=uec-rootfs になっている。
boot する root device の指定が LABEL=cloudimg-rootfs になっている。
想定している boot device 以外に DISK LABEL が uec-rootfs の volume が attach されている場合に不具合が起きる可能性があります。
('''最新の ubuntu AMI では LABEL=uec-rootfs から LABEL=cloudimg-rootfs に変わっているのを発見''')
想定している boot device 以外に DISK LABEL が cloudimg-rootfs の volume が attach されている場合に不具合が起きる可能性があります。
'''☆環境により boot しない場合有り 注意☆'''
'''☆環境により boot しない場合有り 注意☆'''


<syntaxhighlight>
<syntaxhighlight lang="bash" enclose="div">
sudo e2label /dev/sda1
sudo e2label /dev/sda1
ls -al /dev/disk/by-label
ls -al /dev/disk/by-label
</syntaxhighlight>
</syntaxhighlight>


 
<syntaxhighlight lang="bash" enclose="div">
<syntaxhighlight>
sudo e2label /dev/sda1 cloudimg-rootfs
sudo e2label /dev/sda1 uec-rootfs
sudo e2label /dev/sdp no-rootfs
sudo e2label /dev/sdp copy-of-uec-rootfs
</syntaxhighlight>
</syntaxhighlight>
という手もあるんだが... root device = boot device = /dev/sda1 に単純化したほうが事故が少ないと思う。
という手もあるんだが... root device = boot device = /dev/sda1 に単純化したほうが事故が少ないと思う。
Line 600: Line 786:
EC2 の環境では、ディスクドライブが明示的に指定でき、明示的にそのドライブ名にボリュームをアサインできるので、Disk Label にたよる必要はない。
EC2 の環境では、ディスクドライブが明示的に指定でき、明示的にそのドライブ名にボリュームをアサインできるので、Disk Label にたよる必要はない。


'''Ubuntu で LABEL=uec-rootfs にしている意味・意義がなくなるが、EBS backed AMI での運用の利便性(instance stop して volume 挿げ替え)と確実性を考えから root=/dev/sda1 固定にすべきに参萬点'''
'''Ubuntu で LABEL=cloudimg-rootfs にしている意味・意義がなくなるが、EBS backed AMI での運用の利便性(instance stop して volume 挿げ替え)と確実性を考えから root=/dev/sda1 固定にすべきに参萬点'''


/etc/fstab
/etc/fstab
  LABEL=uec-rootfs を /dev/sda1 に変更
  LABEL=cloudimg-rootfs を /dev/sda1 に変更


/boot/grub/menu.lst
/boot/grub/menu.lst
  root=LABEL=uec-rootfs を root=/dev/sda1 に変更
  root=LABEL=cloudimg-rootfs を root=/dev/sda1 に変更


  # kopt=root=LABEL=uec-rootfs ro
  # kopt=root=LABEL=cloudimg-rootfs ro
             |
             |
  # kopt=root=/dev/sda1 ro
  # kopt=root=/dev/sda1 ro
Line 615: Line 801:
いろんな議論があるようですが、私は現在の変化しつつある状況では保守的な選択をしますね。つまり、root=/dev/sda1 決めうち。
いろんな議論があるようですが、私は現在の変化しつつある状況では保守的な選択をしますね。つまり、root=/dev/sda1 決めうち。


 
'''☆注意☆''' kernel 3.x では /dev/xvda1 となる。(このあたりが、LABEL で指定するメリットではありますがね)
== todo ==
<syntaxhighlight>
echo 'deb http://apt.opscode.com/ lucid-0.10 main' | sudo tee /etc/apt/sources.list.d/opscode.list
wget -qO - http://apt.opscode.com/packages@opscode.com.gpg.key | sudo apt-key add -
sudo aptitude update
sudo aptitude -y install chef
</syntaxhighlight>


== limit 系 ==
== limit 系 ==
Line 631: Line 810:
/etc/security/limits.d/mylimits.conf
/etc/security/limits.d/mylimits.conf
<pre>
<pre>
* - stack -1
* soft core 0
root - nofile 524288
* hard core 0
root soft core 0
root hard core 0
* soft nofile 524288
* hard nofile 524288
root soft nofile 524288
root hard nofile 524288
* soft nproc unlimited
* hard nproc unlimited
root soft nproc unlimited
root hard nproc unlimited
* soft stack unlimited
* hard stack unlimited
root soft stack unlimited
root hard stack unlimited
* soft memlock unlimited
* hard memlock unlimited
root soft memlock unlimited
root hard memlock unlimited
* soft as unlimited
* hard as unlimited
root soft as unlimited
root hard as unlimited
</pre>
</pre>
== 12.04 LTS ==
メモ
[http://uec-images.ubuntu.com/releases/precise/release/ Ubuntu 12.04 (Precise Pangolin) LTS]
<pre>
[ec2ubuntu] Upgrade from Ubuntu 10.04 LTS to Ubuntu 12.04 LTS
It should be safe, yes.
As with any OS upgrade, you should do what you can to ensure the safety of
your data.  I would suggest:
  - shut down instance
  - snapshot root volume
  - start instance
  - sudo do-release-upgrade
If it goes south, please do open a bug.
Thanks.
</pre>
[https://help.ubuntu.com/community/UpgradeNotes UpgradeNotes - Community Ubuntu Documentation]
[https://help.ubuntu.com/community/PreciseUpgrades PreciseUpgrades - Community Ubuntu Documentation]
[https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuServer#From_10.04_to_12.04 PrecisePangolin/ReleaseNotes/UbuntuServer - Ubuntu Wiki]
[http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/ DNS in Ubuntu 12.04 | Stéphane Graber's website]
EC2 での 10.04 LTS -> 12.04 LTS
<pre>
sudo do-release-upgrade -d
</pre>
<pre>
(Third party sources disabled : 'software-properties' で後で処理)
((Configuring sysstat というダイアログで Yes 選択))
(Configuring phpmyadmin というダイアログで Yes 選択)
(Configuring libc6 というダイアログで Yes 選択)
((Configuring grub-pc というダイアログで install the package maintainer's version 選択))
((grub boot loader の install デバイス選択するかも))
(phpmyadmin の更新処理ではまる...)
(mysql-server が 5.1 から 5.5 になるので メタパッケージの確認を : aptitude install mysql-server mysql-client)
(reboot 前に resolver の対応やってるほうがよさげ) (resolv.conf -> ../run/resolvconf/resolv.conf)
(ALERT!  /dev/sda1 does not exist.  Dropping to a shell! で落ちるので、menu.lst を変えないといけない /dev/xvda1 )
(backport は変わってくれない)
(sudo dpkg-reconfigure mysql-server-5.5)
(sudo dpkg-reconfigure phpmyadmin)
</pre>
cloud-init で... (/var/log/boot.log)
<pre>
cloud-init-nonet waiting 120 seconds for a network device.
cloud-init-nonet gave up waiting for a network device.
</pre>
とかなって、network interface が上がってこなくて、timeout した後に上がる場合はこれがアヤシイ
<pre>
/etc/network/interfaces の IFACE OPTIONS を見直する。
post-up とかで独自の処理入れていて、何らかの理由で正常終了していない場合にこけるようだ。
</pre>
12.04 LTS で気がついた差異
<pre>
デフォ ext4
/etc/ec2_version を書き換え "Ubuntu 12.04 (Precise Pangolin)"
/etc/debian_version は wheezy/sid
fstab から proc の記述を削除
fstab /dev/xvda1 へ
fstab ext4 にしておく
menu.lst から xencons=hvc0 を削除
aptitude remove dhcp3-client dhcp3-common
dpkg --purge dhcp3-client
rm -rf dhcp3
aptitude remove lzma
dhclient.conf に IPv6 関連の設定が追加
aptitude install cloud-initramfs-growroot cloud-initramfs-rescuevol
/etc/init/cloud-run-user-script.conf を削除
IPv6 系はおとなしく生かせておく
dpkg -l|grep ^rc|awk '{printf("aptitude -y purge %s\n", $2)}'
/var/www が /srv/www へ (^^;;;
</pre>
チェックする事
<pre>
/etc/fstab チェック
find . -name "*.dpkg*" -ls  でコンフィグチェック
/etc/apt/apt.conf.d/01ubuntu.dpkg-remove 削除
/etc/apt/apt.conf.d/50unattended-upgrades.dpkg-old 削除
/etc/init/ureadahead.conf.dpkg-new 削除
(aptitude install acpid) HVMでないなら不要
(aptitude install whoopsie) 不要!
aptitude install fonts-ubuntu-font-family-console
aptitude install linux-image-extra-virtual
/etc/apt/preferences.d/backports 編集 (Pin: release a=precise-backports)
/etc/munin/plugins の ディスク名替える
(qw(aaa bbb)) 替える
/etc/default/whoopsie で false
</pre>
お掃除
<pre>
aptitude purge whoopsie
aptitude purge apport apport-symptoms python-apport
aptitude remove update-motd
aptitude remove radeontool
aptitude remove hal
aptitude remove hal-info
aptitude remove gcc-4.4-base
aptitude remove ecryptfs-utils
aptitude remove cryptsetup
aptitude remove cryptsetup-bin
aptitude remove cpu-checker
aptitude remove consolekit
aptitude remove iputils-arping
aptitude remove libck-connector0
aptitude remove libcryptsetup4
aptitude remove libecryptfs0
aptitude remove vbetool
aptitude remove smartdimmer
aptitude remove pm-utils
aptitude remove libx86-1
aptitude remove libhal1
aptitude remove fuse-utils
aptitude remove cpp-4.6
aptitude remove apparmor-utils
aptitude remove libapparmor-perl
aptitude remove libapparmor1
aptitude remove libgmp3c2
</pre>
MySQL-5.5 で InnoDB が...
<pre>
skip-innodb
default-storage-engine=MyISAM
</pre>
のパターンか
<pre>
$ sudo service mysql stop
$ sudo mv /var/lib/mysql/ib_logfile* /some/safe/location/
$ sudo service mysql start
</pre>
 [http://www.icoro.com/201109206113.html icoro : MySQLを5.5にアップデートしたら動かなくなったという話]
わかってるって
*** /dev/xvda1 will be checked for errors at next reboot ***
解消方法
<pre>
rm /var/lib/update-notifier/fsck-at-reboot
cd /usr/lib/update-notifier/
./update-motd-fsck-at-reboot
</pre>
ubuntu 決め打ちなら
lsb_release -cs
とかで、条件分岐して cookbook 変える
[http://www.pochi.cc/~sasaki/chalow/2012-05-07-3.html Ubuntu 10.04 LTS から Ubuntu 12.04 LTS へのアップグレード]
[http://abexsoft.blogspot.jp/2012/05/vpsubuntu10041204.html abexsoftのブログ: さくらVPSのUbuntuを10.04から12.04にアップデート]
== Backports ==
[https://help.ubuntu.com/community/UbuntuBackports UbuntuBackports]
[https://help.ubuntu.com/community/UbuntuUpdates UbuntuUpdates]
Proposed updates : Enabling the proposed updates repository can break your system. It is not recommended for inexperienced users.
/etc/apt/sources.list.d/backports.list
# deb http://archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
/etc/apt/preferences.d/backports
<pre>
Package: *
Pin: release a=lucid-backports
Pin-Priority: 100
</pre>
明示的に backports からinstall
aptitude  install -t lucid-backports mosh
(おまけMacOSX)
<pre>
brew update
brew install mobile-shell
mosh --ssh="ssh -i .ssh/keypair" ubuntu@host.example.jp
</pre>
(security groups で UDP 60000-61000 あける事)
== Opscode chef recipes ==
<syntaxhighlight lang="bash" enclose="div">
echo 'deb http://apt.opscode.com/ lucid-0.10 main' | sudo tee /etc/apt/sources.list.d/opscode.list
wget -qO - http://apt.opscode.com/packages@opscode.com.gpg.key | sudo apt-key add -
sudo aptitude update
sudo aptitude -y install chef
</syntaxhighlight>
ココでの設定を cookbook にまとめ中
[https://github.com/nxhack/chef nxhack / chef My recipes (opscode chef cookbooks) : Bootstrap - Configuration - Orchestration]