サーバから画面のキャプチャを撮る（AWS編）

#サーバから画面のキャプチャを撮る（AWS編）

[こっち](http://qiita.com/satthi/items/00522da320c7a365c019)の続きです。

空っぽのCentOSでできたんでAWS(Amazon Linux)でも行けるやんと意気込んだってところからスタートです。

##Xvfbのインストール
```
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install xorg-x11-server-Xvfb
Total download size: 3.8 M
Is this ok [y/d/N]:
```
OK問題なし。

##CutyCaptのインストール
```
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[ec2-user@ip-10-0-27-134 ~]$ sudo yum --enablerepo=epel install CutyCapt 
Error: Package: qt5-qtbase-gui-5.3.2-3.el6.x86_64 (epel)
           Requires: libgdk-x11-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.3.2-3.el6.x86_64 (epel)
           Requires: libxcb-icccm.so.4()(64bit)
Error: Package: qt5-qtbase-gui-5.3.2-3.el6.x86_64 (epel)
           Requires: libgtk-x11-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.3.2-3.el6.x86_64 (epel)
           Requires: libgdk_pixbuf-2.0.so.0()(64bit)
Error: Package: qt5-qtlocation-5.3.2-1.el6.x86_64 (epel)
           Requires: libgeoclue.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.3.2-3.el6.x86_64 (epel)
           Requires: libatk-1.0.so.0()(64bit)
```
いっぱい依存関係で怒られた・・・
###↓インストールしたもの
```
#atk
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/atk-1.30.0-1.el6.x86_64.rpm
#hicolor-icon-theme
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/hicolor-icon-theme-0.11-1.1.el6.noarch.rpm
#libgdk_pixbuf-2.0.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/gdk-pixbuf2-2.24.1-5.el6.x86_64.rpm
#libgdk-x11-2.0.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/gtk2-2.24.23-6.el6.x86_64.rpm
#libxcb-icccm.so.4()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xcb-util-wm-0.3.9-5.el6.x86_64.rpm
#libnm-glib.so.2()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/NetworkManager-glib-0.8.1-75.el6.x86_64.rpm
#libORBit-2.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/ORBit2-2.14.17-5.el6.x86_64.rpm
#libeggdbus-1.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/eggdbus-0.6-3.el6.x86_64.rpm
#libck-connector.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/ConsoleKit-libs-0.4.1-3.el6.x86_64.rpm
#ConsoleKit+libpolkit-gobject-1.so.0()(64bit)(相互依存のためまとめてインストール)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://ftp.muug.mb.ca/mirror/centos/6.6/os/x86_64/Packages/ConsoleKit-0.4.1-3.el6.x86_64.rpm ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/polkit-0.96-7.el6.x86_64.rpm
#libgconf-2.so.4()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/GConf2-2.28.0-6.el6.x86_64.rpm
#libgnome-keyring.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/gnome-keyring-2.28.2-8.el6_3.x86_64.rpm
#glib-networking
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/glib-networking-2.28.6.1-2.2.el6.x86_64.rpm
#libsoup-gnome-2.4.so.1()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/libsoup-2.34.3-2.el6.x86_64.rpm
#libgeoclue.so.0()(64bit)
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/geoclue-0.11.1.1-0.13.20091026git73b6729.el6.x86_64.rpm
#CutyCapt
[ec2-user@ip-10-0-27-134 ~]$ sudo yum --enablerepo=epel install CutyCapt

```
入った！

##試す
```
[ec2-user@ip-10-0-27-134 ~]$ xvfb-run --server-args="-screen 0, 1024x768x24" \
CutyCapt --url=http://yahoo.com/ --out=hoge.png
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setCompositionMode: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints

#少々エラーは出たが問題なく出ているっぽい
#何やら少々プラグイン関係が足りないようだが追い切れず・・・

[ec2-user@ip-10-0-27-134 ~]$ xvfb-run --server-args="-screen 0, 1024x768x24" \
CutyCapt --url=http://yahoo.co.jp/ --out=hoge.png
#エラーは出なかったが日本語が出ない

#フォントインストール
[ec2-user@ip-10-0-27-134 ~]$ sudo yum install vlgothic-fonts
[ec2-user@ip-10-0-27-134 ~]$ xvfb-run --server-args="-screen 0, 1024x768x24" \
CutyCapt --url=http://yahoo.co.jp/ --out=hoge.png
#日本語出力問題ない！
```

##まとめ
AWS(Amazon Linux)でもできた！

・・・やっぱCentOSとAmazon Linuxは似て非なるものですわ・・・