Installing Ruby 2.3.x on Ubuntu 18.04 is causing an error by the end of the installation process

前端 未结 7 902
孤城傲影
孤城傲影 2021-02-05 06:48

I recently updated my system to Ubuntu 18.04 LTS, and since then, the Ruby version seems to have updated to 2.5. The issue is that, when attempting to deploy a project that uses

相关标签:
7条回答
  • 2021-02-05 07:25

    Try this with rvm

    rvm install ruby-2.3.4
    

    Or perhaps try https://gorails.com/setup/ubuntu/18.04

    You probably are missing required libraries so try running these first:

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    
    sudo apt-get update
    sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs yarn
    
    0 讨论(0)
  • 2021-02-05 07:26

    Got it working also with RVM:

    1. sudo apt purge libssl-dev && sudo apt install libssl1.0-dev 2. rvm install 2.3.5 --autolibs=disable

    You must install RVM dependencies manually, otherwise, with autolibs enabled, RVM will try to update system dependencies and also libssl-dev (that you downgraded in the first step). If you don't want to manually install dependencies you can try to install Ruby with autolibs enabled, the installation will fail, at this point you have dependencies installalled, so you can downgrade libssl repeating all from step 1.

    0 讨论(0)
  • 2021-02-05 07:29

    In order to install libssl-dev on Ubuntu 20.04. Use this command to to do that. It worked for me: sudo apt install libssl-dev/focal

    0 讨论(0)
  • 2021-02-05 07:30

    I have a similar problem. Apparently the ruby version < 2.3 is incompatible with openssl 1.1 which come with the lastest versions of Ubuntu. Here i found a solution for ArchLinux, I tried this solution and ruby compiled fine, but i had a lot memory bugs in rails then my unique solution for now is use ruby > 2.4 until i found other solution.

    0 讨论(0)
  • 2021-02-05 07:34
    cd ~/src
     wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz
     tar xvzf openssl-1.0.2s.tar.gz
     cd openssl-1.0.2s
     mkdir ~/.rubies/openssl-1.0.2s
     ./config --prefix=$HOME/.rubies/openssl-1.0.2s --shared
     make
     make install
     RUBY_CONFIGURE_OPTS=--with-openssl-dir=$HOME/.rubies/openssl-1.0.2s rbenv install 2.3.1
    
    

    worked for me

    0 讨论(0)
  • 2021-02-05 07:38

    I had a same issue, though it seemed problem was in gcc, in my case problem was in libssl-dev, this is what helped me:

    sudo apt purge libssl-dev && sudo apt install libssl1.0-dev
    

    I use rbenv. If you use rvm, you might hit problem after running previous command:

    /usr/share/rvm/scripts/base: No such file or directory
    

    I recommend trying rbenv. After installing libssl1.0-dev, everything was flawless.

    0 讨论(0)
提交回复
热议问题