Ruby On Rails: Unterschied zwischen den Versionen
| Zeile 37: | Zeile 37: | ||
sudo apt-get update | sudo apt-get update | ||
sudo apt-get install git-core 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 nodejs yarn | sudo apt-get install git-core 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 nodejs yarn | ||
Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm. | |||
'''Choose one method.''' Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv. | |||
==Using rbenv (recommended)== | |||
Installing with rbenv is a simple two step process. First you install '''rbenv''', and then '''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 | |||
rbenv install 2.7.0 | |||
rbenv global 2.7.0 | |||
ruby -v | |||
The last step is to install Bundler | |||
gem install bundler | |||
rbenv users need to run '''rbenv rehash''' after installing bundler. | |||
Version vom 24. März 2020, 09:16 Uhr
Installation von Ruby on Rails auf Ubuntu 16.04
Quelle: https://gorails.com/setup/ubuntu/16.04
Aktuelleste Version: 2.7.0 (Stand 24.03.2020)
Overview
We will be setting up a Ruby on Rails development environment on Ubuntu 16.04 Xenial Xerus.
The reason we're going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it's a great one to start with.
You'll want to download the latest Desktop version here: http://releases.ubuntu.com/16.04/
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
Installing Ruby
The first step is to install some dependencies for Ruby and Rails.
To make sure we have everything necessary for Webpacker support in Rails, we're first going to start by adding the Node.js and Yarn repositories to our system before installing them.
sudo apt install curl 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-get update sudo apt-get install git-core 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 nodejs yarn
Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm.
Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.
Using rbenv (recommended)
Installing with rbenv is a simple two step process. First you install rbenv, and then 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
rbenv install 2.7.0 rbenv global 2.7.0 ruby -v
The last step is to install Bundler
gem install bundler
rbenv users need to run rbenv rehash after installing bundler.