EC2 Amazon Linux 2でgem qiita_markdownがインストールできない
解決したいこと
Railsでアプリを作っていて、Amazon Lightsailインスタンス(EC2)にデプロイしています。
Rubyのgem、qiita_markdownをAmazon EC2 Amazon Linux 2で使いたいのですが、bundle installが通りません。
https://github.com/increments/qiita-markdown
インスタンス情報
Amazon Linux 2
2 GB RAM、1 vCPU、60 GB のSSD
Gemfile
gem 'qiita-markdown'
発生している問題・エラー
sudo yum install cmakeをしてbundle installをすると、下記のようになります。
.
.
.
Fetching rugged 1.3.1
Installing rugged 1.3.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    current directory: /home/ec2-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rugged-1.3.1/ext/rugged
/home/ec2-user/.rbenv/versions/2.7.2/bin/ruby -I /home/ec2-user/.rbenv/versions/2.7.2/lib/ruby/2.7.0 -r ./siteconf20220219-1146-ir5a3f.rb extconf.rb
checking for gmake... yes
checking for cmake... yes
checking for pkg-config... yes
CMake Error at CMakeLists.txt:14 (CMAKE_MINIMUM_REQUIRED):
  CMake 3.5.1 or higher is required.  You are running version 2.8.12.2
-- Configuring incomplete, errors occurred!
 -- /usr/bin/gmake
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/ec2-user/.rbenv/versions/2.7.2/bin/$(RUBY_BASE_NAME)
    --with-sha1dc
    --without-sha1dc
    --use-system-libraries
extconf.rb:23:in `sys': ERROR: '/usr/bin/gmake' failed (RuntimeError)
    from extconf.rb:107:in `block (2 levels) in <main>'
    from extconf.rb:103:in `chdir'
    from extconf.rb:103:in `block in <main>'
    from extconf.rb:100:in `chdir'
    from extconf.rb:100:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
  /home/ec2-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rugged-1.3.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rugged-1.3.1 for inspection.
Results logged to /home/ec2-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/rugged-1.3.1/gem_make.out
An error occurred while installing rugged (1.3.1), and Bundler cannot continue.
Make sure that `gem install rugged -v '1.3.1' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
  qiita-markdown was resolved to 0.40.0, which depends on
    github-linguist was resolved to 4.8.18, which depends on
      rugged
これが問題なのかなと思っています。
CMake 3.5.1 or higher is required.  You are running version 2.8.12.2
$ cmake --version
cmake version 2.8.12.2
自分で試したこと
このコマンドが正しいのかわかりませんが、cmakeをバージョンを指定してインストールしようとしましたが、下記の通りダメでした。
$ sudo yum install cmake 3.5.1
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                                                              | 3.7 kB  00:00:00
amzn2extra-docker                                                                                                                                                                       | 3.0 kB  00:00:00
amzn2extra-nginx1                                                                                                                                                                       | 3.0 kB  00:00:00
amzn2extra-postgresql12                                                                                                                                                                 | 3.0 kB  00:00:00
epel/x86_64/metalink                                                                                                                                                                    | 6.9 kB  00:00:00
epel-debuginfo/x86_64/metalink                                                                                                                                                          | 6.2 kB  00:00:00
epel-source/x86_64/metalink                                                                                                                                                             | 6.6 kB  00:00:00
epel-testing/x86_64/metalink                                                                                                                                                            | 5.6 kB  00:00:00
epel-testing-debuginfo/x86_64/metalink                                                                                                                                                  | 5.0 kB  00:00:00
epel-testing-source/x86_64/metalink                                                                                                                                                     | 5.5 kB  00:00:00
nodesource                                                                                                                                                                              | 2.5 kB  00:00:00
yarn                                                                                                                                                                                    | 2.9 kB  00:00:00
217 packages excluded due to repository priority protections
パッケージ cmake-2.8.12.2-2.amzn2.0.2.x86_64 はインストール済みか最新バージョンです
パッケージ 3.5.1 は利用できません。
何もしません
ローカル開発環境
ちなみに、ローカル開発環境ではbrew install cmakeをしてうまくいっています。
$ cmake --version
cmake version 3.22.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
お力添えいただけますと幸いです。
よろしくお願いします。
0 likes
