{"id":690,"date":"2020-01-17T16:51:23","date_gmt":"2020-01-17T08:51:23","guid":{"rendered":"http:\/\/www.x1985.org\/?p=690"},"modified":"2020-01-19T14:30:07","modified_gmt":"2020-01-19T06:30:07","slug":"%e2%99%9e%e6%a0%91%e8%8e%93%e6%b4%be%e4%b9%8b%e5%ae%89%e8%a3%85lamp","status":"publish","type":"post","link":"http:\/\/www.x1985.org\/?p=690","title":{"rendered":"\u265e\u6811\u8393\u6d3e\u4e4b\u5b89\u88c5LAMP"},"content":{"rendered":"<pre title=\"\u7cfb\u7edf\u57fa\u672c\u4fe1\u606f\" class=\"lang:sh decode:true\">#\u4f7f\u7528\u955c\u50cf\r\n2019-09-26-raspbian-buster-lite.img\r\n#\u7cfb\u7edf\u4fe1\u606f\r\nsudo uname -a\r\n#Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU\/Linux<\/pre>\n<pre title=\"\u57fa\u672c\u5e95\u5c42\u5b89\u88c5\" class=\"lang:sh decode:true\">\u5b89\u88c5Apache2\r\nsudo apt-get install apache2\r\n#\u5b89\u88c5PHP7.3\r\nsudo apt install -y -t buster php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-xmlrpc php7.3-zip\r\n#Apache\u5173\u8054PHP7.3\r\nsudo apt install libapache2-mod-php7.3\r\n#\u5b89\u88c5MariaDB\r\nsudo apt install mariadb-server\r\n\r\n#MariaDB\u521d\u59cb\u5316\u547d\u4ee4\r\nmysql_secure_installation\r\n\r\n#\u5b89\u88c5phpmyadmin\r\nsudo apt install phpmyadmin\r\n#\u5728\u7f51\u7ad9\u6839\u76ee\u5f55\u505a\u6587\u4ef6\u6620\u5c04\r\nsudo ln -s \/usr\/share\/phpmyadmin \/var\/www\/html\/phpmyadmin<\/pre>\n<pre title=\"Apache2\u8bbe\u7f6e\u9ed8\u8ba4\u4e3b\u9762\u987a\u5e8f\" class=\"lang:sh decode:true \">cd \/etc\/apache2\/mods-enabled\r\nsudo nano dir.conf\r\n#\u5728DirectoryIndex\u540e\u9762\u8c03\u6574\u6216\u6dfb\u52a0\u65b0\u7684\u4e3b\u9875<\/pre>\n<p>&nbsp;<\/p>\n<pre title=\"MariaDB\u521d\u59cb\u5316\u8fc7\u7a0b\u8bf4\u660e\" class=\"height-set:true height:200 lang:sh decode:true\">NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\n  \r\nIn order to log into MariaDB to secure it, we'll need the current\r\npassword for the root user.  If you've just installed MariaDB, and\r\nyou haven't set the root password yet, the password will be blank,\r\nso you should just press enter here.\r\n  \r\nEnter current password for root (enter for none): #--&gt;\u8f93\u5165root\u5bc6\u7801\uff0c\u76f4\u63a5\u56de\u8f66\r\nOK, successfully used password, moving on...\r\n  \r\nSetting the root password ensures that nobody can log into the MariaDB\r\nroot user without the proper authorisation.\r\n  \r\nSet root password? [Y\/n] y    #--&gt;\u8bbe\u7f6eroot\u5bc6\u7801   \r\nNew password: \r\nRe-enter new password: \r\nPassword updated successfully!\r\nReloading privilege tables..\r\n ... Success!\r\n  \r\n  \r\nBy default, a MariaDB installation has an anonymous user, allowing anyone\r\nto log into MariaDB without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\n  \r\nRemove anonymous users? [Y\/n] y    #--&gt;\u5220\u9664\u533f\u540d\u7528\u6237\r\n ... Success!\r\n  \r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\n  \r\nDisallow root login remotely? [Y\/n] y    #--&gt;\u7981\u6b62root\u8fdc\u7a0b\u767b\u5f55\r\n ... Success!\r\n  \r\nBy default, MariaDB comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\n  \r\nRemove test database and access to it? [Y\/n] y    #--&gt;\u5220\u9664test\u6570\u636e\u5e93\u548c\u5bf9\u6b64\u6570\u636e\u5e93\u7684\u8bbf\u95ee\u6743\u9650\r\n - Dropping test database...\r\n ... Success!\r\n - Removing privileges on test database...\r\n ... Success!\r\n  \r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\n  \r\nReload privilege tables now? [Y\/n] y    #--&gt;\u7acb\u5373\u5237\u65b0\u6743\u9650\r\n ... Success!\r\n  \r\nCleaning up...\r\n  \r\nAll done!  If you've completed all of the above steps, your MariaDB\r\ninstallation should now be secure.\r\n  \r\nThanks for using MariaDB!<\/pre>\n<pre title=\"MariaDB\u5f00\u8fdc\u7a0b\u8bbf\u95ee\" class=\"height-set:true height:200 lang:mysql decode:true\">#--&gt;\u7ec8\u7aef\u4e0b\u8f93\u5165mysql -uroot -p \u8fdb\u5165\u6570\u636e\u5e93\r\n#\u663e\u793a\u6240\u6709\u8868\r\nshow tables;\r\n#\u4f7f\u7528mysql\u6570\u636e\u5e93\r\nuse mysql;\r\n#\u663e\u793auser\u8868\u7684Host\u3001User\u5b57\u6bb5\r\nselect Host,User from user;\r\n\r\n#\u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237\r\nCREATE USER '\u7528\u6237\u540d'@'%' IDENTIFIED BY '\u7528\u6237\u5bc6\u7801';\r\n#\u8d4b\u4e88\u6240\u6709\u6743\u9650\r\nGRANT ALL PRIVILEGES ON *.* TO '\u7528\u6237\u540d'@'%' WITH GRANT OPTION;\r\n##\u7b80\u5316\u65b9\u6848\u521b\u5efa\u7528\u6237\u4e0e\u8d4b\u4e88\u6743\u9650\u5728\u4e00\u8d77\u6267\u884c\r\n# GRANT ALL PRIVILEGES ON *.* TO '\u7528\u6237\u540d'@'%' IDENTIFIED BY '\u7528\u6237\u5bc6\u7801' WITH GRANT OPTION;\r\n##\r\n\r\n#\u5237\u65b0\u6743\u9650\r\nflush privileges;\r\n\r\n#--&gt;\u7ec8\u7aef\u4e0b\u8f93\u5165service mariadb restart \u91cd\u542f\u6570\u636e\u5e93\r\n<\/pre>\n<pre title=\"MariaDB\u65e0\u6cd5\u8fdc\u7a0b\u8fde\u63a5\u95ee\u9898\u89e3\u51b3\" class=\"lang:sh decode:true\">sudo nano \/etc\/mysql\/my.cnf\r\n#\u7981\u7528\u6389bind_address\u5c5e\u6027\uff0c\u56e0\u4e3a\u8fd9\u91cc\u7ed1\u5b9a\u7684127.0.0.1\u662f\u672c\u5730\u56de\u65cb\u5730\u5740\u3002<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#\u4f7f\u7528\u955c\u50cf 2019-09-26-raspbian-buster-lite.img #\u7cfb\u7edf\u4fe1\u606f sudo un [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":584,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71],"tags":[88,87,84,45,44],"_links":{"self":[{"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/posts\/690"}],"collection":[{"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.x1985.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=690"}],"version-history":[{"count":9,"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/posts\/690\/revisions"}],"predecessor-version":[{"id":700,"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/posts\/690\/revisions\/700"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.x1985.org\/index.php?rest_route=\/wp\/v2\/media\/584"}],"wp:attachment":[{"href":"http:\/\/www.x1985.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.x1985.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=690"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.x1985.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}