{"id":3531,"date":"2018-07-16T10:04:01","date_gmt":"2018-07-16T02:04:01","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=3531"},"modified":"2018-07-16T10:04:01","modified_gmt":"2018-07-16T02:04:01","slug":"ubuntu-17-10%e4%b8%8a%e5%ae%89%e8%a3%85lamp%ef%bc%88apache%ef%bc%8cmariadb%ef%bc%8cphp7-1%ef%bc%89","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/ubuntu-17-10%e4%b8%8a%e5%ae%89%e8%a3%85lamp%ef%bc%88apache%ef%bc%8cmariadb%ef%bc%8cphp7-1%ef%bc%89\/","title":{"rendered":"Ubuntu 17.10\u4e0a\u5b89\u88c5LAMP\uff08Apache\uff0cMariaDB\uff0cPHP7.1\uff09"},"content":{"rendered":"<p>\u6b65\u9aa41\uff1a\u66f4\u65b0\u8f6f\u4ef6\u5305<br \/>\n\u5728\u5b89\u88c5LAMP\u4e4b\u524d\uff0c\u6700\u597d\u66f4\u65b0\u5b58\u50a8\u5e93\u548c\u8f6f\u4ef6\u5305\u3002 \u5728\u60a8\u7684Ubuntu 17.10\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<br \/>\nsudo apt update<\/p>\n<p>sudo apt upgrade<\/p>\n<p>\u6b65\u9aa42\uff1a\u5b89\u88c5 Apache Web Server<br \/>\n\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Apache Web\u670d\u52a1\u5668\u3002\u8be5apache2-utils\u5305\u5c06\u5b89\u88c5\u4e00\u4e9b\u6709\u7528\u7684\u5b9e\u7528\u7a0b\u5e8f\uff0c\u5982Apache HTTP\u670d\u52a1\u5668\u57fa\u51c6\u6d4b\u8bd5\u5de5\u5177\uff08ab\uff09\u3002<br \/>\nsudo apt install -y apache2 apache2-utils<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5e94\u81ea\u52a8\u542f\u52a8Apache\u3002 \u4f7f\u7528systemctl\u68c0\u67e5\u5176\u72b6\u6001\u3002<br \/>\nsystemctl status apache2<br \/>\n\u8f93\u51fa\uff1a <\/p>\n<p>\u25cf apache2.service &#8211; The Apache HTTP Server<br \/>\n   Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset:<br \/>\n  Drop-In: \/lib\/systemd\/system\/apache2.service.d<br \/>\n           \u2514\u2500apache2-systemd.conf<br \/>\n   Active: <\/p>\n<p>active (running) since Sat 2017-10-28 14:37:01 CST; 3s ago<br \/>\n  Process: 17568 ExecStop=\/usr\/sbin\/apachectl stop (code=exited, status=0\/SUCCES<br \/>\n  Process: 17573 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCC<br \/>\n Main PID: 17577 (apache2)<br \/>\n    Tasks: 55 (limit: 4915)<br \/>\n   CGroup: \/system.slice\/apache2.service<br \/>\n           \u251c\u250017577 \/usr\/sbin\/apache2 -k start<br \/>\n           \u251c\u250017578 \/usr\/sbin\/apache2 -k start<br \/>\n           \u2514\u250017579 \/usr\/sbin\/apache2 -k start<br \/>\n\u5982\u679c\u6ca1\u6709\u8fd0\u884c\uff0c\u8bf7\u4f7f\u7528systemctl\u542f\u52a8\u5b83<br \/>\nsudo systemctl start apache2<br \/>\n\u4f7fApache\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8\u4e5f\u662f\u4e00\u4e2a\u597d\u65b9\u6cd5<br \/>\nsudo systemctl enable apache2<br \/>\n\u68c0\u67e5Apache\u7248\u672c\uff1a<br \/>\napache2 -v<br \/>\n\u8f93\u51fa:<br \/>\nServer version: Apache\/2.4.27 (Ubuntu)<br \/>\nServer built: 2017-09-18T15:05:48<\/p>\n<p>\u73b0\u5728\u5728\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u8f93\u5165Ubuntu 17.10\u670d\u52a1\u5668\u7684\u516c\u7f51IP\u5730\u5740\u3002 \u60a8\u5e94\u8be5\u770b\u5230\u201cIt works!\u201d\u7f51\u9875\uff0c\u8fd9\u610f\u5473\u7740Apache Web\u670d\u52a1\u5668\u6b63\u5e38\u8fd0\u884c\u3002 \u5982\u679c\u8981\u5728\u672c\u5730\u7684Ubuntu 17.10\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5LAMP\uff0c\u8bf7\u5728\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u952e\u5165127.0.0.1\u6216localhost\u3002<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u9700\u8981\u5c06www-data\uff08Apache\u7528\u6237\uff09\u8bbe\u7f6e\u4e3a\u6587\u6863\u6839\u76ee\u5f55\u7684\u6240\u6709\u8005\u3002 \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u7531root\u7528\u6237\u62e5\u6709\u3002<br \/>\nsudo chown www-data:www-data \/var\/www\/html\/ -R<\/p>\n<p>\u6b65\u9aa4 3: \u5b89\u88c5 MariaDB \u6570\u636e\u5e93\u670d\u52a1\u5668<br \/>\nMariaDB\u662fMySQL\u7684\u66ff\u4ee3\u54c1\u3002 \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5176\u5b89\u88c5\u5728Ubuntu 17.10\u4e0a\u3002<br \/>\nsudo apt install mariadb-server mariadb-client<br \/>\n\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0cMariaDB\u670d\u52a1\u5668\u5e94\u81ea\u52a8\u5f00\u542f\u3002 \u4f7f\u7528systemctl\u68c0\u67e5\u5176\u72b6\u6001\u3002<br \/>\nsystemctl status mariadb<br \/>\n\u8f93\u51fa:<br \/>\n\u25cf mariadb.service &#8211; MariaDB database server<br \/>\n   Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset:<br \/>\n   Active: active (running) since Sat 2017-10-21 14:53:04 CST; 11s ago<br \/>\n Main PID: 19695 (mysqld)<br \/>\n   Status: &#8220;Taking your SQL requests now&#8230;&#8221;<br \/>\n    Tasks: 26 (limit: 4915)<br \/>\n   CGroup: \/system.slice\/mariadb.service<br \/>\n           \u2514\u250019695 \/usr\/sbin\/mysqld<br \/>\n\u5982\u679c\u6ca1\u6709\u8fd0\u884c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8\u5b83\uff1a<br \/>\nsudo systemctl start mariadb<br \/>\n\u8981\u542f\u7528MariaDB\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u542f\u52a8\uff0c\u8bf7\u8fd0\u884c<br \/>\nsudo systemctl enable mariadb<br \/>\n\u73b0\u5728\u8fd0\u884c\u5b89\u88c5\u540e\u7684\u5b89\u5168\u811a\u672c\u3002<br \/>\nsudo mysql_secure_installation<br \/>\n \u5f53\u5b83\u8981\u6c42\u60a8\u8f93\u5165MariaDB root\u5bc6\u7801\u65f6\uff0c\u6309Enter\u952e\uff0c\u56e0\u4e3aroot\u5bc6\u7801\u5c1a\u672a\u8bbe\u7f6e\u3002 \u7136\u540e\u8f93\u5165y\u8bbe\u7f6eMariaDB\u670d\u52a1\u5668\u7684root\u5bc6\u7801\u3002<\/p>\n<p>\u8f93\u5165Y\u540e\uff0c\u8981\u8f93\u5165root\u5bc6\u7801\u4e24\u6b21\u3002<br \/>\n\u63a5\u4e0b\u6765\uff0c\u60a8\u53ef\u4ee5\u6309Enter\u56de\u7b54\u6240\u6709\u5269\u4f59\u7684\u95ee\u9898\uff0c\u8fd9\u5c06\u5220\u9664\u533f\u540d\u7528\u6237\uff0c\u7981\u7528\u8fdc\u7a0broot\u767b\u5f55\u548c\u5220\u9664\u6d4b\u8bd5\u6570\u636e\u5e93\u3002 \u6b64\u6b65\u9aa4\u662fMariaDB\u6570\u636e\u5e93\u5b89\u5168\u6027\u7684\u57fa\u672c\u8981\u6c42\u3002<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cUbuntu\u4e0a\u7684MaraiDB\u8f6f\u4ef6\u5305\u4f7f\u7528unix_socket\u5bf9\u7528\u6237\u767b\u5f55\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\uff0c\u8fd9\u4e3b\u8981\u8868\u793a\u60a8\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u767b\u5f55\u5230MariaDB\u63a7\u5236\u53f0\u3002 \u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55\uff0c\u800c\u4e0d\u63d0\u4f9bMariaDB root\u5bc6\u7801\u3002<br \/>\nsudo mariadb -u root<br \/>\n\u8981\u9000\u51fa\uff0c\u8fd0\u884c<br \/>\nexit;<br \/>\n\u68c0\u67e5MariaDB\u670d\u52a1\u5668\u7248\u672c\u4fe1\u606f\u3002<br \/>\nmariadb &#8211;version<br \/>\n\u8f93\u51fa:<br \/>\nmariadb Ver 15.1 Distrib 10.1.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2<\/p>\n<p>\u6b65\u9aa4 4: \u5b89\u88c5 PHP7.1<br \/>\n\u5728\u64b0\u5199\u672c\u6587\u65f6\uff0cPHP7.1\u662fPHP\u7684\u6700\u65b0\u7a33\u5b9a\u7248\u672c\uff0c\u5728PHP7.0\u4e0a\u5177\u6709\u8f83\u5c0f\u7684\u6027\u80fd\u4f18\u52bf\u3002 \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5PHP7.1\u3002<br \/>\nsudo apt install php7.1 libapache2-mod-php7.1 php7.1-mysql php-common php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-readline<\/p>\n<p>\u542f\u7528Apache php7.1\u6a21\u5757\uff0c\u7136\u540e\u91cd\u65b0\u542f\u52a8Apache Web\u670d\u52a1\u5668\u3002<br \/>\nsudo a2enmod php7.1<\/p>\n<p>sudo systemctl restart apache2<br \/>\n\u68c0\u67e5PHP\u7248\u672c\u4fe1\u606f\u3002<br \/>\nphp &#8211;version<br \/>\n\u8f93\u51fa:<br \/>\nPHP 7.1.8-1ubuntu1 (cli) (built: Aug  8 2017 15:57:37) ( NTS )<br \/>\nCopyright (c) 1997-2017 The PHP Group<br \/>\nZend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies<br \/>\n    with Zend OPcache v7.1.8-1ubuntu1, Copyright (c) 1999-2017, by Zend Technologies<\/p>\n<p>\u8981\u4f7f\u7528Apache\u670d\u52a1\u5668\u6d4b\u8bd5PHP\u811a\u672c\uff0c\u6211\u4eec\u9700\u8981\u5728\u6587\u6863\u6839\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2ainfo.php\u6587\u4ef6\u3002<br \/>\nsudo nano \/var\/www\/html\/info.php<br \/>\n\u5c06\u4ee5\u4e0bPHP\u4ee3\u7801\u7c98\u8d34\u5230\u6587\u4ef6\u4e2d\u3002<\/p>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002 \u73b0\u5728\u5728\u6d4f\u89c8\u5668\u5730\u5740\u680f\u4e2d\u8f93\u5165server-ip-address\/info.php\u3002 \u5c06sever-ip-address\u66ff\u6362\u4e3a\u60a8\u7684\u5b9e\u9645IP\u3002 \u5982\u679c\u60a8\u5728\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u9075\u5faa\u672c\u6559\u7a0b\uff0c\u8bf7\u952e\u5165127.0.0.1\/info.php\u6216localhost\/info.php\u3002<br \/>\n\u5e94\u8be5\u770b\u5230\u60a8\u7684\u670d\u52a1\u5668\u7684PHP\u4fe1\u606f\u3002 \u8fd9\u610f\u5473\u7740PHP\u811a\u672c\u53ef\u4ee5\u4e0eApache Web\u670d\u52a1\u5668\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p>\u606d\u559c\uff01 \u60a8\u5df2\u7ecf\u5728Ubuntu 17.10\u4e0a\u6210\u529f\u5b89\u88c5\u4e86Apache\uff0cMariaDB\u548cPHP7.1\u3002 \u4e3a\u4e86\u60a8\u7684\u670d\u52a1\u5668\u7684\u5b89\u5168\u6027\uff0c\u60a8\u5e94\u8be5\u73b0\u5728\u5220\u9664info.php\u6587\u4ef6\u4ee5\u9632\u6b62\u7aa5\u63a2\u3002<br \/>\nsudo rm \/var\/www\/html\/info.php<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b65\u9aa41\uff1a\u66f4\u65b0\u8f6f\u4ef6\u5305 \u5728\u5b89\u88c5LAMP\u4e4b\u524d\uff0c\u6700\u597d\u66f4\u65b0\u5b58\u50a8\u5e93\u548c\u8f6f\u4ef6\u5305\u3002 \u5728\u60a8\u7684Ubuntu 17.10\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c &#8230; <a title=\"Ubuntu 17.10\u4e0a\u5b89\u88c5LAMP\uff08Apache\uff0cMariaDB\uff0cPHP7.1\uff09\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/ubuntu-17-10%e4%b8%8a%e5%ae%89%e8%a3%85lamp%ef%bc%88apache%ef%bc%8cmariadb%ef%bc%8cphp7-1%ef%bc%89\/\" aria-label=\"\u9605\u8bfb Ubuntu 17.10\u4e0a\u5b89\u88c5LAMP\uff08Apache\uff0cMariaDB\uff0cPHP7.1\uff09\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,49],"tags":[846],"class_list":["post-3531","post","type-post","status-publish","format-standard","hentry","category-hemanual","category-linux","tag-ubuntu17-10"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=3531"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3531\/revisions"}],"predecessor-version":[{"id":3538,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3531\/revisions\/3538"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=3531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=3531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=3531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}