Install choose the latest version of Openresty
I used ngx_openresty-1.7.2.1.tar.gz
# install packages sudo apt-get install libreadline-dev libpcre3-dev libssl-dev perl # get openresty package wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz # unzip tar xzvf ngx_openresty-1.7.2.1.tar.gz # install cd ngx_openresty-1.7.2.1/ # You can setup with ./configure --prefix="the folder you want to install", default is '/usr/local/openresty' ./configure make sudo make install # need permission to copy file to target folder Default folder: /usr/local/openresty
Setup create work folder in ~
nodejs v0.10.25 (for rails javascript engine) rbenv 0.4.0-98-g13a474c ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] Rails 4.1.4 nginx version: nginx/1.6.0 Phusion Passenger version 4.0.48 mysql Ver 14.14 Distrib 5.5.38, for debian-linux-gnu (x86_64) using readline 6.3 Installing Ruby & Rails sudo apt-get update && sudo apt-get upgrade sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties nodejs npm Use rbenv
cd git clone git://github.
Take apache for example:
Disable - update-rc.d -f apache2 remove
Enable - update-rc.d apache2 defaults
Easy way:
Below the single command line to compiling and install the last openssl version. $ curl https://www.openssl.org/source/openssl-1.0.1h.tar.gz | tar xz && cd openssl-1.0.1h && sudo ./config && sudo make && sudo make install Replace old openssl binary file by the new one via a symlink. $ sudo ln -sf /usr/local/ssl/bin/openssl `which openssl` how to check version:
$ openssl version -b built on: Mon Apr 7 20:33:29 UTC 2014 $ openssl version -a OpenSSL 1.
Add swap for an instance
$ sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 $ sudo /sbin/mkswap /var/swap.1 $ sudo /sbin/swapon /var/swap.1 $ echo "/var/swap.1 swap swap defaults 0 0" >> /etc/fstab #將 swap 加入 開機啟動 在 Amazon EC2 micro plan,加入 swap 很容易 I/O 過量, 因此最好是需要時才開啟 swap,不用時關閉 swap 以免被收錢~
swap usage
$ swapon -s $ free -k --- $ swapoff -a $ swapon -a
RVM with Ruby2.0.0-p353 + Rails4.0.2 + Ubuntu12.04(precise64) + php-fpm by Vagrant(clean install) p.s. If you don’t use RVM, you can just follow the instruction from Passenger offcial website. It will be easier. Plus, I installed all these things by Vagrant.
First thing to do $ sudo apt-get update $ sudo apt-get upgrade Pre-setup: install necessary packages $ sudo apt-get update $ sudo apt-get install build-essential libssl-dev libpcre3-dev libncurses5-dev libreadline6-dev git vim curl libcurl4-openssl-dev libreadline6 autoconf openssl git-core zlib1g zlib1g-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libgdbm-dev libncurses5-dev automake libtool bison subversion pkg-config libffi-dev Get .
$ sudo locale-gen zh_TW.UTF-8 $ sudo update-locale LANG=zh_TW.UTF-8 reload your bash profile
sudo rm /var/lib/dpkg/info/oracle-java7-installer* sudo apt-get purge oracle-java7-installer* sudo rm /etc/apt/sources.list.d/*java* sudo apt-get update sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer
Vagrant - Development environments made easy. 就是這個軟體的宗旨,把它想做是 ghost 吧!我們開發網站或是測試一些多機器架構時,常不小心就把自己的電腦或是測試主機搞到爛掉,租機器又慢又花錢,搞到爛重灌更麻煩。因此這個軟體基於 VirtualBox 做出了令人方便設定的功能,讓我們可以快速架設安裝環境並測試,尤其是以多機器架構而言更是方便!例如從最簡單的 Web server + DB server,或是 Web Load Balancer + Application Server * 5 等等的架構,一台電腦就能達成囉! 今天主要是以安裝 Vagrant 及架設出 Nginx + php5-fpm 的架構,下一篇打算另外建構一台 mongodb server,達到 Vagrant 最主要的多機器設定功能~
Vagrant 基本設定 先下載 VirtualBox 吧!
下載 Vagarnt 套件 http://downloads.vagrantup.com/
安裝好後,可能會需要加 path,至少 1.3.0 當時我是自己加的,現在 1.3.5 就不清楚了~
接下來就可以開始加入 box (可以把它想為 ghost 檔),並開始設定 Vagrant。 vagrant box add {你想要的Box名稱} {下載網址} 輸入後就會開始下載該 box 了! 範例:
以下都是以 Ubuntu 11.10為操作環境
主要目標為使用 rvm (Ruby Version Manager)來管理 ruby 版本並安裝 ruby 和 rails
先安裝一些必要套件 ( ex. openssl, zlib1g-dev ….etc. )
$sudo 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 nodejs 安裝完基本套件後, 有兩種選擇:
直接在系統上安裝 ruby ( sudo apt-get install ruby ) 使用 rvm 來管理 ruby 版本 基本上有 rvm 來管理 ruby 版本是比較方便的, 可以隨時切換不同的 ruby 版本
(不過在使用一些套件上會有一些問題需要排解, 本篇最底下有 trouble shooting)