ubuntu12 rvm rails thin

 

# Nginx
sudo apt-get install nginx
# Links (for testing)
sudo apt-get install links
 
  1. 安装chrome
    sudo apt-add-repository ppa:chromium-daily/stable
    sudo apt-get update
  2. sudo apt-get install chromium-browser
     

  3. 安装一些必要的库文件。
    sudo apt-get install curl bison build-essential autoconf zlib1g-dev  libsqlite3-dev libssl-dev libxml2-dev libreadline6-dev git-core subversion
     

  4. 安装gnome2
    sudo apt-get install gnome-session-fallback
     
    注销,登陆的时候可以选择gnome2

  5. 安装rvm(参考网站https://rvm.io//
    curl -L get.rvm.io | bash -s stable
    rvm pkg install zlib
    rvm remove 1.9.3
    rvm install 1.9.3 
    修改Terminal,“编辑”-“配置文件首选项”-“标题与命令”-“以登录sheel的方式执行命令”
    rvm use 1.9.3

  6. 安装Rails及相关gem
    $ gem sources --remove http://rubygems.org/
    $ gem sources -a http://ruby.taobao.org/
    $ gem sources -l
    *** CURRENT SOURCES ***
    
    http://ruby.taobao.org#移除rack1.4.1
    gem uninstall rack
    gem install thin
      # 请确保只有 ruby.taobao.org $ gem install rails #进入目录 bundle install
  7. 安装imagemagick
    sudo apt-get install imagemagick
    identify
    identify -version
    sudo apt-get install libmagickwand-dev
    

     
  8. 安装thin
    gem uninstall rack #移除rack 1.4.1
    gem install thin
    rvmsudo thin install
     
  9. 配置thin(参照http://jsani.com/2011/09/ubuntu-11-xx-nginx-thin-rails-3-a-how-to/
    rvmsudo thin config -C /etc/thin/attendance.yml -c /home/administrator/www/attendance/
    
    创建gemset
    
    rvm gemset create attandance
    
    cd “项目目录” bundle install
    
    rvmsudo rvm wrapper 1.9.3@attendance daemon193 thin
    
    sudo gedit /etc/thin/attendance.yml
    
     attendance.yml内容chdir: /home/administrator/www/attendance
    environment: production
    address: 0.0.0.0
    port: 3000
    timeout: 30
    log: log/thin.log
    pid: tmp/pids/thin.pid
    max_conns: 1024
    max_persistent_conns: 512
    require: []
    wait: 30
    servers: 1	
    daemonize: true
     
    sudo gedit /etc/rc.local
    service thin restart #restart 恐防掉电关机
  10. 安装配置nginx# Nginx
    sudo apt-get install nginx
    # Links (for testing)
    sudo apt-get install links
     参考配置upstream thin_cluster {
      server 127.0.0.1:3000;
      server 127.0.0.1:3001;
      server 127.0.0.1:3002;
      server 127.0.0.1:3003;
    }
    
    server {
      listen 80;
      server_name myapp.domain;
    
      access_log /var/www/myapp/log/access.log;
      error_log  /var/www/myapp/log/error.log;
    
      root   /var/www/celox.me/public/;
      index  index.html;
    
      location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host $http_host;
        proxy_redirect off;
    
        if (-f $request_filename/index.html) {
          rewrite (.*) $1/index.html break;
        }
    
        if (-f $request_filename.html) {
          rewrite (.*) $1.html break;
        }
    
        if (!-f $request_filename) {
          proxy_pass http://thin_cluster;
          break;
        }
      }
    }
    *sudo nginx -t 检查配置是否正确 

    安装服务管理软件: sudo apt-get install sysv-rc-conf
    sudo sysv-rc-conf

  11. 让chrome自动延时启动
    cd ~/.config/
    mkdir autostart
      复制chrome的快捷方式到其内
    chrome.desktop文件内容
    #!/usr/bin/env xdg-open
    
    [Desktop Entry]
    Version=1.0
    Name=Chromium Web Browser
    Name[zh_CN]=管理系统
    GenericName=Web Browser
    GenericName[zh_CN]=网页浏览器
    Comment=Access the Internet
    Comment[zh_CN]=访问互联网
    X-GNOME-Autostart-Delay=10 #延时设置这里
    Exec=/usr/bin/chromium-browser "http://127.0.0.1"
    Terminal=false
    X-MultipleArgs=false
    Type=Application
    Icon=chromium-browser
    Categories=Network;WebBrowser;
    MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
    StartupWMClass=Chromium-browser
    StartupNotify=false #这里设为false也很关键,设置为fasle才可以用chrome聚焦。
    X-Ayatana-Desktop-Shortcuts=NewWindow;Incognito;TempProfile
    
    [NewWindow Shortcut Group]
    Name=Open a New Window
    Name[zh_CN]=打开新窗口
    Exec=/usr/bin/chromium-browser
    TargetEnvironment=Unity
    
    [Incognito Shortcut Group]
    Name=Open a New Window in incognito mode
    Name[zh_CN]=以隐身模式打开新窗口
    Exec=/usr/bin/chromium-browser --incognito
    TargetEnvironment=Unity
    
    [TempProfile Shortcut Group]
    Name=Open a New Window with a temporary profile
    Name[zh_CN]=以临时配置文件打开新窗口
    Exec=/usr/bin/chromium-browser --temp-profile
    TargetEnvironment=Unity
  12. 设置自动登录
  13. 设置启动菜单等待时间  sudo gedit /etc/default/grub
  14.  





 

你可能感兴趣的:(ubuntu)