orange 0.7版本增加了很多依賴,對於初學者來說容易碰到各種坑。本人也安裝過多次,出現過不少問題,現記錄安裝方法,希望能對orange感興趣的同學有所幫助。
一、安裝lor
lor項目地址:https://github.com/sumory/lor
git clone https://github.com/sumory/lor
cd lor
make install
make install LOR_HOME=/path/to/lor LORD_BIN=/path/to/lord
二、安裝orange
2.1 安裝openresty
openresty安裝本文不再贅述,安裝時注意添加擴展:--with-http_stub_status_module
2.2 安裝luarocks
默認安裝目錄,/usr/local/luarocks。注意:luarocks2.2.2+以上版本
wget https://luarocks.github.io/luarocks/releases/luarocks-3.1.3.tar.gz
tar -xzf luarocks-3.1.3.tar.gz
cd luarocks-3.1.3
find / -name "lua.h"
./configure --prefix=/usr/local/luarocks --with-lua-include=/home/openresty/luajit/include/luajit-2.1
make
make install
2.3 安裝orange
git clone https://github.com/orlabs/orange.git
cd orange
/home/openresty/bin/opm --install-dir=./ get zhangbao0325/orangelib //opm download the 3rd packages
/usr/local/luarocks/bin/luarocks install luafilesystem
/usr/local/luarocks/bin/luarocks install luasocket
cd conf
cp orange.conf.example orange.conf
cp nginx.conf.example nginx.conf
make install
/home/openresty/nginx/sbin/nginx -p /usr/local/orange/ -c /usr/local/orange/conf/nginx.conf
三、注意事情&可能碰到的問題
- sh start.sh之前,將/orange/install/下的.sql導入數據庫,修改orange.conf,修改對應的數據庫信息
- Can't locate Digest/MD5.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/openresty/bin/opm line 16. BEGIN failed--compilation aborted at /home/openresty/bin/opm line 16.
yum -y install perl perl-devel
yum -y install perl-Digest-MD5
- nginx: [error] init_by_lua error: ./lualib/resty/pl/path.lua:28: pl.path requires LuaFileSystem 在nginx.conf中,引入lua_package路徑:
lua_package_cpath '/usr/local/luarocks/lib/lua/5.1/?.so;/usr/local/luarocks/lib/lua/5.1/socket/?.so;/usr/local/luarocks/lib/lua/5.1/mime/?.so;;';
lua_package_path './lualib/?.lua;./lualib/resty/?.lua;/usr/local/orange/?.lua;/usr/local/lor/?.lua;/usr/local/luarocks/share/lua/5.1/?.lua;;';
- make install之後,可以直接sh start.sh運行,不過指定的是當前目錄下的配置。個人喜歡指定安裝後的目錄