Created
April 8, 2020 09:56
-
-
Save linuxbiekaisar/bc95aaf85a61a6b71c7ef8585937399c to your computer and use it in GitHub Desktop.
How to create Rails environment and deploy ruby on rails App on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Youtube: https://www.youtube.com/watch?v=kavvMVAHTlA | |
# !/bin/sh | |
# Installing Ruby | |
# =============== | |
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 | |
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.1 | |
rbenv global 2.7.1 | |
ruby -v | |
# Install Bundler | |
# =============== | |
gem install bundler | |
# Configuring Git | |
# =============== | |
git config --global color.ui true | |
git config --global user.name "YOUR NAME" //input name at YOUR NAME | |
git config --global user.email "YOUR@EMAIL.com" //input name at YOUR EMAIL | |
ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com" //input name at YOUR EMAIL | |
cat ~/.ssh/id_rsa.pub | |
ssh -T git@github.com | |
# Installing Rails | |
# ================ | |
gem install rails -v 6.0.2.2 | |
rails -v | |
# Setting Up MySQL | |
# ================ | |
sudo apt-get install mysql-server mysql-client libmysqlclient-dev | |
# Setting Up PostgreSQL | |
# ===================== | |
sudo apt install postgresql-11 libpq-dev | |
sudo -u postgres psql //# If you would like to set a password for the user, you can do the following | |
postgres=# \password chris | |
# Creating a New Rails Project | |
# ============================ | |
rails new sharkapp | |
cd sharkapp | |
rails server | |
# Rails binds to localhost by default, so you can now access your application by navigating your browser to locahost:3000. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment