読者です 読者をやめる 読者になる 読者になる

エロサイトの作り方

2013年11月から勉強しながらエロサイトを作っています。

GMO VPSのUbuntu 12.04を14.04へメジャーアップデートさせる

Ubuntu

<全プラン対応>

Ubuntu 10.04 x64

Ubuntu 12.04 x64

VPS 料金・機能|GMOクラウドのVPS

GMO VPSUbuntuが12.04と古いんですよね。

なので使い始める前にメジャーアップデートが必要。

SSHでログイン

アップデート中に切断されると悲惨なことになる可能性があるので、KeepAliveオプションをつけてログインしておく。

$ ssh -o ServerAliveInterval=30 -l root xxx.xxx.xxx.xxx
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
root@xxx.xxx.xxx.xxx's password:

Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Sep 17 00:15:10 JST 2014

  System load:  0.04               Processes:           81
  Usage of /:   0.5% of 195.87GB   Users logged in:     0
  Memory usage: 0%                 IP address for eth0: xxx.xxx.xxx.xxx
  Swap usage:   0%

  Graph this data and manage this system at https://landscape.canonical.com/

アップデートコマンドを実行

# do-release-upgrade
...
Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN]

意訳)SSH経由で実行するのはオススメしねぇ。なんかあった用に1022ポートで予備のSSHを起動しておくけど、やっちまっていいんかい?

yで続行する。

 Starting additional sshd

 To make recovery in case of failure easier, an additional sshd will
 be started on port '1022'. If anything goes wrong with the running
 ssh you can still connect to the additional one.
 If you run a firewall, you may need to temporarily open this port. As
 this is potentially dangerous it's not done automatically. You can
 open the port with e.g.:
 'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'

 To continue please press [ENTER]

意訳)リカバリー用のSSHを立ち上げるぜ。もしポートが塞がっている場合はiptablesで空けといてくれよ。続けていいかい?

ENTERで続行する。

...
Do you want to start the upgrade?


3 packages are going to be removed. 103 new packages are going to be
installed. 352 packages are going to be upgraded.

You have to download a total of 177 M. This download will take about
1 minute with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d]

意訳)アップグレードされるパッケージはこれだけあるぜ。続けていいかい?

yで続行する。

...
Previous versions of openssh-server permitted logging in as root over SSH using password authentication. The default for new installations is now "PermitRootLogin without-password", which disables password authentication for root without breaking systems that have explicitly configured SSH public key authentication for root.

This change makes systems more secure against brute-force password dictionary attacks on the root user (a very common target for such attacks). However, it may break systems that are set up with the expectation of being able to SSH as root using password authentication. You should only make this change if you do not need to do that.

Disable SSH password authentication for root?

<Yes>  <No>

意訳)OpenSSHがrootでパスワードログインできるようになってて危険なんだが、無効にしてもいいかい?

これは今<Yes>にするとログインできなくなっちゃう系なので、<No>で続行する。

設定は後で変更する。

...
There are services installed on your system which need to be restarted when certain libraries, such as libpam, libc, and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart.  You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade.

Restart services during package upgrades without asking?

<Yes>  <No>

意訳)再起動が必要なサービスがあったらいちいち確認せずに勝手に再起動していいか?

<Yes>で続行する。

...
A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified.

What would you like to do about menu.lst?

          install the package maintainer's version
          keep the local version currently installed
          show the differences between the versions
          show a side-by-side difference between the versions
          show a 3-way difference between available versions
          do a 3-way merge between available versions (experimental)
          start a new shell to examine the situation


<Ok>

なんか「うちゅうのほうそくがみだれた」状態だった。

f:id:hentai-kun:20140917013316p:plain

意訳)/boot/grub/menu.lst(ブートマネージャのファイル)の新しいバージョンがあるんだが、書き換えるかい?

keep the local version currently installed(今のものを使う)のままでENTERで続行する。

...
A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified.

What would you like to do about menu.lst?

          install the package maintainer's version
          keep the local version currently installed
          show the differences between the versions
          show a side-by-side difference between the versions
          show a 3-way difference between available versions
          do a 3-way merge between available versions (experimental)
          start a new shell to examine the situation


<Ok>

あれ、もう一回出てきた。

TABでフォーカスを<OK>に移してENTERなのかな。

Updating /boot/grub/menu.lst ... done

進んだ。

...
Remove obsolete packages?


15 packages are going to be removed.

 Continue [yN]  Details [d]

要らないパッケージを消していいか?なので、yで続行する。

...
System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN]

ドッキドキの再起動。

yで続行する。

Broadcast message from root@sub**********
        (/dev/pts/2) at 1:07 ...

The system is going down for reboot NOW!
=== Command terminated normally (Wed Sep 17 01:07:22 2014) ===Connection to xxx.xxx.xxx.xxx closed by remote host.
Connection to xxx.xxx.xxx.xxx closed.

SSHが切断された。

しばらく待ってSSHで再度ログイン

$ ssh -o ServerAliveInterval=30 -l root xxx.xxx.xxx.xxx
root@xxx.xxx.xxx.xxx's password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Sep 17 01:07:55 JST 2014

  System load: 1.18               Memory usage: 2%   Processes:       97
  Usage of /:  0.9% of 195.87GB   Swap usage:   0%   Users logged in: 0

  => There is 1 zombie process.

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Last login: Wed Sep 17 00:20:53 2014 from xxx.xxx.xxx.xxx

接続できた。

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:  Ubuntu 14.04.1 LTS
Release:  14.04
Codename: trusty

無事バージョンも上がっている。

よかったよかった……

  => There is 1 zombie process.

ん?

 # ps aux | grep 'Z'
 USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 root      1093  0.0  0.0  10464   896 pts/0    S+   01:14   0:00 grep --color=auto Z

いなくなってる……

まあ、いいか。

最後にマイナーアップデートをする

# aptitude update
...
Fetched 1,825 kB in 16s (114 kB/s)

# aptitude upgrade
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

あれっ、これはやらなくても良かったのかな?