LoginSignup
0
0

More than 5 years have passed since last update.

varnishをvagrantにインストールする

Posted at

「vagrantにcentos7とnginxをインストールして、ブラウザで表示するまで」の続きです。


前回、vagrantに構築したサーバ(centos7/nginx)に、varnishをインストールした際のメモ。

まず、vagrantにssh接続。

#ローカル
$ vagrant up
$ vagrant ssh

#vagrat
#ルートユーザ切り替え
$ sudo su -

varnishの公式サイトを参考にバージョン6をインストールする

公式通りに以下のコマンドを実行

$ sudo yum install pygpgme yum-utils

以下のエラーが発生。

You have enabled checking of packages via GPG keys. This is a good thing. 
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key


Alternatively you can specify the url to the key you would like to use
for a repository in the 'gpgkey' option in a repository section and yum 
will install it for you.

For more information contact your distribution or package provider.

Problem repository: pkg.uplex.de_rpm_7_uplex-varnish_x86_64_

エラー内のコマンドをおもむろに実行(テストサーバなので)

$ rpm --import public.gpg.key

エラー。なんか変なことやってますけど、この人っとターミナルに鼻で笑われる。

error: public.gpg.key: import read failed(2).

調べると、public.gpg.keyの部分に以下のようにrpmのkeyを指定すればいいらしい。

$ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

参考:
https://qiita.com/kkojima0127/items/8e5956299e6b89656e82

改めて以下コマンドを実行

$ sudo yum install pygpgme yum-utils

問題なくいけました。ありがとう参考サイト!

公式サイト通り、次の手順をおこなう。
次のコマンドで新規ファイルを作成する

$ vi /etc/yum.repos.d/varnishcache_varnish60.repo

内容はcentos7のものに変更。

[varnishcache_varnish60]
name=varnishcache_varnish60
baseurl=https://packagecloud.io/varnishcache/varnish60/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish60/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[varnishcache_varnish60-source]
name=varnishcache_varnish60-source
baseurl=https://packagecloud.io/varnishcache/varnish60/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish60/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

公式サイトの次の手順を行う
以下コマンドの実行

$ sudo yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish60'

公式によれば、これでインストールの準備ができたらしい。
varnishを以下のコマンドでインストールしてみる。(質問されたらとりあえず、y)

$ yum install varnish 

エラーがでる。

 Error: Package: varnish-6.0.0-1.el7.x86_64 (varnishcache_varnish60)
       Requires: jemalloc
 Error: Package: varnish-6.0.0-1.el7.x86_64 (varnishcache_varnish60)
       Requires: libjemalloc.so.1()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

epel-releaseなるものが必要らしい。
参考:https://serverfault.com/questions/655346/cannot-install-varnish-on-centos-7

$ yum install epel-release
# とりあえずの y

$ yum install varnish
# とりあえず、2回yしとく

インストールできたっぽい!
インストール&varnishのバージョン確認

$ varnishd -V
varnishd (varnish-6.0.0 revision     a068361dff0d25a0d85cf82a6e5fdaf315e06a7d)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS
0
0
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
0
0