{"id":73,"date":"2020-03-08T00:00:47","date_gmt":"2020-03-07T16:00:47","guid":{"rendered":"http:\/\/www.izzd.net\/blog\/?p=73"},"modified":"2021-04-24T03:53:33","modified_gmt":"2021-04-23T19:53:33","slug":"%e8%ae%ba%e5%9d%9b%e6%90%ac%e8%bf%81%e4%b9%8b%e4%b8%80%ef%bc%9a%e5%9c%a8%e6%a0%91%e8%8e%93%e6%b4%be%e4%b8%8a%e6%90%ad%e5%bb%ba%e7%bd%91%e7%ab%99%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/izzd.net\/blog\/73.html","title":{"rendered":"\u8bba\u575b\u642c\u8fc1\u4e4b\u4e00\uff1a\u5728\u6811\u8393\u6d3e\u4e0a\u642d\u5efa\u7f51\u7ad9\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u80cc\u666f\uff1a<br \/>\n\u586b\u5751\u8fdc\u53e4\u8bba\u575b\uff0c\u6253\u7b97\u5c06\u65e7\u7248\u7cfb\u7edf\uff08Discuz! 7.0.0\uff09\u8fc1\u79fb\u81f3\u6811\u8393\u6d3e \uff0c\u7528\u4e8e\u5907\u4efd\u548c\u5347\u7ea7\u6d4b\u8bd5<\/p>\n<p>\u76ee\u6807\uff1a<br \/>\n\u5728\u6811\u8393\u6d3e\u4e0a\u6784\u5efa LAMP\uff08Linux \/ Apacha \/ MySQL \/ PHP\uff09\u5806\u6808\uff0c\u5b89\u88c5 phpMyAdmin \u5b9e\u73b0\u6570\u636e\u5e93\u7684\u56fe\u5f62\u5316\u7ba1\u7406<\/p>\n<p>\u6761\u4ef6\uff1a<br \/>\n\u6811\u8393\u6d3e 2B\uff08Raspbian OS\uff09<\/p>\n<p><!--more--><\/p>\n<h2>1. \u66f4\u65b0\u5347\u7ea7<\/h2>\n<p>\u5f00\u59cb\u524d\uff0c\u786e\u4fdd\u6811\u8393\u6d3e\u5df2\u5347\u7ea7\u81f3\u6700\u65b0<\/p>\n<blockquote><p>$ sudo apt update &amp;&amp; sudo apt upgrade -y<\/p><\/blockquote>\n<h2>2. \u5b89\u88c5 Apache 2<\/h2>\n<blockquote><p>$ sudo apt install apache2 -y<\/p><\/blockquote>\n<p>\u6d4b\u8bd5\u7f51\u7ad9\u670d\u52a1\u5668\uff1a\/var\/www\/html \u8def\u5f84\u4e2d\u6709\u4e86 index.html\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u6811\u8393\u6d3e\u7684 ip \u5730\u5740\uff0c\u53ef\u4ee5\u770b\u5230\u8be5\u7f51\u9875<\/p>\n<p><a href=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/apache2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-76\" src=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/apache2.jpg\" alt=\"\" width=\"500\" height=\"167\" srcset=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/apache2.jpg 829w, https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/apache2-300x100.jpg 300w, https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/apache2-768x257.jpg 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<h2>3. \u5b89\u88c5 PHP<\/h2>\n<blockquote><p>$ sudo apt install php -y<\/p><\/blockquote>\n<p>\u6d4b\u8bd5 PHP \u811a\u672c\u73af\u5883\uff1a\u5220\u9664 index.html \u521b\u5efa PHP \u811a\u672c<\/p>\n<blockquote><p>$ cd \/var\/www\/html<br \/>\n$ sudo rm index.html<br \/>\n$ sudo nano index.php<\/p><\/blockquote>\n<p>\u5728 index.php \u4e2d\u5199\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<blockquote><p>&lt;?php echo &#8220;hello world&#8221;; ?&gt;<\/p><\/blockquote>\n<p><a href=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-77\" src=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest.jpg\" alt=\"\" width=\"500\" height=\"301\" srcset=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest.jpg 614w, https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest-300x181.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Ctrl+S \u4fdd\u5b58\u6587\u4ef6\uff0c\u7136\u540e Ctrl+X \u9000\u51fa\u7f16\u8f91\uff0c\u8bbf\u95ee\u6811\u8393\u6d3e ip \u5730\u5740\u53ef\u770b\u5230<\/p>\n<p><a href=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-78 size-full\" src=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest2.jpg\" alt=\"\" width=\"415\" height=\"152\" srcset=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest2.jpg 415w, https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phptest2-300x110.jpg 300w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/a><\/p>\n<p>\u5982\u679c\u65e0\u6548\u53ef\u91cd\u542f Apache \u670d\u52a1\u518d\u8bd5<\/p>\n<blockquote><p>$ sudo service apache2 restart<\/p><\/blockquote>\n<h2>4. \u5b89\u88c5 MySQL<\/h2>\n<p>\u9996\u5148\u5b89\u88c5 MySQL\uff08MariaDB \u670d\u52a1\u5668\uff09\u548c PHP-MySQL \u8f6f\u4ef6\u5305<\/p>\n<blockquote><p>$ cd ~<br \/>\n$ sudo apt install mariadb-server php-mysql -y<br \/>\n$ sudo service apache2 restart<\/p><\/blockquote>\n<p>\u6570\u636e\u5e93\u5b89\u5168\u914d\u7f6e<\/p>\n<blockquote><p>$ sudo mysql_secure_installation<\/p><\/blockquote>\n<h2>5. \u5b89\u88c5 phpMyAdmin<\/h2>\n<blockquote><p>sudo apt install phpmyadmin -y<\/p><\/blockquote>\n<p>\u5b89\u88c5\u7a0b\u5e8f\u4f1a\u63d0\u51e0\u4e2a\u95ee\u9898\uff08\u4f7f\u7528 dbconfig-common\uff09\u5e76\u8981\u6c42\u8bbe\u7f6e\u5bc6\u7801<\/p>\n<p>\u542f\u7528PHP MySQLi \u6269\u5c55\u5e76\u91cd\u542f Apache2 \u4f7f\u5176\u751f\u6548<\/p>\n<blockquote><p>$ sudo phpenmod mysqli<br \/>\n$ sudo service apache2 restart<\/p><\/blockquote>\n<p>\u8bbf\u95ee\u6811\u8393\u6d3e ip \u5730\u5740\u4e0b\u7684 \/phpmyadmin \u4f1a\u663e\u793a Not Found\uff0c\u539f\u56e0\u662f phpmyadmin \u6587\u4ef6\u5939\u6ca1\u6709\u7f6e\u4e8e\u00a0 \/var\/www\/html \u4e2d<\/p>\n<blockquote><p>$ cd \/var\/www\/html<br \/>\n$ sudo ln -s \/usr\/share\/phpmyadmin \/var\/www\/html\/phpmyadmin<\/p><\/blockquote>\n<p>\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\u4e86<\/p>\n<p><a href=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phpmyadmin.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-82 size-full\" src=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phpmyadmin.jpg\" alt=\"\" width=\"417\" height=\"532\" srcset=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phpmyadmin.jpg 417w, https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/phpmyadmin-235x300.jpg 235w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\" \/><\/a><\/p>\n<p>\u5982 phpMyAdmin \u4f7f\u7528 root \u767b\u9646\u51fa\u9519\uff0c\u53ef\u65b0\u5efa\u7528\u6237<\/p>\n<blockquote><p>$ sudo mysql -u root -p<br \/>\n&gt; create user username@localhost identified by &#8216;password&#8217;;<br \/>\n&gt; grant all privileges on *.* to username@localhost;<br \/>\n&gt; flush privileges;<br \/>\n&gt; exit;<\/p><\/blockquote>\n<p>(\u9000\u51fa\u65b9\u5f0f\u9664 exit; \u5916\u4e5f\u53ef\u4f7f\u7528 quit; \u6216\u6309\u952e Ctrl+D)<\/p>\n<h2>6. \u4fee\u6539\u6587\u4ef6\u6743\u9650<\/h2>\n<p>\u4e3a\u4fbf\u4e8e\u7ba1\u7406\uff0c\u4fee\u6539 \/var\/www\/html \u6587\u4ef6\u5939\u6743\u9650<\/p>\n<blockquote><p>$ ls -lh \/var\/www\/<br \/>\n$ sudo chown -R pi:www-data \/var\/www\/html\/<br \/>\n$ sudo chmod -R 770 \/var\/www\/html\/<br \/>\n$ ls -lh \/var\/www\/<\/p><\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88\" src=\"https:\/\/izzd.net\/blog\/wp-content\/uploads\/2021\/04\/permission.jpg\" alt=\"\" width=\"488\" height=\"150\" \/><\/p>\n<p>\u81f3\u6b64\u7f51\u7ad9\u8fd0\u884c\u73af\u5883\u51c6\u5907\u5b8c\u6bd5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f\uff1a \u586b\u5751\u8fdc\u53e4\u8bba\u575b\uff0c\u6253\u7b97\u5c06\u65e7\u7248\u7cfb\u7edf\uff08Discuz! 7.0.0\uff09\u8fc1\u79fb\u81f3\u6811\u8393\u6d3e \uff0c\u7528\u4e8e\u5907\u4efd\u548c\u5347\u7ea7\u6d4b\u8bd5 \u76ee\u6807\uff1a  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":17,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/posts\/73\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/izzd.net\/blog\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}