설치 하다가 빡쳐서 정리함.
내용은 주로 digitalocean + qiita 등에 있는걸로 정리하였음.
일단 내가 사용할 서버에 CentOS 7 USB 가 정상적으로 인스톨 되지 않는 문제로 내키지 않았지만 CentOS 6.7 을 설치함.
그런데 이게 Mysql 5.1 이 yum repo 에 있어서 버전을 올릴 필요가 있었음.
1. setup CentOS
$ su
내용은 주로 digitalocean + qiita 등에 있는걸로 정리하였음.
일단 내가 사용할 서버에 CentOS 7 USB 가 정상적으로 인스톨 되지 않는 문제로 내키지 않았지만 CentOS 6.7 을 설치함.
그런데 이게 Mysql 5.1 이 yum repo 에 있어서 버전을 올릴 필요가 있었음.
1. setup CentOS
$ su
$ /usr/sbin/visudo
# User privilege specification
root ALL=(ALL) ALL
# add user id
demo ALL=(ALL) ALL
$ yum install ibus ibus-hangul ibus-anthy
$ rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ rpm -Uvh http://mirror.premi.st/epel/6/i386/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
2. install MYSQL
$ rpm -qa | grep mysql
$ sudo yum remove mysql*
$ sudo yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm $ sudo yum install mysql-client mysql-server
$ rpm -qa | grep mysql
mysql-community-release-el6-5.noarch
mysql-community-server-5.6.20-4.el6.x86_64
mysql-community-common-5.6.20-4.el6.x86_64
mysql-community-client-5.6.20-4.el6.x86_64
mysql-community-libs-5.6.20-4.el6.x86_64
$ mysql -version
$ sudo /etc/init.d/mysqld start
$ sudo mysql -uroot -p
password change
mysql> set password = password('New Pass');
mysql> exit
$ sudo chkconfig mysqld on
$ sudo chkconfig | grep mysql
3. install rbenv
$ sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
$ cd ~$ git clone git://github.com/sstephenson/rbenv.git .rbenv $ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profileecho 'eval "$(rbenv init -)"' >> ~/.bash_profile$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"' >> ~/.bash_profile$-lexec $SHELL$
4. install ryby
rbenv install -v 2.2.0$rbenv global 2.2.0$
$ ruby -v
$ echo "gem: --no-document" > ~/.gemrc
$ gem install bundler
5. isntall Rails
$ gem install rails -v 4.2.0
$ rbenv rehash
$ rails -v
6. isntall Javascript Runtime
$ sudo yum -y install epel-release
$ sudo yum install nodejs
7. create test application
$ cd /srv
$ mkdir www
$ sudo chown demo:demo -R www/
$ cd /srv/www
$ rails new testapp
$ cd testapp
$rake db:create
$ rails s
- end -
http://localhost:3000
install nginx
default nginx 1.0.... upgrade 1.8.
{
$ sudo rm /var/run/nginx.pid
}
$ sudo vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
$ yum --enablerepo=nginx install nginx
{
$ sudo /etc/init.d/nginx restart
}
installunicorn
$ gem install unicorn
# Create a sample resource $ rails generate scaffold Task title:string note:text # Create a sample database$RAILS_ENV=development rake db:migrate$RAILS_ENV=production rake db:migrate # Create a directory to hold the PID files$mkdir pids
Configuring Server
$ vim config/unicorn.rb
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/srv/www/testapp"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/srv/www/testapp/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/srv/www/testapp/log/unicorn.log"
stdout_path "/srv/www/testapp/log/unicorn.log"
# Unicorn socket
listen "/tmp/unicorn.testapp.sock"
# Number of processes
# worker_processes 4
worker_processes 2
# Time-out
timeout 30
$ vim /etc/nginx/conf.d/default.conf
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.testapp.sock fail_timeout=0;
}
server {
listen 80;
server_name localhost;
# Application root, as defined previously
root /srv/www/testapp/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
$ unicorn_rails -c config/unicorn.rb -D
$ sudo service nginx restart
아직 정리 전인데 사용 가능한 "rubymine + vagrant"
http://qiita.com/Avene/items/3f5bedbb48bbd18fc1c4
댓글
댓글 쓰기