{"id":2290,"date":"2017-10-26T14:03:28","date_gmt":"2017-10-26T06:03:28","guid":{"rendered":"http:\/\/learn-house.idv.tw\/?p=2290"},"modified":"2017-10-27T18:29:02","modified_gmt":"2017-10-27T10:29:02","slug":"raspberry-pi-3-ubuntu-mate-16-04-apache-php-7-and-mysql%e5%ae%89%e8%a3%9d","status":"publish","type":"post","link":"https:\/\/learn-house.idv.tw\/?p=2290","title":{"rendered":"[Raspberry Pi 3] Ubuntu-mate 16.04 Apache, PHP 7\u548cMySQL\u5b89\u88dd"},"content":{"rendered":"<p>\u7576\u521d\u8cb7\u6a39\u6885\u6d3e\u5c31\u662f\u60f3\u8981\u67b6\u4e00\u53f0\u5c0f\u578b\u4e0d\u5360\u7a7a\u9593\uff0c\u53c8\u7701\u96fb\u7684\u4e00\u53f0Server<br \/>\n\u9996\u8981\u5de5\u4f5c\u5c31\u662f\u628a\u6211\u7684Blog\u79fb\u56de\u4f86\u81ea\u5df1\u7ba1\u7406\uff0c\u6240\u4ee5LAMP(Linux, Apache, MySQL, PHP)\u662f\u5fc5\u8981\u7684<\/p>\n<h2>\u5b89\u88ddMySQL<\/h2>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#apt-get -y install mysql-server mysql-client<\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\u4e0b\u5217\u7684\u984d\u5916\u5957\u4ef6\u5c07\u88ab\u5b89\u88dd\uff1a<br \/>\nlibaio1 libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5 libfcgi-perl libhtml-template-perl linux-firmware mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7<br \/>\nmysql-server-core-5.7<br \/>\n\u5efa\u8b70\u5957\u4ef6\uff1a<br \/>\nlibipc-sharedcache-perl mailx tinyca<br \/>\n\u4e0b\u5217\u3010\u65b0\u3011\u5957\u4ef6\u5c07\u6703\u88ab\u5b89\u88dd\uff1a<br \/>\nlibaio1 libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5 libfcgi-perl libhtml-template-perl mysql-client mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server<br \/>\nmysql-server-5.7 mysql-server-core-5.7<br \/>\n\u4e0b\u5217\u5957\u4ef6\u5c07\u6703\u88ab\u5347\u7d1a\uff1a<br \/>\nlinux-firmware<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><!--more--><br \/>\nMySQL\u7684\u5b89\u5168\u6027\u8a2d\u5b9a\uff0c\u53ef\u4ee5\u53c3\u8003\u6211\u6a19\u8a3b\u70ba<span style=\"color: #ff0000;\">\u7d05\u8272<\/span>\u7684\u8a2d\u5b9a<\/p>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\n<p>#mysql_secure_installation<\/p>\n<p>Securing the MySQL server deployment.<\/p>\n<p>Enter password for user root:<\/p>\n<p>VALIDATE PASSWORD PLUGIN can be used to test passwords<br \/>\nand improve security. It checks the strength of password<br \/>\nand allows the users to set only those passwords which are<br \/>\nsecure enough. Would you like to setup VALIDATE PASSWORD plugin?<\/p>\n<p>Press y|Y for Yes, any other key for No: <span style=\"color: #ff0000;\"><strong>n<\/strong><\/span><br \/>\nUsing existing password for root.<br \/>\nChange the password for root ? ((Press y|Y for Yes, any other key for No) : <span style=\"color: #ff0000;\"><strong>n<\/strong><\/span><\/p>\n<p>&#8230; skipping.<br \/>\nBy default, a MySQL installation has an anonymous user,<br \/>\nallowing anyone to log into MySQL without having to have<br \/>\na user account created for them. This is intended only for<br \/>\ntesting, and to make the installation go a bit smoother.<br \/>\nYou should remove them before moving into a production<br \/>\nenvironment.<\/p>\n<p>Remove anonymous users? (Press y|Y for Yes, any other key for No) : <span style=\"color: #ff0000;\"><strong>y<\/strong><\/span><br \/>\nSuccess.<\/p>\n<p>Normally, root should only be allowed to connect from<br \/>\n&#8216;localhost&#8217;. This ensures that someone cannot guess at<br \/>\nthe root password from the network.<\/p>\n<p>Disallow root login remotely? (Press y|Y for Yes, any other key for No) : <span style=\"color: #ff0000;\"><strong>y<\/strong><\/span><br \/>\nSuccess.<\/p>\n<p>By default, MySQL comes with a database named &#8216;test&#8217; that<br \/>\nanyone can access. This is also intended only for testing,<br \/>\nand should be removed before moving into a production<br \/>\nenvironment.<\/p>\n<p>Remove test database and access to it? (Press y|Y for Yes, any other key for No) : <span style=\"color: #ff0000;\"><strong>y<\/strong><\/span><br \/>\n&#8211; Dropping test database&#8230;<br \/>\nSuccess.<\/p>\n<p>&#8211; Removing privileges on test database&#8230;<br \/>\nSuccess.<\/p>\n<p>Reloading the privilege tables will ensure that all changes<br \/>\nmade so far will take effect immediately.<\/p>\n<p>Reload privilege tables now? (Press y|Y for Yes, any other key for No) : <span style=\"color: #ff0000;\"><strong>y<\/strong><\/span><br \/>\nSuccess.<\/p>\n<p>All done!<\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5b89\u88ddApache<\/h2>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#apt-get -y install apache2<\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\u4e0b\u5217\u7684\u984d\u5916\u5957\u4ef6\u5c07\u88ab\u5b89\u88dd\uff1a<br \/>\napache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0<br \/>\n\u5efa\u8b70\u5957\u4ef6\uff1a<br \/>\napache2-doc apache2-suexec-pristine | apache2-suexec-custom<br \/>\n\u4e0b\u5217\u3010\u65b0\u3011\u5957\u4ef6\u5c07\u6703\u88ab\u5b89\u88dd\uff1a<br \/>\napache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5b89\u88ddPHP 7<\/h2>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#apt-get -y install php7.0 libapache2-mod-php7.0<\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\u4e0b\u5217\u7684\u984d\u5916\u5957\u4ef6\u5c07\u88ab\u5b89\u88dd\uff1a<br \/>\nphp-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline<br \/>\n\u5efa\u8b70\u5957\u4ef6\uff1a<br \/>\nphp-pear<br \/>\n\u4e0b\u5217\u3010\u65b0\u3011\u5957\u4ef6\u5c07\u6703\u88ab\u5b89\u88dd\uff1a<br \/>\nlibapache2-mod-php7.0 php-common php7.0 php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4f7fMySQL\u652f\u63f4PHP<\/h2>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext<\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\u4e0b\u5217\u7684\u984d\u5916\u5957\u4ef6\u5c07\u88ab\u5b89\u88dd\uff1a<br \/>\nlibc-client2007e libmcrypt4 librecode0 libtidy-0.99-0 libxmlrpc-epi0 mlock php-xml php7.0-xml ttf-dejavu-core<br \/>\n\u5efa\u8b70\u5957\u4ef6\uff1a<br \/>\nuw-mailutils libmcrypt-dev mcrypt memcached<br \/>\n\u4e0b\u5217\u3010\u65b0\u3011\u5957\u4ef6\u5c07\u6703\u88ab\u5b89\u88dd\uff1a<br \/>\nlibc-client2007e libmcrypt4 librecode0 libtidy-0.99-0 libxmlrpc-epi0 mlock php-gettext php-imagick php-memcache php-pear php-xml php7.0-curl php7.0-gd<br \/>\nphp7.0-imap php7.0-intl php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xml php7.0-xmlrpc php7.0-xsl ttf-dejavu-core<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5b89\u88ddphpMyAdmin<\/h2>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#apt-get -y install phpmyadmin<\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">\u4e0b\u5217\u7684\u984d\u5916\u5957\u4ef6\u5c07\u88ab\u5b89\u88dd\uff1a<br \/>\ndbconfig-common dbconfig-mysql libjs-sphinxdoc libjs-underscore php-phpseclib php-tcpdf<br \/>\n\u5efa\u8b70\u5957\u4ef6\uff1a<br \/>\nphp-libsodium php-gmp<br \/>\n\u4e0b\u5217\u3010\u65b0\u3011\u5957\u4ef6\u5c07\u6703\u88ab\u5b89\u88dd\uff1a<br \/>\ndbconfig-common dbconfig-mysql libjs-sphinxdoc libjs-underscore php-phpseclib php-tcpdf phpmyadmin<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b89\u88dd\u904e\u7a0b\u81ea\u52d5\u5e36\u51fa\u8a2d\u5b9a\uff0c\u4e00\u6a23\u53ef\u4ee5\u53c3\u8003\u6211\u6a19\u8a3b\u70ba<span style=\"color: #ff0000;\">\u7d05\u8272<\/span>\u7684\u8a2d\u5b9a<\/p>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">Please choose the web server that should be automatically configured to run phpMyAdmin.<br \/>\nWeb server to reconfigure automatically: <span style=\"color: #ff0000;\"><strong>apache2<\/strong><\/span><\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">The phpmyadmin package must have a database installed and configured before it can be used. This can be optionally handled with dbconfig-common.<br \/>\nIf you are an advanced database administrator and know that you want to perform this configuration manually, or if your database has already been<br \/>\ninstalled and configured, you should refuse this option. Details on what needs to be done should most likely be provided in \/usr\/share\/doc\/phpmyadmin.<br \/>\nOtherwise, you should probably choose this option.<br \/>\nConfigure database for phpmyadmin with dbconfig-common? <span style=\"color: #ff0000;\"><strong>Yes<\/strong><\/span><\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">Please provide a password for phpmyadmin to register with the database server. If left blank, a random password will be generated.<br \/>\nMySQL application password for phpmyadmin: <span style=\"color: #ff0000;\"><strong>********<\/strong><\/span><\/div>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">Password confirmation: <span style=\"color: #ff0000;\"><strong>********<\/strong><\/span><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u91cd\u555fApache<\/p>\n<table style=\"border: 1px solid #fcfcfc; padding: 4px; background-color: #000000;\" width=\"100%\">\n<tbody>\n<tr>\n<td>\n<div style=\"padding: 8px; color: #ffffff; line-height: 1.5;\">#systemctl restart apache2<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ba1\u7406\u7db2\u5740<br \/>\nhttp:\/\/10.0.0.49\/phpmyadmin<\/p>\n<h2>\u53e6\u5916\u5b89\u88dd<\/h2>\n<p>\u5b89\u88ddOpcache + APCu PHP cache\u4f86\u52a0\u901fPHP<br \/>\napt-get -y install php7.0-opcache php-apcu<\/p>\n<p>\u555f\u52d5SSL<br \/>\na2enmod ssl<br \/>\na2ensite default-ssl<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7576\u521d\u8cb7\u6a39\u6885\u6d3e\u5c31\u662f\u60f3\u8981\u67b6\u4e00\u53f0\u5c0f\u578b\u4e0d\u5360\u7a7a\u9593\uff0c\u53c8\u7701\u96fb\u7684\u4e00\u53f0Server \u9996\u8981\u5de5\u4f5c\u5c31\u662f\u628a\u6211\u7684Blog\u79fb\u56de\u4f86\u81ea\u5df1\u7ba1\u7406\uff0c\u6240<span class=\"post-excerpt-end\">&hellip;<\/span><\/p>\n<p class=\"more-link\"><a href=\"https:\/\/learn-house.idv.tw\/?p=2290\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2290","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2290"}],"version-history":[{"count":0,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/2290\/revisions"}],"wp:attachment":[{"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learn-house.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}