Install Ruby on Rails with Jemalloc on Linux Ubuntu

Ruby on Rails with Jemalloc on Linux Ubuntu

Install Ruby on Rails with Jemalloc on Linux Ubuntu

Install Ruby on Rails with Jemalloc on Linux Ubuntu

First of all we need to update & upgrade ubuntu packages :

sudo apt update && sudo apt upgrade

Then install its dependencies :

sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev libjemalloc-dev git -y

Next, clone rbenv repository from github :

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

And then add rbenv  path to bashrc :

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Now install ruby :

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.4

rbenv global 2.6.4

Verify if ruby was properly installed with :

ruby -v

Next verify if jemalloc was also properly installed :

ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"

-lpthread -ljemalloc -lgmp -ldl -lcrypt -lm # -ljemalloc should appear on the output

Configure gem default install without rdoc :

echo "gem: --no-document" > ~/.gemrc

Install bundler gem :

gem install bundler

Install rails gem :

gem install rails

rbenv rehash

Finally let’s generate new rails app :

rails new myapp

0

Share this post


%d bloggers like this: