天天看點

firefly如何安裝mysql_CentOS7 安裝Firefly及測試

本文記錄CentOS7安裝Firefly的過程及遇到的錯誤

安裝也可以同時參考社群提供的文章:

http://www.9miao.com/forum.php?mod=viewthread&tid=33009&fromuid=87

沒有安裝mysql的請先參考這篇文章,快速安裝:

http://blog.csdn.net/alex_my/article/details/44711139

1 安裝第三方庫:

easy_install twisted

easy_install python-memcached

easy_install DBUtils

easy_install zope.interface

easy_install affinity

easy_install MySQL-python

2 遇到的問題

-1: twisted

問題:twisted/runner/portmap.c:10:20: fatal error: Python.h: No such file or directory

解決方法:安裝python-dev

yum -y install python-devel.x86_64

-2: MySQL-python

問題:mysql_config not found

原因:mysql_config位置不對,而我是就沒有安裝mysql,安裝好後沒有遇到該問題。

解決方法:來自社群參考文章

方法1:

sudo ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

将mysql_confi從你的安裝目錄連結到/usr/local/bin目錄下,這樣就可以在任意目錄下通路了(也可以放到/usr/bin)

方法2:

編輯源碼檔案夾的site.cfg檔案,去掉#mysql_config =  /usr/local/bin/mysql_config前的注釋#,修改後面的路徑為你的mysql_config真正的目錄就可以了。(如果不知道 mysql_config在哪裡,運作指令:whereis mysql_config)

3 檢測是否正常安裝

-1:建立一個新的工程

firefly-admin.py createproject Test

cd Test

-2: 修改config.json配置

--1:普通使用者無法使用1000端口号,是以,netport使用的1000請修改為其它值,比如10000

--2:db-passwd請修改為自己所使用的mysql密碼,比如123456

-3:運作

python startmaster.py

輸出:

2015-03-29 00:04:01+0800 [-] Log opened.

2015-03-29 00:04:01+0800 [-] DelaySite starting on 9998

2015-03-29 00:04:01+0800 [-] Starting factory

2015-03-29 00:04:01+0800 [-] BilateralFactory starting on 9999

2015-03-29 00:04:01+0800 [-] Starting factory

/usr/lib/python2.7/site-packages/pkg_resources.py:1054: UserWarning: /home/alex-my/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the

PYTHON_EGG_CACHE environment variable).

warnings.warn(msg, UserWarning)

/usr/lib/python2.7/site-packages/pkg_resources.py:1054: UserWarning: /home/alex-my/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or

the PYTHON_EGG_CACHE environment variable).

warnings.warn(msg, UserWarning)

2015-03-29 00:04:01+0800 [-] Log opened.

2015-03-29 00:04:01+0800 [-] Log opened.

2015-03-29 00:04:01+0800 [-] Starting factory

2015-03-29 00:04:01+0800 [-] Starting factory

2015-03-29 00:04:01+0800 [-] gate start...

2015-03-29 00:04:01+0800 [-] gate pid: 3431

2015-03-29 00:04:01+0800 [-] net start...

2015-03-29 00:04:01+0800 [-] net pid: 3432

2015-03-29 00:04:01+0800 [BilateralBroker,0,127.0.0.1] node [gate] takeProxy ready

2015-03-29 00:04:01+0800 [BilateralBroker,1,127.0.0.1] node [net] takeProxy ready

2015-03-29 00:04:01+0800 [Broker,client] call method remote_connect on service[single]

2015-03-29 00:04:01+0800 [Broker,client] Starting factory

2015-03-29 00:04:01+0800 [BilateralBroker,0,127.0.0.1] node [net] takeProxy ready

-4: 修複警告

過程中出現一個大意是說~/.python-eggs不安全

解決方案:

chmod g-w ~/.python-eggs/    # 将group的寫權限去除

chmod o-w ~/.python-eggs/     # 将other的寫權限去除

-5: 一個更具體的示例:多人聊天室

請移步:http://www.9miao.com/forum.php?mod=viewthread&tid=43974&fromuid=87