Last active
October 17, 2016 14:17
-
-
Save jun1st/a1836900b9cd07e0d243 to your computer and use it in GitHub Desktop.
setup ubuntu for rails
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-get upgrade | |
sudo apt-get update -y | |
#add user for deploy, | |
sudo useradd -d /home/deployer -m deployer | |
sudo passwd deployer | |
sudo visudo | |
#deployer ALL=(ALL) ALL 把这个加入sudoer 文件中 | |
sudo groupadd deployers | |
sudo usermod -a -G deployers deployer | |
sudo chown -R deployer:deployers /var/www/campfire | |
sudo chmod -R g+w /var/www/campfire | |
#install necessary packages | |
sudo apt-get --ignore-missing install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev postgresql postgresql-contrib libpq-dev -y | |
### install rbenv and ruby | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
exec $SHELL | |
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash | |
git clone https://github.com/andorchen/rbenv-china-mirror.git ~/.rbenv/plugins/rbenv-china-mirror | |
rbenv install 2.3.1 | |
rbenv global 2.3.1 | |
ruby -v | |
# no ri and doc for production | |
echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
### | |
### use taobao ruby gem sources for internet reasons | |
gem sources --remove https://rubygems.org/ | |
$ gem sources -a https://gems.ruby-china.org/ | |
$ gem sources -l | |
### | |
gem install rails | |
## install redis | |
sudo apt-get install redis-server | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment