Skip to content

Instantly share code, notes, and snippets.

@donrestarone
Last active March 17, 2020 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donrestarone/bdaabf4142952073510c8b39e64b48b3 to your computer and use it in GitHub Desktop.
Save donrestarone/bdaabf4142952073510c8b39e64b48b3 to your computer and use it in GitHub Desktop.
script for installing ruby with rbenv and rails 6 on raspbian
sudo apt-get install htop build-essential zlib1g-dev openssl libreadline6-dev git-core zlib1g libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf automake libtool bison libgecode-dev -y
sudo apt-get install libpq-dev
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
source ~/.bashrc
rbenv install 2.6.5
rbenv global 2.6.5
sudo apt-get update ; sudo apt-get upgrade -y --force-yes
sudo apt-get dist-upgrade -y
echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc
gem install execjs
sudo apt-get install nodejs
gem install rails
rbenv rehash
# depending on your rails application, you will need to change bcrypt in your gemfile to gem 'bcrypt', '3.1.12' :: this is for ARM support
# setup postgres
sudo apt install postgresql
# connect as postgres user
sudo su postgres
# drop into the psql CLI
psql
# create the role for pi in psql, so rails can create/manage databases. Note that postgres=# just means that these roles need to be typed into a psql console
postgres=# CREATE ROLE pi ;
postgres=# ALTER ROLE "pi" WITH LOGIN;
postgres=# ALTER USER "pi" CREATEDB;
# to quit out of the psql console
postgres=# \q
# to exit out of the postgres user and back into pi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment