πŸš€ 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

  1. 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.

  2. Cek RubyGems
    Ketik perintah berikut:
    gem -v
    
  3. 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

βœ… 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>

My Jekyll Site

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