How to install Puppet R10k service on Rocky 9
If you happen to manage your server infrastructure with Puppet, you will sooner or later stumble into R10k, which is rather useful to deploy your Puppet code from the git repository to the puppet server(s).
I am in the process of moving to Rocky 9 and upgrading Puppet to version 8, and naturally you start first with the Puppet server. The easiest way of setting this up is using Foreman, which can be used as ENC, but even if you wanna go Puppet and Hiera, you still can use Foreman as monitoring solution. This setup is described here and is real quick.
R10k is normally easily installed via gem:
§ gem install R10
However, in my case it started giving me some errors:
/usr/share/ruby/mkmf.rb:471:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/share/ruby/mkmf.rb:597:in
block in try_compile'
from /usr/share/ruby/mkmf.rb:544:in with_werror' from /usr/share/ruby/mkmf.rb:597:in
try_compile'
from /usr/share/ruby/mkmf.rb:661:in try_cflags' from /usr/share/ruby/mkmf.rb:667:in
block (2 levels) in append_cflags'
from /usr/share/ruby/mkmf.rb:971:in block in checking_for' from /usr/share/ruby/mkmf.rb:361:in
block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:331:in open' from /usr/share/ruby/mkmf.rb:361:in
block in postpone'
from /usr/share/ruby/mkmf.rb:331:in open' from /usr/share/ruby/mkmf.rb:357:in
postpone'
from /usr/share/ruby/mkmf.rb:970:in checking_for' from /usr/share/ruby/mkmf.rb:666:in
block in append_cflags'
from /usr/share/ruby/mkmf.rb:665:in each' from /usr/share/ruby/mkmf.rb:665:in
append_cflags'
from extconf.rb:7:in `'
Took me a while to find the solution. To save you some time: INstall ruby-devel and gcc, which are developer tools required to run ruby gems properly. Afterwards, r10k should install easily.
§ dnf install ruby-devel gcc