Installation Guide for DC916 Website
This guide provides detailed instructions for setting up and running the DC916 website locally on your machine. Follow these steps to get the development environment up and running.
Table of Contents
- Prerequisites
- Installation Steps
- Running the Website
- Common Issues & Troubleshooting
- Development Tips
Prerequisites
Before you begin, you’ll need to install the following software:
Windows
- Install Ruby+Devkit:
- Download the Ruby+Devkit installer from RubyInstaller
- Choose a version >= 2.5.0 (recommended: 3.0.x or newer)
- During installation, select “Add Ruby executables to your PATH” and “Associate .rb and .rbw files with Ruby”
- At the end of the installation, run the
ridk installstep and select option 3
- Verify Installation:
ruby -v gem -v
macOS
- Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install Ruby:
brew install ruby - Add Ruby to your PATH:
- For Zsh (default in macOS Catalina and newer):
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc source ~/.zshrc - For Bash:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
- For Zsh (default in macOS Catalina and newer):
- Verify Installation:
ruby -v gem -v
Linux
- Install Ruby and development dependencies:
- For Ubuntu/Debian:
sudo apt-get update sudo apt-get install ruby-full build-essential zlib1g-dev - For Fedora/CentOS/RHEL:
sudo dnf install ruby ruby-devel make gcc gcc-c++ zlib-devel
- For Ubuntu/Debian:
- Configure Gem installation path:
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc source ~/.bashrc - Verify Installation:
ruby -v gem -v
Installation Steps
Once you have Ruby installed, follow these steps to set up the DC916 website:
- Install Jekyll and Bundler:
gem install jekyll bundler - Clone the repository:
git clone https://github.com/CyberSecSacramento/Cybersecurity-Sacramento.git cd Cybersecurity-Sacramento - Install dependencies:
- If a Gemfile exists:
bundle install - If no Gemfile exists, create one:
echo "source 'https://rubygems.org'" > Gemfile echo "gem 'jekyll'" >> Gemfile echo "gem 'jekyll-seo-tag'" >> Gemfile bundle install
- If a Gemfile exists:
Running the Website
After installation, you can run the website locally:
- Start the Jekyll server:
bundle exec jekyll serve -
View the website in your browser at
http://localhost:4000 - Live reload (optional):
- To enable automatic page refresh when files are modified:
bundle exec jekyll serve --livereload
- To enable automatic page refresh when files are modified:
- Build for production (optional):
- To generate the static site without starting a server:
bundle exec jekyll build - The generated site will be in the
_sitedirectory
- To generate the static site without starting a server:
Common Issues & Troubleshooting
Ruby Version Issues
Problem: Jekyll requires Ruby version 2.5.0 or higher.
Solution: Check your Ruby version with ruby -v and upgrade if necessary.
Permission Errors
Problem: “Permission denied” errors when installing gems. Solution:
- On Unix-based systems, use
sudo gem install jekyll bundler - Alternatively, set up a user-level gem installation directory as shown in the Linux instructions
Dependency Conflicts
Problem: Bundler reports conflicts between dependencies. Solution:
bundle update
bundle install
Port Already in Use
Problem: “Address already in use - bind(2) for 127.0.0.1:4000” error. Solution:
- Kill the process using the port:
lsof -i :4000thenkill -9 [PID] - Or use a different port:
bundle exec jekyll serve --port 4001
SSL Certificate Issues
Problem: SSL certificate verification errors when installing gems. Solution:
gem sources -r https://rubygems.org/
gem sources -a http://rubygems.org/
Development Tips
Jekyll Commands
- Create a new post:
bundle exec jekyll post "My New Post" - Create a new page:
bundle exec jekyll page "My New Page" - Build with drafts:
bundle exec jekyll serve --drafts
Directory Structure
Understanding Jekyll’s directory structure can help with development:
graph TD
A[Root Directory] --> B[_config.yml: Configuration]
A --> C[_layouts/: HTML templates]
A --> D[_includes/: Reusable components]
A --> E[_posts/: Blog posts]
A --> F[_drafts/: Unpublished posts]
A --> G[_data/: Data files]
A --> H[_site/: Generated site]
A --> I[assets/: Static files]
A --> J[index.md: Home page]
Liquid Syntax
Jekyll uses Liquid templating language. Here are some common patterns:
- Variables:
Installation Guide for DC916 Website - Filters:
Hello - Tags:
- Loops:
Front Matter
Every content file should begin with front matter:
---
layout: default
title: My Page
permalink: /my-page/
---
If you encounter any issues not covered in this guide, please open an issue on the repository.