-
Notifications
You must be signed in to change notification settings - Fork 4
System Setup on Fedora (CentOS 6.4)
Configuration Setup
- Creating a deploy user
- Proxy setup
- Deploy setup
- Auto SSH login
Installation Requirements
- Ruby
- Nginx-Passenger
- Ruby-on-rails
- mysql
- sqlite3
- elasticsearch
- whenever gem
- phantomjs
- redis
Create username and password
useradd deploy
passwd <password>
Add the deploy user to the list of sudoers by typing visudo
and pasting this line:
deploy ALL=(ALL) ALL
To ensure that paths stay the same when running in sudo, change secure_path
in visudo to:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/home/deploy/.rbenv/shims
Add these two lines to your .bashrc
to set proxy environment variables
export https_proxy=https://proxy.unhcr.local:8080
export http_proxy=http://proxy.unhcr.local:8080
Create /var/www/
folder and have deploy user own it.
mkdir /var/www/
chown deploy /var/www
On your local computer run:
ssh-keygen -t rsa
Create .ssh
folder on your remote server
ssh deploy@<remote_server> mkdir -p .ssh
chmod 700 .ssh
Now again from your local computer:
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys2 && chmod 640 .ssh/authorized_keys2'
As a ruby environment manager we'll using rbenv. The installation instructions are found on that page. Attempt to use ruby-build to install 2.0.0-p353
. As of now there is a bug that is noted here.
If the proposed fix didn't work follow the next steps (Skip this part if ruby successfully installed).
cd ~/.rbenv/versions/
Now download ruby version 2.0.0-p353
.
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz
Unzip the tar and install. Once you've installed ruby, you'll want to add the gem
binary to your path. Insert this into your .bashrc
:
export PATH=$PATH:$HOME/.rbenv/bin
tar -zxvf ruby-2.0.0-p353.tar.gz
cd ruby-2.0.0-p353
./configure
make
sudo make install
rm ruby-2.0.0-p353.tar.gz
Next we need to setup Nginx passenger. For this use the guide here. Complete steps 1 and 2 only.
yum install mysql mysql-devel
yum install sqlite3-devel
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.11.noarch.rpm`
rpm -i elasticsearch-0.90.11.noarch.rpm
This sets up cron jobs for the weekly build. https://github.com/javan/whenever
gem install whenever
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
tar xvjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo cp phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin
cd ~
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo cp src/redis-benchmark /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
sudo cp src/redis-server /usr/local/bin/
sudo cp redis.conf /etc/
sudo sed -i 's/daemonize no/daemonize yes/' /etc/redis.conf
sudo sed -i 's/^pidfile \/var\/run\/redis.pid/pidfile \/tmp\/redis.pid/' /etc/redis.conf