LoginSignup
12
6

More than 5 years have passed since last update.

CentOS6系へのChrome/Chromiumのインストール

Posted at

E2Eテストのために開発環境(VirtualBox)のCentOS (6.9)にChromeをインストールしてheadlessモードで使おうとした際のメモ。

簡単に言うと、出来ません:sob:
方法はあるにはあるけれど、古いバージョンしか入らない感じ。

Chrome

まずChromeを入れようと試行錯誤して、
https://qiita.com/camopy/items/c7eda82f41c903bec298
にたどり着き試すものの、

エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libgtk-3.so.0()(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libatk-bridge-2.0.so.0()(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libc.so.6(GLIBC_2.14)(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libstdc++.so.6(GLIBCXX_3.4.14)(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libgdk-3.so.0()(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
エラー: パッケージ: google-chrome-stable-65.0.3325.146-1.x86_64 (google-chrome)
             要求: libc.so.6(GLIBC_2.15)(64bit)
 問題を回避するために --skip-broken を用いることができません

という感じのエラー。

libgtk-3系について更に調べたらCentOS6系はサポートされていないことが分かり断念。

更に
https://qiita.com/Tats_U_/items/b0c9077bf5a2111f8e2a#chrome%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB
にたどり着き
https://chrome.richardlloyd.org.uk/
に行くものの、こちらでもChrome version59以降GTK+3問題に行き当たりサポート終了したとのこと。

要はどんな方法にせよGTK+3が無いと駄目らしい。

Chromium

Chromeではなく、Chromiumというプロジェクトがあるらしい、と聞きそちらならインストールできるんじゃなか?と思って試してみる。

だれかが用意してくれたyumリポジトリもあるらしいけど、信用できるのか分からないし、メンテされるのかも分からないのでまずは公式の方法を試す。
http://www.chromium.org/getting-involved/download-chromium
にある
https://github.com/scheib/chromium-latest-linux
を使う。
gitリポジトリをダウンロードして update-and-run.sh を使ってみる。

インストールは成功:grin:
しかし、実行してみると、、、

error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

:sob:

libXssで調べると、どうやらlibXScrnSaverというのを入れればいいらしい。
これはyumでインストールできる:laughing:

sudo yum install libXScrnSaver

インストール出来た。改めて実行!

 error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file

:sob::sob::sob:

libatk-bridge-2を調べると、これもCentos6系にはない模様。。。

この方法は詰んだ。。。

仕方ないので
https://www.centos.org/forums/viewtopic.php?t=44855
とかで紹介されている信用できるかわからないyumレポジトリを使う方法を試してみる。

cd /etc/yum.repos.d
sudo wget http://people.centos.org/hughesjr/chromium/6/chromium-el6.repo
sudo yum install chromium

インストール出来た:tada:
待て待て、ちゃんと動くかな?
```
$ chromium-browser

Xlib: extension "RANDR" missing on display ":1".
[14:14:0312/093659:ERROR:base_feature_provider.cc(122)] manifestTypes: Allowing web_page contexts requires supplying a value for matches.
[12547:12547:0312/093659:ERROR:base_feature_provider.cc(122)] manifestTypes: Allowing web_page contexts requires supplying a value for matches.
Xlib: extension "RANDR" missing on display ":1".
```

ディスプレイがどうの、と言ってるけど動きそう!?
ディスプレイは無いからかな。headlessモードだとどうだろう?

$ chromium-browser --headless --disable-gpu --dump-dom https://www.google.co.jp/
Xlib:  extension "RANDR" missing on display ":1".

ん?やっぱり動かない?

バージョンいくつだろう?

$ chromium-browser --version
Chromium 31.0.1650.63 Built from source for CentOS release 6.5 (Final)

Chromium 31.0.1650.63 Built from source for CentOS release 6.5 (Final)

終了。。。




headlessモードが搭載されたのはChrome 59かららしい。
こんな古いバージョンではだめ。
そもそも色々試すためにも最新のchromeを入れたかった。。。

まとめ

自分はここでCentOS6にchrome/chromiumを入れるのは諦めました。
絶対に方法が無いかどうかは分かってませんので、更に色々挑戦してみることは止めません。

自分は、開発機(VirtualBox)のCentOSを7系にするか、開発時はホスト側(mac)上で動作させることを検討します。
なお、CI環境(CircleCI)ではデフォルトでchrome入ってそうだったのでこの苦労はなさそう。

12
6
0

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
12
6