CentOS7 安装Firefly及测试
鲜于华容
2023-12-01
本文记录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 <firefly.web.delayrequest.DelaySite instance at 0x113c3f8>
2015-03-29 00:04:01+0800 [-] BilateralFactory starting on 9999
2015-03-29 00:04:01+0800 [-] Starting factory <firefly.distributed.root.BilateralFactory instance at 0x113ca28>
/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 <twisted.spread.pb.PBClientFactory instance at 0x15f59e0>
2015-03-29 00:04:01+0800 [-] Starting factory <twisted.spread.pb.PBClientFactory instance at 0x28ba878>
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 <twisted.spread.pb.PBClientFactory instance at 0x28ba710>
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