본문 바로가기

CentOS

GitHub-Page (Jekyll 사용하기)

GitHub Page를 이용하기 위해 Jekyll 을 설치해보자.

Ruby를 먼저 설치해야 한다.

https://nyaaong.tistory.com/18

 

Ruby 설치하기

Github Page를 사용하기 위해 Jekyll가 필요해졌다. Jekyll을 설치하기에 앞서 Ruby부터 설치해보자. 설치 과정은 rbenv의 깃헙을 참조했다. https://github.com/rbenv/rbenv#basic-github-checkout rbenv/rbenv G..

blog.asusual.dev

 

bundler를 설치해야 한다. 공식 홈페이지의 설명을 빌려오자면 지옥과도 같은 ruby 프로젝트의 의존성 관리에서 벗어나게 해준단다.

https://bundler.io/

 

Bundler: The best way to manage a Ruby application's gems

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and product

bundler.io

# gem install bundler

 

Jekyll을 설치하자.

https://jekyllrb.com/

 

Jekyll • Simple, blog-aware, static sites

Transform your plain text into static websites and blogs

jekyllrb.com

# gem install jekyll

 

준비가 끝났다.

 

우선 샘플 페이지를 생성해보자. 적당한 경로로 이동한 뒤 프로젝트를 생성한다.

# cd /home/dev/
# jekyll new [프로젝트명].github.io

생성이 완료되었다면, 해당 폴더로 이동 후 임시로 웹 서버를 띄워 페이지가 제대로 표시되는지 확인해본다.

# cd [프로젝트명].github.io
# bundle exec jekyll serve

로그를 읽어보면 알겠지만, 기본값으로 로컬호스트로만 접속이 가능하다. 만약 원격 접속이 필요하다면 -H옵션을 붙여주자.

# bundle exec jekyll serve -H 0.0.0.0

웹브라우저로 접속하면 샘플 페이지가 보인다.

 

이제 git에 올려 github page로 접속이 되는지 확인해보자.

 

우선 github에 새 레파지토리를 생성한다.

 

repository 이름은 [username].github.io 이어야 한다.

 

다시 터미널로 돌아와 remote 를 추가하고 push 하자.

# git init
# git add .
# git commit -m 'first commit'
# git remote add origin https://github.com/[repository 주소].git
# git push -u origin master

 

GitHub의 repository 셋팅 화면으로 넘어가서

 

GitHub Pages가 활성화 되어 있는지 확인한다.

이제 웹 브라우저에서 url(repository 이름)로 접속해보면 테스트 서버로 띄웠던 페이지와 같은 페이지가 뜨는 것을 확인할 수 있다.

 

끝!

 

 

 

 

 

 

 

 

 

 

'CentOS' 카테고리의 다른 글

Let's Encrypt Wildcard Domain SSL 인증서 발급  (0) 2020.03.28
docker-compose 설치하기  (0) 2020.03.23
Docker 설치  (0) 2020.03.13
Ruby 설치하기  (0) 2020.03.08
SSL 무료 인증서 발급하기  (0) 2020.03.06