Install and deploy rails on CentOS
来源:互联网 发布:opencv 排序算法 编辑:程序博客网 时间:2024/05/16 12:27
prerequisites:
I cover all these operations on CentOS 6.4 and with root, so if you encounter some privilege problem, try sudo.
And, if using Ubuntu, you needn't worry about SELinux.
1.install essentical library
yum update
yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-develhttpd-devel apr-devel apr-util-devel sqlite-devel gcc-c++
#then compile and install nodejs
wget http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz
#........
2.install libyaml(needed by ruby)
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure
make
make install
3.install ruby
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
#compile and install
#after compile and install
ruby –v
4.install rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-2.0.3.tgz
tar vxzf rubygems-2.0.3.tgz
cd rubygems-2.0.3.tgz
ruby setup.rb
gem –v
5.install rails
gem update
gem update --system
gem install rails –V #It really costs a longtime, enjoy a coffee now
Next,we talk about deploy on centos
6.install passenger(follow the instructions to install extra lib)
gem install passenger
passenger-install-apache2-module
7.find the apache configure
apachectl –V | grep HTTPD_ROOT
apachectl –V | grep SERVER_CONFIG_FILE
#add to apache config file
<VirtualHost*:80>
ServerName test.com
DocumentRoot /var/www/html/blog/public
<Directory /var/www/html/blog/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
#if something’s wrong, add line below then try again
NameVirtualHost*:80
8.config mysql database(if you use sqlite,skip this step)
#ifuse mysql in production, add below to gemfile
group:production do
gem ‘mysql2’
end
#then bundle install
bundle install
#config mysql
mysql–u root –p
mysql>create database depot_production character set utf8;
mysql>grant all privileges on depot_production.*
mysql>to ‘username’@’localhost’ identified by ‘password’;
mysql>exit;
#modify the config/database.yml
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: depot_production
pool: 5
username: username
password: password
host: localhost
9.apply your migrations
rake db:setup RAILS_ENV=”production”
10.precompile the static resources
bundle exec rake assets:precompile
On centos, we must change selinux’s behavior(Everytime you deploy!)
11.Temporarily go into SELinux permissive mode
setenforce 0
12.restart apache
apachectl restart
13.use your rails app for a while
14.allow passenger run with selinux
#if can't find audit2allow, you should install it first
#or you can skip 2 commands below
yum provides \*/audit2allow
yum install policycoreutils-python
grep httpd /var/log/audit/audit.log | audit2allow -M passenger
#install newly created selinux module
semodule -i passenger.pp
15.switch selinux back to enforcing mode
setenforce 1
- Install and deploy rails on CentOS
- CentOS install Ruby On Rails
- Install ruby on rails on CentOS
- Git install and config on CentOS
- Install Haskell on Ubuntu and CentOS
- Install Rsyslog and LogAnalyzer on Centos 6
- install Ruby on Rails
- Deploy Puppet on CentOS 5
- 安装gem How To Install Ruby on Rails on CentOS 6
- install ruby on rails debian
- remove and re-install mysql 5.6 on centOS 6.4
- Install And Configure Open VSwitch On CentOS RHEL Fedora
- Install “build-essential” on RHEL/CentOS and OpenSolaris
- Install EPEL repo on CentOS 7 and RHEL 7
- Install Apache, PHP And MySQL On CentOS 7 (LAMP)
- Install FFmpeg and ffmpeg-php on CentOS Easily
- How to install and configure NGINX on CentOS 7
- [置顶] Install FFmpeg and ffmpeg-php on CentOS Easily
- ASP.net中怎样获取menu被单击的条目信息
- 2010年12月7日下午北大数据库系统原理上机题
- oracle数据库密码修改
- Sqlite3入门,安装和使用。
- office app之 Mail App 从新建到发布
- Install and deploy rails on CentOS
- 情色网站启示:请尊重你不懂的领域
- poj 1703 find them,catch them
- Spring Batch异常
- oracle数据库建立dblink
- cocos2d-x 菜鸟学习笔记四(游戏场景与场景切换)
- 手机网站前端开发布局技巧
- 数学之路(2)-数据分析-R基础(23)
- $.ajaxSetup