I need to use Ruby in a severely constrained VM where rbenv may NOT be the best option.
This is not the best option permission wise.
sudo apt install ruby-dev sudo chmod -R 777 /var/lib/gems/3.0.0 sudo chmod -R 777 /usr/local/bin sudo apt install make sudo apt install build-essential gem install rails
https://guides.rubygems.org/command-reference/#gem-environment
gem environment
documentation https://docs.ruby-lang.org/en/3.0/Gem/ConfigFile.html
https://www.jedi.be/blog/2009/04/29/gem_home-and-gem_path-with-passenger/
cat ~/.gemrc
gives the correct config
--- gem: --no-rdoc --user-install
touch ~/.gemrc gem environment nano ~/.gemrc sudo apt install build-essential ruby-dev echo 'export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"' >> ~/.bashrc source ~/.bashrc
Using rake 13.0.6 Following files may not be writable, so sudo is needed: /usr/local/bin /var/lib/gems/3.0.0 Using concurrent-ruby 1.2.2 Using i18n 1.14.1 Fetching minitest 5.18.0 Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install
When I follow the above suggestion the installation completes successfully.
$ cat ~/bin/host_network
#!/usr/bin/bash sudo dhclient enp0s8 echo "connection established" ip a | grep -A 5 enp0s8
sudo apt install ruby-dev build-essential sudo apt install libyaml-dev sudo apt install libssl-dev libffi-dev libreadline-dev zlib1g-dev curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash rbenv install --verbose 3.2.2
RAILS_ENV=production bundle install rm ./config/credentials.yml.enc RAILS_ENV=production rails credentials:edit EDITOR="nano" bin/rails credentials:edit RAILS_ENV=production rails assets:precompile RAILS_ENV=production rails db:migrate RAILS_SERVE_STATIC_FILES=true RAILS_ENV=production rails s -b 0.0.0.0 -p 3001