Configuration Notes

Jekyll Blog Environment Setup Notes

Recently set up a server for my blog. After waiting several days with no response on Alibaba Cloud ICP filing review, I switched to an Alibaba Cloud Hong Kong server. With no heavy workloads, I used the cheapest 1-core, 1 GB RAM plan. The server mainly hosts my personal blog and documentation, built with Jekyll, which requires Ruby 3+. I ran into some pitfalls along the way—documented here.

Park

Park

Configuration Notes

Written on

Share
Jekyll Blog Environment Setup Notes

Recently set up a server for my blog. After waiting several days with no response on Alibaba Cloud ICP filing review, I switched to an Alibaba Cloud Hong Kong server. With no heavy workloads, I used the cheapest 1-core, 1 GB RAM plan.

The server mainly hosts my personal blog and documentation, built with Jekyll, which requires Ruby 3+. I ran into some pitfalls along the way—documented here.

Alibaba ECS commonly runs Ubuntu or CentOS. Notes for both are included:

Installing Jekyll on Ubuntu

Environment

  • Ubuntu 22.04 LTS
  • Alibaba ECS HK

Install Ruby

First install dependencies:

sudo apt update
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev

Then install rbenv using curl:

curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash

Add ~/.rbenv/bin to your PATH and reload:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc

Then run in the terminal:

type rbenv

If the output looks like this, rbenv is configured successfully:

Output
rbenv is a function
rbenv ()
{
    local command;
    command="${1:-}";
    if [ "$#" -gt 0 ]; then
        shift;
    fi;
    case "$command" in
        rehash | shell)
            eval "$(rbenv "sh-$command" "$@")"
        ;;
        *)
            command rbenv "$command" "$@"
        ;;
    esac
}

Install Ruby with rbenv

First list available Ruby versions:

rbenv install -l

Output:

3.0.6
3.1.4
3.2.2
jruby-9.4.3.0
mruby-3.2.0
picoruby-3.0.0
truffleruby-23.0.0
truffleruby+graalvm-23.0.0

Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all / -L' to show all local versions.

I installed 3.2.2:

rbenv install 3.2.2

This downloads the Ruby source and compiles it—a very long process. It took me about half an hour, depending on your machine.

After a successful compile and install, set the default Ruby version:

rbenv global 3.2.2

Check the Ruby version:

ruby -v

Output:

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

Install Jekyll

With the correct Ruby version, installing Jekyll is straightforward. In China, network speed is usually the main factor. Documented here for future reference.

Tip: use gem env to inspect Ruby and gem environment variables.

Install bundler—mainly used when Jekyll runs plugins and dependencies:

gem install bundler

Install jekyll 4.3.2:

gem install jekyll

After installation, check the version:

jekyll -v #output jekyll 4.3.2

Installing Jekyll on CentOS 8

Install Dependencies

dnf install epel-release -y
dnf install gcc make git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel -y

Install Yarn

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
dnf install yarn -y	

Install Ruby with Rbenv

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

List available versions:

rbenv install -l

Install a specific version:

rbenv install 3.2.2

Set the default version:

rbenv global 3.1.2

Verify installation:

ruby -v

Typora + Image Hosting

I use Upyun's free storage with 10 GB of monthly traffic. I previously used Qiniu Cloud; after switching to Upyun, image loading feels much faster. PicGo + Typora lets you paste local images and automatically upload them, generating links.

PicGo configuration:

<img src="https://img.pixpark.net/image-20240310091704993.png" style="display: block; margin: 0 auto; width:80%; height=auto">

Typora configuration:

<img src="https://img.pixpark.net/image-20240310091732525.png" style="display: block; margin: 0 auto; width:80%; height=auto">

Closing Thoughts

That covers the blog setup. I chose a Hong Kong ECS because no ICP filing is required, and the site is accessible worldwide—no more Ruby download timeouts on domestic networks.

It feels freeing and comfortable.

One more thing: use tools you are familiar with. Don't switch just because someone says something else is better—try it yourself. Unless there is a clear advantage, stick with what you know; switching wastes time.

Time to start writing. Goal: keep this site running for 10 years.