There are some steps to configure Server, Firewall and Apache .
Steps To Configure Server :
1. Lets know server type : $cat /etc/*-release
2. Update system : $ sudo apt-get update
3. Install git and curl : $sudo apt-get install curl git-core gitosis .
4. Now Install RVM : $ bash < <( curl https://rvm.beginrescueend.com/releases/rvm-install-head )
5. Make changes in /root/.bashrc file as mentioned after installing RVM .
replace : [ -z "$PS1" ] && return
with : if [[ -n "$PS1" ]] ; then
and at the end of file add
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
if
After chnages use "su" on prompt .So that .bashrc file can be loaded with changes
6. Install Ruby depandencies for RVM: $ apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake
7. Now RVM is ready to install ruby like : $ rvm install 1.9.2-p180
8. Install database server (say mysql) : $ sudo apt-get install mysql-server
9. Setup application in /var/www ( if www directory not exist then create it.)
Step to Configure firewall :
1. View entries in iptable : $ iptables -L
2. Allow ports : $ iptables -A INPUT -p tcp -dport ssh -j ACCEPT
it can also be done by specifing port number : $ iptables -A INPUT -p tcp -dport 80 -j ACCEPT
3. TO allow ping : $ iptables -I INPUT 2 -p icmp -j ACCEPT
4. TO allow established sessions to receive traffic : $ iptables -I INPUT 2 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
5. Save setting : $ sudo bash -c "iptables-save > /etc/iptables.rules"
Step to Configure apache :
1. Install apache : $ sudo apt-get install apache2
apache's required files for changes will be available in /etc/apache2/ directory .
2. Install passenger gem to support ruby and rails on apache : $ gem install passenger
3. Now run : $ passenger-install-apache2-module
This will suggest, what to do next.
4. Create a file in sites-available directory with any name you want . And copy content suggested in above step
<VirtualHost *:80>......
.....
.....
</VirtualHost>
And make setting as required .
5. Remove the symbolic links for default from site-enabled.
6. Create symbolic links in site-enabled folder from newly created file in site-available.
7. Restart apache :/etc/init.d/apache2 start/stop/restart
8. Restart passanger after chnages in app : touch path_to_app/tmp/restart.txt
Rails 3 Problem with Passenger :
when gem 'paperclip', :git => 'git://github.com/lmumar/paperclip.git ', :branch => 'rails3' is added to your Gemfile
then there will be some problem while you are running app . Try
$ bundle --deployment
Steps To Configure Server :
1. Lets know server type : $cat /etc/*-release
2. Update system : $ sudo apt-get update
3. Install git and curl : $sudo apt-get install curl git-core gitosis .
4. Now Install RVM : $ bash < <( curl https://rvm.beginrescueend.
5. Make changes in /root/.bashrc file as mentioned after installing RVM .
replace : [ -z "$PS1" ] && return
with : if [[ -n "$PS1" ]] ; then
and at the end of file add
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
if
After chnages use "su" on prompt .So that .bashrc file can be loaded with changes
6. Install Ruby depandencies for RVM: $ apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake
7. Now RVM is ready to install ruby like : $ rvm install 1.9.2-p180
8. Install database server (say mysql) : $ sudo apt-get install mysql-server
9. Setup application in /var/www ( if www directory not exist then create it.)
Step to Configure firewall :
1. View entries in iptable : $ iptables -L
2. Allow ports : $ iptables -A INPUT -p tcp -dport ssh -j ACCEPT
it can also be done by specifing port number : $ iptables -A INPUT -p tcp -dport 80 -j ACCEPT
3. TO allow ping : $ iptables -I INPUT 2 -p icmp -j ACCEPT
4. TO allow established sessions to receive traffic : $ iptables -I INPUT 2 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
5. Save setting : $ sudo bash -c "iptables-save > /etc/iptables.rules"
Step to Configure apache :
1. Install apache : $ sudo apt-get install apache2
apache's required files for changes will be available in /etc/apache2/ directory .
2. Install passenger gem to support ruby and rails on apache : $ gem install passenger
3. Now run : $ passenger-install-apache2-
This will suggest, what to do next.
4. Create a file in sites-available directory with any name you want . And copy content suggested in above step
<VirtualHost *:80>......
.....
.....
</VirtualHost>
And make setting as required .
5. Remove the symbolic links for default from site-enabled.
6. Create symbolic links in site-enabled folder from newly created file in site-available.
7. Restart apache :/etc/init.d/apache2 start/stop/restart
8. Restart passanger after chnages in app : touch path_to_app/tmp/restart.txt
Rails 3 Problem with Passenger :
when gem 'paperclip', :git => 'git://github.com/lmumar/
then there will be some problem while you are running app . Try
$ bundle --deployment
No comments:
Post a Comment