Bridgetown on Ubuntu
Install Ruby via rbenv #
The version of Ruby available via Ubuntu’s package manager is often out of date, so the best option is to install Ruby via rbenv. People often use rbenv anyway to manage multiple Ruby versions, which comes in handy when you need to run a specific Ruby version on a project.
First, update your package list:
sudo apt update
Next, install the dependencies required to install Ruby:
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
(If on an older Ubuntu version, libgdbm6
won’t be available. Try installing libgdbm5
instead.)
Once the dependencies download, you can install rbenv itself. Clone the rbenv repository from GitHub into the directory ~/.rbenv
:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Next, add ~/.rbenv/bin
to your $PATH
so that you can use the rbenv
command line utility. Do this by altering your ~/.bashrc
file so that it affects future login sessions:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Then add the command eval "$(rbenv init -)"
to your ~/.bashrc
file so rbenv
loads automatically:
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Next, apply the changes you made to your ~/.bashrc
file to your current shell session:
source ~/.bashrc
Verify that rbenv is set up properly by using the type
command, which will display more information about the rbenv
command:
type rbenv
Your terminal window will display the following:
rbenv is a function
…
Next, install the ruby-build
plugin. This plugin adds the rbenv install
command which simplifies the installation process for new versions of Ruby:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Now you can install a new Ruby version. At the time of this writing, Ruby 3.0.2 is the latest stable version. (Note: the installation may take a few minutes to complete.)
rbenv install 3.0.2
rbenv global 3.0.2
ruby -v
> ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [aarch64-linux]
(If for some reason bundler
isn’t installed automatically, run gem install bundler -N
)
And that’s it! Check out rbenv command references to learn how to use different versions of Ruby in your projects.
Install Node #
Node is a JavaScript runtime that can execute on a server or development machine. NPM is a package manager for JavaScript packages. You’ll need Node in order to install and use esbuild, the frontend asset compiler that runs alongside Bridgetown.
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
Install Bridgetown #
Now all that is left is to install Bridgetown!
gem install bridgetown -N -v 2.0.0.beta3
Create a new Bridgetown site at ./mysite
, as well as run bundle install
and
npm install
automatically:
bridgetown new mysite
cd mysite
Now you should be able to build the site and run a live-reload server:
bin/bridgetown start
Try opening the site up in http://localhost:4000. See something? Awesome, you’re ready to roll! If not, try revisiting your installation and setup steps, and if all else fails, reach out to the Bridgetown community for support.