For this we are going to use the Jekyll gem avoiding the usage of the distro packages.
The steps to follow are:
- install the required system packages using Ubuntu's apt tool
- configure paths/shell variables
- install Jekyll gem and Bundler
1. Install packages
We start installing the required dependencies to use Ruby Gems in our environment by install the following packages: sudo apt-get install ruby-full build-essential zlib1g-dev
This will provide:
ruby-full: “Ruby full installation (default version)”
build-essential: “This package contains an informational list of packages which are considered essential for building Debian packages.”
zlib1g-dev: “compression library - zlib is a library implementing the deflate compression method found in gzip and PKZIP.”
Now we need to install
ruby-bundler to manage Ruby application dependencies.
2. Configure Ruby Gems
Now we have the RubyGems environment in our system, we can check its setup using gem environment:
The problem is that as it can be seen with the
GEM PATHS environment
variable, our gems will be installed at a system wide location
/var/lib/gems/2.5.0 using root user privileges.
To avoid this, we set up a gem installation directory for our user account.
~/.profile, we add the following environment
# ... ######## # RUBY # ######## # Avoid installing Ruby Gems as the root user # Install Ruby Gems to ~/gems export GEM_HOME="$HOME/gems" export PATH="$HOME/gems/bin:$PATH"
And load the new configuration: source ~/.bashrc or source ~/.profile depending on which you used.
To check everything works right: gem environment should display the new configuration:
3. Install Jekyll
Finally we use the Jekyll package from the
RubyGems repository, that
we are sure it will contain the latest Jekyll version available,
in contrast with the Ubuntu packages repository which would probably
be many versions behind.
That shows us that, at the moment of writing this, gem version is:
3.8.5 while the apt version is:
We proceed to install the Jekyll gem and bundler to make it possible to work with different Jekyll instances at the same time gem install jekyll bundler
This is the full list of the commands used:
sudo apt-get install ruby-full build-essential zlib1g-dev sudo apt install ruby-bundler # check gem env gem environment # added to ~/.bashrc` or `~/.profile export GEM_HOME="$HOME/gems" export PATH="$HOME/gems/bin:$PATH" # use above vars source ~/.bashrc #or source ~/.profile # check new environment gem environment # obtain Jekyll gem info gem search --details --exact jekyll # install Jekyll gem install jekyll bundler
This is a pretty straightforward procedure to install any gem in Ubuntu, having installed the latest Jekyll available, minimizing the risks of interfering with the native package manager and reducing risks without using root privileges.
Now you have the latest Jekyll version available:
- APT packages info
apt: “Advanced Package Tool, or APT, is a free-software user interface that works with core libraries to handle the installation and removal of software on Debian, Ubuntu, and related Linux distributions.” https://en.wikipedia.org/wiki/APT_(Debian) ↩︎
- Install Jekyll CMS on Ubuntu 18.10 in 3 steps THE RIGHT WAY
- What Are The Supported Language Highlighters In Jekyll
- Accessing Specific Items From Data Files In Jekyll
- Jekyll Configuration File Options
- Understanding Jekyll Posts
- Jekyll basic concepts
- Multilingual Jekyll Without Plugins
- Host a Jekyll Website With Pretty Urls In Amazon S3 and Cloudfront
- Get A List Of Categories Based In Subfolders In Jekyll
- 5 Steps To Add Bootstrap 4 To Jekyll The Right Way
- Automated Deployment Of Jekyll Websites To Github Pages With A Git Push To Github
- How To Use Bower Scss With Jekyll
- How to implement breadcrumbs on a Jekyll site with nested categories
- How To Handle Adsense In A Jekyll Development Environment
- How To Prevent Content Displaying In A Jekyll Development Environment