Skip to content

Instantly share code, notes, and snippets.

@gnh1201
Last active November 17, 2016 18:04
Show Gist options
  • Save gnh1201/1109b1aebe87a110208d6f555f080bac to your computer and use it in GitHub Desktop.
Save gnh1201/1109b1aebe87a110208d6f555f080bac to your computer and use it in GitHub Desktop.
Quickstart script for rails environment
# fork on https://github.com/rails/rails-dev-box/blob/master/bootstrap.sh
# The output of all these installation steps is noisy. With this utility
# the progress report is nice and concise.
function install {
echo installing $1
shift
apt-get -y install "$@" >/dev/null 2>&1
}
#echo adding swap file
#fallocate -l 2G /swapfile
#chmod 600 /swapfile
#mkswap /swapfile
#swapon /swapfile
#echo '/swapfile none swap defaults 0 0' >> /etc/fstab
echo updating package information
apt-add-repository -y ppa:brightbox/ruby-ng >/dev/null 2>&1
apt-get -y update >/dev/null 2>&1
install 'development tools' build-essential
install Ruby ruby2.3 ruby2.3-dev
update-alternatives --set ruby /usr/bin/ruby2.3 >/dev/null 2>&1
update-alternatives --set gem /usr/bin/gem2.3 >/dev/null 2>&1
echo installing Bundler
gem install bundler -N >/dev/null 2>&1
install Git git
install SQLite sqlite3 libsqlite3-dev
install memcached memcached
install Redis redis-server
install RabbitMQ rabbitmq-server
install PostgreSQL postgresql postgresql-contrib libpq-dev
sudo -u postgres createuser --superuser ubuntu
sudo -u postgres createdb -O ubuntu activerecord_unittest
sudo -u postgres createdb -O ubuntu activerecord_unittest2
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
install MySQL mysql-server libmysqlclient-dev
mysql -uroot -proot <<SQL
CREATE USER 'rails'@'localhost';
CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to 'rails'@'localhost';
SQL
install 'Nokogiri dependencies' libxml2 libxml2-dev libxslt1-dev
install 'Blade dependencies' libncurses5-dev
install 'ExecJS runtime' nodejs
# Needed for docs generation.
update-locale LANG=ko_KR.UTF-8 LANGUAGE=ko_KR.UTF-8 LC_ALL=ko_KR.UTF-8
echo 'all set, rock on!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment