Web Backend/Ruby on Rails

루비온레일즈 개발환경구성하기 (feat.Windows)

xProgrammer 2022. 5. 16. 00:00

Ubuntu설치(WSL)
1.설정 > 업데이트 및 보안 > 개발자용 > 개발자모드 선택
2.제어판 > 프로그램 > Windows 기능 켜기/끄기 > Linux용 Windows 하위 시스템 체크 > 재시작
3.Micorosft Store에서 Ubuntu 검색 > Ubuntu 20.04.4 LTS 다운로드 > 열기 > 계정생성
4.시작 > cmd > bash

의존환경설치

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev

rbenv, ruby-build설치

cd
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

Ruby설치

rbenv install 3.1.2
rbenv global 3.1.2
ruby -v
gem install bundler
rbenv rehash

* rbenv install 이 엄청오래걸린다.

NodeJS, Yarn설치

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update
sudo apt-get install -y nodejs yarn

Rails설치

gem install rails -v 7.0.2.4
rbenv rehash
rails -v

VSCode설치
https://code.visualstudio.com/download

 

Download Visual Studio Code - Mac, Linux, Windows

Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.

code.visualstudio.com

Visual Studio Code Remote Development Extension Pack
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack

샘플프로젝트만들기
ctrl + shift + `: 새로운 터미널

rails new helloworld
cd helloworld
rails s

프로젝트생성확인