π Panduan Lengkap Instalasi Ruby, Jekyll & GitHub Pages
20 Feb 2025
π Panduan step-by-step membuat personal website statis menggunakan Ruby, Jekyll, dan GitHub Pages. Ideal untuk pemula dan menengah.
π§° 1. Persiapan Awal
β Cek Ruby
- Cek apakah Ruby sudah terpasang
Buka terminal atau Command Prompt, lalu ketik:ruby -v
Jika Ruby sudah terpasang, maka akan muncul versi Ruby. Jika belum, ikuti langkah berikutnya.
- Cek RubyGems
Ketik perintah berikut:gem -v
- Cek GCC dan Make
Ketik perintah berikut:gcc -v g++ -v make -v
Jika belum tersedia, install melalui:
π¦ MinGW
π§ sudo apt install build-essential (Linux)
Download Ruby Installer
- Buka link berikut: https://rubyinstaller.org
- Pilih versi Ruby 2.7.0 atau lebih tinggi.
- Ikuti instruksi instalasi hingga selesai.
β Install Jekyll & Bundler bash Copy Edit gem install jekyll bundler
π οΈ Install Pendukung π‘ Git (Version Control) bash Copy Edit git βversion π Download Git lalu install sesuai OS kamu.
π§βπ» VSCode (Text Editor) π Download VSCode
π Google Chrome (Browser) π Download Chrome
Chrome
π Siapkan GitHub & Repository π Buat Akun GitHub π github.com
π§± Buat Repository Baru Gunakan format: username.github.io Contoh: faiza.github.io
π» Mulai Proyek Jekyll π Clone Repo GitHub bash Copy Edit git clone https://github.com/username/username.github.io.git cd username.github.io
π¦ Inisialisasi Bundler
bash
Copy
Edit
bundle init
Perintah ini akan membuat file Gemfile
di dalam folder proyek.
βοΈ Edit Gemfile Tambahkan:
ruby Copy Edit source βhttps://rubygems.orgβ gem βjekyllβ Install:
bash Copy Edit bundle install
π Buat index.html html Copy Edit <!DOCTYPE html>
Hello World from Jekyll π
This is a simple personal site powered by Jekyll and GitHub Pages.
π§ Jalankan Jekyll Secara Lokal π¨ Build bash Copy Edit jekyll build π Jalankan Server bash Copy Edit jekyll serve Buka di browser: π‘ http://localhost:4000
π‘ Live reload:
bash Copy Edit jekyll serve βlivereload
π§ 6. Linux Tips (Optional) Edit Gemfile.lock Tambahkan:
nginx Copy Edit PLATFORMS ruby x86_64-linux
---
β¬οΈ Push ke GitHub
bash
Copy
Edit
git add .
git commit -m "Initial Jekyll site"
git push origin main
---
βοΈ 8. Otomatisasi dengan GitHub Actions
Buat folder dan file:
bash
Copy
Edit
mkdir -p .github/workflows
touch .github/workflows/jekyll.yml
Isi file jekyll.yml:
yaml
Copy
Edit
name: Jekyll Deploy
on:
push:
branches:
- main
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Install dependencies
run: bundle install
- name: Build site
run: JEKYLL_ENV=production bundle exec jekyll build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: $
publish_dir: ./_site
Push kembali:
bash
Copy
Edit
git add .
git commit -m "Add CI/CD GitHub Actions"
git push origin main
---
π 9. Selesai!
β
Website kamu siap diakses via:
bash
Copy
Edit
https://username.github.io
---
π οΈ Troubleshooting
Masalah Solusi
β Port Konflik jekyll serve --host 0.0.0.0 --port 4001
β Build gagal Pastikan Ruby dan Bundler sudah terpasang
β GitHub Pages kosong Pastikan branch utama: main