갈루아의 반서재

rbenv 를 이용하여 Ruby 설치시 아래와 같은 에러가 발생하며 설치가 실패하는 경우의 처리법

curl: (77) error setting certificate verify locations:


에러 메시지는 다음과 같다.

1
2
3
4
5
6
7
8
9
10
root@localhost:~# rbenv install -v 2.4.1
/tmp/ruby-build.20170715173239.7567 ~
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
curl: (77) error setting certificate verify locations:
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
error: failed to download ruby-2.4.1.tar.bz2
 
BUILD FAILED (Ubuntu 14.04 using ruby-build 20170523-25-g476d09b)
cs


상기 에러는 curl 이 인증서가 /etc/pki/tls/certs/ca-bundle.crt 경로에 있다고 기대하지만 실제로는 /etc/ssl/certs/ca-certificates.crt 에 있기 때문에 발생하는 것이다.


다음과 같이 curl 이 기대하는 경로로 인증서를 복사한다. 목적지 경로에 해당 디렉토리가 없다면 아래와 같이 디렉토리를 만든 후 복사한다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
root@localhost:~# sudo mkdir -p /etc/pki/tls/certs
root@localhost:~# cd /etc/pki
root@localhost:/etc/pki# tree
.
├── nssdb -> /var/lib/nssdb
└── tls
    └── certs
 
3 directories, 0 files
root@localhost:/etc/pki# sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
root@localhost:/etc/pki# tree
.
├── nssdb -> /var/lib/nssdb
└── tls
    └── certs
        └── ca-bundle.crt
 
3 directories, 1 file
cs

정상적으로 Ruby 가 설치됨을 볼 수 있다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
Configuration summary for ruby version 2.4.1
 
   * Installation prefix: /root/.rbenv/versions/2.4.1
   * exec prefix:         ${prefix}
   * arch:                x86_64-linux
   * site arch:           ${arch}
   * RUBY_BASE_NAME:      ruby
   * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
   * site libraries path: ${rubylibprefix}/${sitearch}
   * vendor path:         ${rubylibprefix}/vendor_ruby
   * target OS:           linux
   * compiler:            gcc
   * with pthread:        yes
   * enable shared libs:  no
   * dynamic library ext: so
   * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -L/root/.rbenv/versions/2.4.1/lib  \
                          -fstack-protector -rdynamic -Wl,-export-dynamic
   * optflags:            -O3 -fno-fast-math
   * debugflags:          -ggdb3
   * warnflags:           -Wall -Wextra -Wno-unused-parameter \
                          -Wno-parentheses -Wno-long-long \
                          -Wno-missing-field-initializers \
                          -Wno-tautological-compare \
                          -Wno-parentheses-equality \
                          -Wno-constant-logical-operand -Wno-self-assign \
                          -Wunused-variable -Wimplicit-int -Wpointer-arith \
                          -Wwrite-strings -Wdeclaration-after-statement \
                          -Wimplicit-function-declaration \
                          -Wdeprecated-declarations \
                          -Wno-packed-bitfield-compat \
                          -Wsuggest-attribute=noreturn \
                          -Wsuggest-attribute=format
   * strip command:       strip --x
   * install doc:         yes
   * man page type:       doc
 
---
        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -std=gnu99
        XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE
        CPPFLAGS = -I/root/.rbenv/versions/2.4.1/include    -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/9.0.0
        DLDFLAGS = -L/root/.rbenv/versions/2.4.1/lib  -fstack-protector -pie
        SOLIBS = -lgmp
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.34.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
......................................
generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --install=all --rdoc-output=".ext/rdoc"
installing binary commands:   /root/.rbenv/versions/2.4.1/bin
installing base libraries:    /root/.rbenv/versions/2.4.1/lib
installing arch files:        /root/.rbenv/versions/2.4.1/lib/ruby/2.4.0/x86_64-linux
installing pkgconfig data:    /root/.rbenv/versions/2.4.1/lib/pkgconfig
installing command scripts:   /root/.rbenv/versions/2.4.1/bin
installing library scripts:   /root/.rbenv/versions/2.4.1/lib/ruby/2.4.0
installing common headers:    /root/.rbenv/versions/2.4.1/include/ruby-2.4.0
installing manpages:          /root/.rbenv/versions/2.4.1/share/man/man1
installing extension objects: /root/.rbenv/versions/2.4.1/lib/ruby/2.4.0/x86_64-linux
installing extension objects: /root/.rbenv/versions/2.4.1/lib/ruby/site_ruby/2.4.0/x86_64-linux
installing extension objects: /root/.rbenv/versions/2.4.1/lib/ruby/vendor_ruby/2.4.0/x86_64-linux
installing extension headers: /root/.rbenv/versions/2.4.1/include/ruby-2.4.0/x86_64-linux
installing extension scripts: /root/.rbenv/versions/2.4.1/lib/ruby/2.4.0
installing extension scripts: /root/.rbenv/versions/2.4.1/lib/ruby/site_ruby/2.4.0
installing extension scripts: /root/.rbenv/versions/2.4.1/lib/ruby/vendor_ruby/2.4.0
installing extension headers: /root/.rbenv/versions/2.4.1/include/ruby-2.4.0/ruby
installing default gems:      /root/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0 (build_info, cache, doc, extensions, gems, specifications)
                              bigdecimal 1.3.0
                              io-console 0.4.6
                              json 2.0.2
                              openssl 2.0.3
                              psych 2.2.2
                              rdoc 5.0.0
installing bundle gems:       /root/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0 (build_info, cache, doc, extensions, gems, specifications)
                              xmlrpc 0.2.1
                              power_assert 0.4.1
                              test-unit 3.2.3
                              net-telnet 0.1.1
                              rake 12.0.0
                              minitest 5.10.1
                              did_you_mean 1.1.0
installing rdoc:              /root/.rbenv/versions/2.4.1/share/ri/2.4.0/system
installing capi-docs:         /root/.rbenv/versions/2.4.1/share/doc/ruby
Installed ruby-2.4.1 to /root/.rbenv/versions/2.4.1
/tmp/ruby-build.20170715175344.9343 ~
~
cs