軟件編譯就是把 源代碼(如 c,c++)編譯成 2 進制注意要下載源代碼
以 memcached 爲例,來編譯,到 memcached.org 下載源碼.
下載到/usr/local/src 下
編譯軟件分爲 3 步—
1: configure --prefix=/安裝/路徑
如果還有其他選項,./configure --help 來查看
2: make 編譯 [生成 2 進制]
3: make install [把生成的 2 進制複製到 prefix 指定的安裝路徑裏]
其中 2,3 兩步,可以合寫爲 make && make install
以 memcached 爲例
./configure prefix=/usr/local/memcached
configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/
If it’s already installed, specify its path using --with-libevent=/dir/
這是因爲 memcached 需要 libevent
你既可以下載 libevent 的源碼,先編譯 libevent,也可以 yum libevent
以 yum 爲例:
# yum install libevent 安裝後問題仍然存在
對於庫,不僅要裝庫本身,往往還要裝庫的源碼 xx-devel
# yum install libevent-devel
# ./configure prefix=/usr/local/memcached # make
#mak install