Created
June 7, 2020 06:29
-
-
Save thinktanklinux/7161b90ddc546c94456bb70d34e96bb4 to your computer and use it in GitHub Desktop.
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
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 | |
git config --global color.ui true | |
git config --global user.name "YOUR NAME" | |
git config --global user.email "YOUR@EMAIL.com" | |
ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com" | |
cat ~/.ssh/id_rsa.pub | |
ssh -T git@github.com | |
gem install rails -v 6.0.2.2 | |
rbenv rehash | |
rails -v | |
sudo apt-get install mysql-server mysql-client libmysqlclient-dev | |
Setting Up PostgreSQL | |
For PostgreSQL, we're going to add a new repository to easily install a recent version of Postgres. | |
sudo apt install postgresql-11 libpq-dev | |
The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases. Feel free to replace chris with your username. | |
sudo -u postgres createuser chris -s | |
# If you would like to set a password for the user, you can do the following | |
sudo -u postgres psql | |
postgres=# \password chris | |
Final Steps | |
And now for the moment of truth. Let's create your first Rails application: | |
#### If you want to use SQLite (not recommended) | |
rails new myapp | |
#### If you want to use MySQL | |
rails new myapp -d mysql | |
#### If you want to use Postgres | |
# Note that this will expect a postgres user with the same username | |
# as your app, you may need to edit config/database.yml to match the | |
# user you created earlier | |
rails new myapp -d postgresql | |
# Move into the application directory | |
cd myapp | |
# If you setup MySQL or Postgres with a username/password, modify the | |
# config/database.yml file to contain the username/password that you specified | |
# Create the database | |
rake db:create | |
rails server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment