在Ubuntu 13.10 / Linux Mint或其他Debian based的GNU/Linux上安裝ElasticSearch

翻了一些文章, 以前裝ElasticSearch比較麻煩一點, 要自己處理, 不過現在官方已經有打包deb了!

ElasticSearch官方下載頁面:http://www.elasticsearch.org/download/

目前的版本為0.90.9, 下載網址為:https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.deb

因為依賴於java環境, 所以先安裝jre(JAVA Runtime Environment):

可以只裝minimal的版本, 比較輕量一點, 不用裝那麼多東西, 安裝也比較快:
sudo apt-get install openjdk-7-jre-headless(不想裝輕量版就把-headless拿掉就好了!)

安裝好java環境後來下載elasticsearch:
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.deb

然後來安裝:
sudo dpkg -i elasticsearch-0.90.9.deb

沒問題的話service應該會自動跑起來,這邊來測試看看,有curl的話就用curl直接在terminal測(用telnet應該也可以!?):
curl http://localhost:9200

或是直接在瀏覽器開http://localhost:9200也可以

結果應該會長這樣:
{
"ok" : true,
"status" : 200,
"name" : "Drake, Frank",
"version" : {
"number" : "0.90.9",
"build_hash" : "a968646da4b6a2d9d8bca9e51e92597fe64e8d1a",
"build_timestamp" : "2013-12-23T10:35:28Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}

看到這就表示沒問題了!

用 bash-completion 增強 Bash shell 的自動補齊功能(apt-get / aptitude / portsnap … 等)

bash 預設的自動補齊功能只會補命令跟檔名而已,假如要 apt-get install openjdk-7-jre 的話只打了 openjdk-7- 按下 tab 是不會有效果的…

透過 bash-completion 這個套件的話就可以支援非常多常用工具的命令自動補齊,bash-completion 其實就是一堆 bash shell scripts 寫出來的自動補齊功能,基於 Ubuntu 的 GNU/Linux 分支可能都有內建了,如果沒有,手動安裝的方式也很簡單:

Debian/Ubuntu 系列用
sudo apt-get install bash-completion

如果是用 yum 來管套件的Linux distro (CentOS/Fedora/RHEL)
sudo yum install bash-completion

FreeBSD(新的套件管理系統請使用 pkg install 取代 pkg_add):
sudo pkg_add bash-completion

想知道 bash-completion 到底支援了多少命令,可以看一下他的 filelist (以 Debian sid 套件為例, 應該都大同小異):
http://packages.debian.org/sid/all/bash-completion/filelist

另外要注意的是,不是每個 distribution 裝起來的 bash-completion 都會幫你處理好自動取用 bash-completion 這件事,按照不同的系統可能要手動使用類似這樣的指令:
source /usr/local/share/bash-completion/bash_completion.sh

通常是會加在 bashrc 底下,system admin 的話加入系統預設的 bashrc 也是不錯的做法

Debian / Ubuntu / LinuxMint /Deepin … dpkg忽略相依性強制移除

用dpkg –remove (-r) 移除套件的時候如果會造成相依性問題預設就不會做處理

看了一下dpkg --help, 應該是可以透過–force來幫忙(!?)

又看了一下dpkg --force-help…有這些說明

dpkg forcing options - control behaviour when problems found:
warn but continue: --force-,,...
stop with error: --refuse-,,... | --no-force-,...
Forcing things:
[!] all Set all force options
[*] downgrade Replace a package with a lower version
configure-any Configure any package which may help this one
hold Process incidental packages even when on hold
not-root Try to (de)install things even when not root
bad-path PATH is missing important programs, problems likely
bad-verify Install a package even if it fails authenticity check
bad-version Process even packages with wrong versions
overwrite Overwrite a file from one package with another
overwrite-diverted Overwrite a diverted file with an undiverted version
[!] overwrite-dir Overwrite one package's directory with another's file
[!] unsafe-io Do not perform safe I/O operations when unpacking
[!] confnew Always use the new config files, don't prompt
[!] confold Always use the old config files, don't prompt
[!] confdef Use the default option for new config files if one
is available, don't prompt. If no default can be found,
you will be prompted unless one of the confold or
confnew options is also given
[!] confmiss Always install missing config files
[!] confask Offer to replace config files with no new versions
[!] architecture Process even packages with wrong or no architecture
[!] breaks Install even if it would break another package
[!] conflicts Allow installation of conflicting packages
[!] depends Turn all dependency problems into warnings
[!] depends-version Turn dependency version problems into warnings
[!] remove-reinstreq Remove packages which require installation
[!] remove-essential Remove an essential package

WARNING - use of options marked [!] can seriously damage your installation.
Forcing options marked [*] are enabled by default.

原先加上--force-breaks無效, 加了--force-depens就對了!

原來HipHop VM(HHVM)不支援 32-bit 的環境 …

以前的HipHop似乎比較不友善 現在簡單多了!

剛剛在Lubuntu 13.04(raring)上要編譯HHVM

竟然到了最後倒數兩步給我出現…

CMake Error at CMakeLists.txt:26 (message):

32-bit support is currently unsupported, check back with a later version of HipHop.

— Configuring incomplete, errors occurred!

因為沒甚麼特殊用途…

手上拿來灌unix-like os的主機大概都只有2G的RAM

理所當然就是安裝32位元的OS了

看來要先在VirtualBox上面灌一套64bit的來玩玩看了