Install the necessary dependencies for rbenv and Ruby.
sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libffi-dev libyaml-dev
Clone the rbenv repository from GitHub and add it to your shell.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
~/.rbenv/bin/rbenv init
Clone the ruby-build repository into the rbenv plugins directory
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
List all available Ruby versions.
rbenv install -l
Install your desired Ruby version, this project support ruby 2.5+ <=3
rbenv install 2.7.8 (this install ruby in your system, you can verify installation with ruby -v)
gem install bundler
Rehash rbenv to ensure it recognizes the new Ruby installation. (optional, might be useful in WSL in case of error)
rbenv rehash
bundle install
bundle exec middleman server
bundle exec middleman build