{"id":90,"date":"2018-05-21T22:43:11","date_gmt":"2018-05-21T14:43:11","guid":{"rendered":"http:\/\/www.zhangyijun.com\/?p=90"},"modified":"2018-05-21T22:43:11","modified_gmt":"2018-05-21T14:43:11","slug":"%e5%9c%a8%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%83%a8%e7%bd%b2amh%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8f%8aqiandao-today%e7%9a%84%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"http:\/\/www.zhangyijun.com\/?p=90","title":{"rendered":"\u5728\u4e91\u670d\u52a1\u5668\u90e8\u7f72AMH\u6570\u636e\u5e93\u53caqiandao.today\u7684\u8fc7\u7a0b"},"content":{"rendered":"<p>\t\t\t\tAMH \u5f88\u5783\u573e\uff0c\u53ea\u8981\u770b\u8fd9\u6587\u7ae0\u91cc\u5173\u4e8eCENTOS PYTHON\u73af\u5883\u642d\u5efa\u7684\u90e8\u5206\u5c31\u53ef\u4ee5\u4e86\u3002\u4e3b\u8981\u662fpython2.7\u73af\u5883<\/p>\n<p>http:\/\/www.xxkwz.cn\/2086.html<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u9996\u5148\u4f60\u8981\u6709\u4e00\u53f0\u4e91\u670d\u52a1\u5668\u6216\u8005VPS\uff0c\u5b89\u88c5centos\u6216\u8005\u81ea\u5df1\u719f\u6089\u7684linux\u7cfb\u7edf\uff0c\u8fd9\u91cc\u6211\u7528\u7684\u662fCentos6.5\u00d786\u3002<\/p>\n<p>\u5f88\u591a\u4eba\u90fd\u662f\u65b0\u624b\uff0c\u6240\u4ee5\u5c31\u91c7\u7528\u65b0\u624b\u7684\u65b9\u6848\u4e00\u952e\u88c5\u4e2a\u4e3b\u673a\u7ba1\u7406\u9762\u677fAMH4.2\u514d\u8d39\u7248\uff0c\u4e4b\u6240\u4ee5\u5b89\u88c5\u8fd9\u4e2a\u9762\u677f\uff0c\u662f\u56e0\u4e3a\u5b83\u7684\u5b89\u88c5\u8fc7\u7a0b\u540c\u65f6\u5b8c\u5584\u4e86\u5f88\u591a\u540e\u9762\u6211\u4eec\u9700\u8981\u7684\u4f9d\u8d56\u5e93\uff0c\u771f\u7684\u9002\u5408\u65b0\u624b\u548c\u61d2\u4eba\uff01<\/p>\n<p>AMH\u7684\u5b89\u88c5\u6bd4\u8f83\u7b80\u5355\uff0c\u76f4\u63a5\u5b98\u65b9\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p>AMH4.2 \u7f16\u8bd1\u5b89\u88c5\uff1a<\/p>\n<p>AMH 4.2 \u4e3a\u72ec\u7acb\u7684\u4e00\u5957LNMP\/Nginx\u865a\u62df\u4e3b\u673a\u9762\u677f\uff0c\u5b89\u88c5\u8bf7\u4f7f\u7528\u7eaf\u51c0\u7cfb\u7edf\u3002\u7f16\u8bd1\u5b89\u88c5\u65b9\u5f0f (\u5b89\u88c5\u65f6\u95f415\u81f325\u5206\u949f)<\/p>\n<p>1) \u4f7f\u7528 root \u8d26\u53f7\u767b\u5f55 Linux \u670d\u52a1\u5668\u3002<\/p>\n<p>2) \u6267\u884c amh \u5b89\u88c5\u811a\u672c\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">wget http:\/\/amh.sh\/file\/AMH\/4.2\/amh.sh &amp;&amp; chmod 775 amh.sh &amp;&amp; .\/amh.sh 2&gt;&amp;1 | tee amh.log<\/code><\/pre>\n<p>3) \u6839\u636e\u63d0\u793a\u8f93\u5165\u9009\u62e91~3\u9009\u9879\u30021\u4e3a\u5b89\u88c5amh\uff0c2\u4e3a\u5378\u8f7damh\uff0c3\u4e3a\u9000\u51fa\u4e0d\u505a\u64cd\u4f5c\u3002<\/p>\n<p>\u8f93\u51651\u56de\u8f66\uff0c\u5982\u679c\u7a0b\u5e8f\u65e0\u6cd5\u8bc6\u522b\u4e3b\u673aIP\uff0c\u8fd8\u9700\u8981\u624b\u5de5\u8f93\u5165\u4e3b\u673aIP\uff0c\u63a5\u7740\u8f93\u5165MySQL\u4e0eAMH\u5bc6\u7801\u5373\u8fdb\u5165\u5b89\u88c5\u6d41\u7a0b\uff0c\u5b89\u88c5\u8fc7\u7a0b\u5927\u7ea6\u970010\u81f320\u5206\u949f(\u4ee5\u670d\u52a1\u5668\u6027\u80fd\u4e3a\u51c6)\uff0c\u6700\u540e\u5982\u770b\u5230\u5b89\u88c5\u6210\u529f\u63d0\u793a\uff0c\u8bf4\u660e\u7cfb\u7edf\u5df2\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<p>\u6210\u529f\u5b89\u88c5\u540e\u6709\u5fc5\u8981\u8bf7\u5220\u9664\u65e5\u5fd7\u6587\u4ef6:amh.log\uff0c\u5982\u5b89\u88c5\u5931\u8d25\u9700\u534f\u52a9\u5b89\u88c5\u8bf7\u628a\u9519\u8bef\u65e5\u5fd7\u53cd\u9988\u7ed9\u5b98\u65b9\u3002<\/p>\n<p>\u8bbf\u95eehttp:\/\/ip:8888 \u5373\u53ef\u8fdb\u5165AMH web\u7aef\u7ba1\u7406\uff0c\u9ed8\u8ba4\u8d26\u53f7\u4e3aadmin\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u5f00\u59cb\u642d\u5efa\u7b7e\u5230\u7ad9\uff1a<\/p>\n<p>qiandao.today\uff1a\u4e00\u4e2a\u81ea\u52a8\u7b7e\u5230\u6846\u67b6 base on an HAR editor<\/p>\n<p><a class=\"dl\" title=\"\" href=\"https:\/\/github.com\/binux\/qiandao\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-original-title=\"\"><i class=\"fa fa-github-alt\"><\/i>\u5f00\u6e90\u5730\u5740<\/a><\/p>\n<p>\u4ee5\u4e0b\u6587\u4e2d\u4ee3\u7801\u524d\u5e26#\u7684\u4e3a\u6ce8\u91ca\uff0c\u4e0d\u4e00\u5b9a\u6b63\u786e\uff0c\u53ef\u4ee5\u5ffd\u89c6\uff0c\u4ec5\u505a\u53c2\u8003\u548c\u5907\u6ce8\u7528\u3002<\/p>\n<p>\u5347\u7ea7python 2.6.6 -&gt; 2.7.13<\/p>\n<p>\u5b89\u88c5pip<\/p>\n<p>1) \u5347\u7ea7Python2.7<\/p>\n<p><strong>\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e2d\u7684 Python \u7248\u672c<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">python --version<\/code><\/pre>\n<p>\u8fd4\u56de Python 2.6.6 \u3002<\/p>\n<p><strong>\u68c0\u67e5 CentOS \u7248\u672c<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">cat \/etc\/redhat-release<\/code><\/pre>\n<p>\u8fd4\u56de CentOS release 6.9 (Final) \u3002<\/p>\n<p><strong>\u4e0b\u8f7d\u3001\u7f16\u8bd1\u548c\u5b89\u88c5 Python 2.7.13<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">wget https:\/\/www.python.org\/ftp\/python\/2.7.13\/Python-2.7.13.tgz\ntar zxf Python-2.7.13.tgz\ncd Python-2.7.13\n.\/configure\nmake &amp;&amp; make install<\/code><\/pre>\n<p>\u9ed8\u8ba4 Python 2.7.13 \u4f1a\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u3002\u67e5\u8be2\u547d\u4ee4<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">ll -tr \/usr\/local\/bin\/python*\n#\u8fd4\u56de\u7ed3\u679c\uff1a\n \/usr\/local\/bin\/python2.7\n \/usr\/local\/bin\/python2.7-config\n \/usr\/local\/bin\/python -&gt; python2\n \/usr\/local\/bin\/python2 -&gt; python2.7\n \/usr\/local\/bin\/python2-config -&gt; python2.7-config\n \/usr\/local\/bin\/python-config -&gt; python2-config<\/code><\/pre>\n<p>\u800c\u7cfb\u7edf\u81ea\u5e26\u7684 Python \u662f\u5728 \/usr\/bin \u76ee\u5f55\u4e0b\u3002\u67e5\u8be2\u547d\u4ee4<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">ll -tr \/usr\/local\/bin\/python*\n#\u8fd4\u56de\u7ed3\u679c\uff1a\n \/usr\/local\/bin\/python2.7\n \/usr\/local\/bin\/python2.7-config\n \/usr\/local\/bin\/python -&gt; python2\n \/usr\/local\/bin\/python2 -&gt; python2.7\n \/usr\/local\/bin\/python2-config -&gt; python2.7-config\n \/usr\/local\/bin\/python-config -&gt; python2-config<\/code><\/pre>\n<p>\u800c\u7cfb\u7edf\u81ea\u5e26\u7684 Python \u662f\u5728 \/usr\/bin \u76ee\u5f55\u4e0b\u3002\u67e5\u8be2\u547d\u4ee4<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">ll -tr \/usr\/bin\/python*\n#\u8fd4\u56de\u7ed3\u679c\n \/usr\/bin\/python2.6-config\n \/usr\/bin\/python2.6\n \/usr\/bin\/python\n \/usr\/bin\/python2 -&gt; python\n \/usr\/bin\/python-config -&gt; python2.6-config<\/code><\/pre>\n<p><strong>\u66f4\u65b0\u7cfb\u7edf\u9ed8\u8ba4 Python \u7248\u672c<\/strong><\/p>\n<p>\u5148\u628a\u7cfb\u7edf\u9ed8\u8ba4\u7684\u65e7\u7248 Python \u91cd\u547d\u540d\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">mv \/usr\/bin\/python \/usr\/bin\/python2.6.6<\/code><\/pre>\n<p>\u518d\u5220\u9664\u7cfb\u7edf\u9ed8\u8ba4\u7684 python-config \u8f6f\u94fe\u63a5\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">rm -f \/usr\/bin\/python-config<\/code><\/pre>\n<p>\u6700\u540e\u521b\u5efa\u65b0\u7248\u672c\u7684 Python \u8f6f\u94fe\u63a5\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">ln -s \/usr\/local\/bin\/python \/usr\/bin\/python\nln -s \/usr\/local\/bin\/python-config \/usr\/bin\/python-config\nln -s \/usr\/local\/include\/python2.7\/ \/usr\/include\/python2.7<\/code><\/pre>\n<p>\u4ee5\u4e0a\u6b65\u9aa4\u505a\u5b8c\u4ee5\u540e\uff0c\u76ee\u5f55 \/usr\/bin \u4e0b\u7684 Python \u5e94\u8be5\u662f<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">ll -tr \/usr\/bin\/python*\n#\u8fd4\u56de\u7ed3\u679c\uff1a\n\/usr\/bin\/python2.6-config\n\/usr\/bin\/python2.6\n\/usr\/bin\/python2.6.6\n\/usr\/bin\/python2 -&gt; python\n\/usr\/bin\/python -&gt; \/usr\/local\/bin\/python\n\/usr\/bin\/python-config -&gt; \/usr\/local\/bin\/python-config<\/code><\/pre>\n<p><strong>\u67e5\u770b\u65b0\u7684 Python \u7248\u672c<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">python --version<\/code><\/pre>\n<p>\u8fd4\u56de\u7ed3\u679c\uff1a Python 2.7.13 \u3002<\/p>\n<p><strong>yum\u4e0d\u517c\u5bb9Python2.7\uff0c\u9700\u8981\u6307\u5b9a\u4e3a\u539f\u7248\u672c<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">vi \/usr\/bin\/yum\n\u5c06\"!\/usr\/bin\/python\"\u6539\u4e3a\"!\/usr\/bin\/python2.6.6\"<\/code><\/pre>\n<p>2) \u51c6\u5907\u57fa\u7840\u73af\u5883<br data-filtered=\"filtered\" \/>2.1) \u5b89\u88c5setuptools<\/p>\n<p><strong>\u4e3a\u65b0\u7248 Python \u5b89\u88c5 setuptools<\/strong><\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">wget https:\/\/bootstrap.pypa.io\/ez_setup.py -O - | python<\/code><\/pre>\n<p><strong>\u8fd9\u4e00\u6b65\u51fa\u9519\u7684\uff0c\u624b\u52a8\u4e0b\u8f7d\u4e86\u5b89\u88c5\u5305\u7136\u540e\u585e\u8fdbVPS\u518d\u6b21\u8fd0\u884c\u811a\u672c<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>setuptools \u6b63\u786e\u5b89\u88c5\u5b8c\u6210\u540e\uff0ceasy_install \u547d\u4ee4\u5c31\u4f1a\u88ab\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u4e86\u3002\u8fd9\u91cc\u4e5f\u9700\u8981\u505a\u8f6f\u94fe\u63a5\uff0c\u5426\u5219easy_install\u7684\u4f7f\u7528\u4f1a\u51fa\u9519\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">rm -rf \/usr\/bin\/easy_install\nln -s \/usr\/local\/bin\/easy_install \/usr\/bin\/easy_install<\/code><\/pre>\n<p>2.2) \u5b89\u88c5pip<\/p>\n<p>\u4e3a\u65b0\u7248 Python \u5b89\u88c5 pip<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">easy_install pip<\/code><\/pre>\n<p>\u6b63\u786e\u5b89\u88c5\u5b8c\u6210\u540e\uff0cpip \u547d\u4ee4\u5c31\u4f1a\u88ab\u5b89\u88c5\u5728 \/usr\/local\/bin \u76ee\u5f55\u4e0b\u4e86\u3002\u4e3a\u4e86pip\u6b63\u5e38\u4f7f\u7528\uff0c\u4e5f\u9700\u8981\u505a\u8f6f\u94fe\u63a5<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">rm -rf \/usr\/bin\/pip\nln -s \/usr\/local\/bin\/pip \/usr\/bin\/pip<\/code><\/pre>\n<p>2.3) \u5b89\u88c5virtualenv<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">su\npip install virtualenv\npip install virtualenvwrapper<\/code><\/pre>\n<p>virtualenv\u7528\u4e8e\u521b\u5efa\u9694\u79bb\u7684Python\u8fd0\u884c\u73af\u5883\uff0c\u4f9d\u8d56\u4e0d\u540c\u5e93\u548c\u7248\u672c\u65f6\u907f\u514d\u6df7\u4e71\u3002<br data-filtered=\"filtered\" \/>virtualenvwrapper\u4e3avirtualenv\u4e0a\u7684\u6269\u5c55\uff0c\u63d0\u4f9b\u66f4\u65b9\u4fbf\u7684\u547d\u4ee4\u3002<\/p>\n<p>3\uff09\u6309\u7167github\u8bf4\u660e\u5b89\u88c5qiandao.today\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">yum install python-devel\npip install tornado u-msgpack-python jinja2 chardet requests pbkdf2 pycrypto\npip install mysql-connector==2.1.6<\/code><\/pre>\n<p>\u5728AMH\u4e2d\u5efa\u7acbmysql\u6570\u636e\u5e93\uff0c\u8bbe\u7f6e\u7528\u6237\u540d\u5bc6\u7801\u7b49\u540e\u5728AMH\u4e2d\u88c5\u4e2aphpMyAdmin\u6a21\u5757\u5c06qiandao.sql\u6570\u636e\u5e93\u4e2d\u5bfc\u5165<\/p>\n<p>\u4fee\u6539qiandao\u6e90\u7801\u4e2dconfig.py\uff0c\u6dfb\u52a0\u81ea\u5df1\u7684\u6570\u636e\u5e93\u4fe1\u606f\uff0c\u540c\u65f6\u5c06<\/p>\n<p>db_type = os.getenv(\u2018DB_TYPE\u2019, \u2018sqlite3\u2019)<\/p>\n<p>\u6539\u4e3a<\/p>\n<p>db_type = os.getenv(\u2018DB_TYPE\u2019, \u2018mysql\u2019)<\/p>\n<p>\u5c06\u7b7e\u5230\u6e90\u7801\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u81ea\u5df1\u7684\u76ee\u5f55\u4e2d\uff0c\u6bd4\u5982qiandao\uff0c\u7ed9\u4e8e\u53ef\u6267\u884c\u6743\u9650<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">chmod +x -R \/qiandao<\/code><\/pre>\n<p>\u5148\u8bd5\u8fd0\u884c\u4e00\u4e0b\uff0c\u53ef\u4ee5\u770b\u5230IP\u548c\u7aef\u53e3<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">python \/qiandao\/run.py<\/code><\/pre>\n<p>\u4e00\u5207\u5b8c\u5584\u540e\u518d\u7528\u5230\u540e\u53f0\u8fd0\u884c\u811a\u672c\uff08\u6ce8\u610f\u81ea\u5df1run.py\u7684\u8def\u5f84\uff09\uff0c\u4e5f\u53ef\u6dfb\u52a0\u5230\u5f00\u673a\u81ea\u542f\u52a8\u5217\u8868\/etc\/rc.d\/rc.local\u4e2d<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">nohup python \/qiandao\/run.py &gt;\/dev\/null 2&gt;nohup.out &amp;<\/code><\/pre>\n<p>\u6ce8\u518c\u4e00\u4e2a\u8d26\u53f7\u540e\u8bbe\u7f6e\u7ba1\u7406\u5458\uff0c\u53ef\u76f4\u63a5\u7528\u547d\u4ee4\u6216\u8005\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u5c06\u7528\u6237\u7684 role\u503c\u8d4b\u4e88\u4e3aadmin<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">\/qiandao\/chrole.py your@email.address admin<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u505c\u6b62\u8fd0\u884c\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\">\u6267\u884c\u547d\u4ee4\uff1a\nps -ax|grep run.py \n\u56de\u8f66 \n\u67e5\u8be2\u5176\u8fdb\u7a0b\u5982\n2633 pts\/1 S 0:01 python \/qiandao\/run.py \n\u8bf4\u660ePID\u4e3a2633\uff0c\u90a3\u4e48\u5c31\u5f3a\u5236\u6740\u6b7b\u6b64\u8fdb\u7a0b\u547d\u4ee4\uff1a\nkill -9 2633   #-9\u7684\u610f\u601d\u662f\u5f3a\u5236<\/code><\/pre>\n<p>4\uff09\u914d\u7f6e\u53cd\u4ee3\u3002<\/p>\n<p>5\uff09\u4e0b\u8f7d\u83b7\u53d6cookie\u63d2\u4ef6\u5e76\u4fee\u6539\u9002\u914d\u7f51\u7ad9\u3002\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t\t\t&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"http:\/\/www.zhangyijun.com\/?p=90\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=90"}],"version-history":[{"count":0,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhangyijun.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}