{"id":132,"date":"2015-08-19T09:41:28","date_gmt":"2015-08-19T01:41:28","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=132"},"modified":"2024-12-30T15:08:48","modified_gmt":"2024-12-30T07:08:48","slug":"centos%e7%b3%bb%e7%bb%9flamp%e6%90%ad%e5%bb%ba%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/centos%e7%b3%bb%e7%bb%9flamp%e6%90%ad%e5%bb%ba%e8%bf%87%e7%a8%8b\/","title":{"rendered":"centos\u7cfb\u7edflamp\u642d\u5efa\u8fc7\u7a0b"},"content":{"rendered":"<p>\u5148\u6765\u89e3\u91ca\u4e00\u4e0b\uff0c\u4ec0\u4e48\u662f\u00a0LAMP\u3002\u6b63\u5982\u6807\u9898\u6240\u8a00\uff0cLAMP\u00a0\u5b9e\u9645\u4e0a\u5c31\u662f\u00a0Linux\u3001Apache\u3001MySQL\u3001PHP\u00a0\u56db\u4e2a\u540d\u79f0\u7684\u7f29\u5199\uff0c\u5f53\u7136\u6700\u540e\u4e00\u4e2a\u00a0\u201cP\u201d\u00a0\u8fd8\u6709\u5176\u4ed6\u8bf4\u6cd5\u662f\u00a0Perl\u00a0\u6216\u8005\u00a0Python\u3002<\/p>\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5b89\u88c5\u7684\u90fd\u662f\u6700\u65b0\u7684\u6b63\u5f0f\u7248\uff0c\u9664\u975e\u4f60\u6709\u7279\u6b8a\u9700\u6c42\uff0c\u8981\u5b89\u88c5\u6307\u5b9a\u7684\u7248\u672c\uff0c\u672c\u6587\u6682\u4e0d\u8ba8\u8bba\u3002\u4ece\u6700\u57fa\u7840\u7684\u5f00\u59cb\uff0c\u4e00\u70b9\u70b9\u5b8c\u6210\u4e00\u4e2a\u53ef\u7528\u7684\u00a0Linux\u00a0\u4e3b\u673a\u3002\u8fd9\u91cc\u5c31\u5f00\u59cb\u4ecb\u7ecd\u5982\u4f55\u5728\u00a0CentOS\u00a06.0\u00a0\u4e0a\u5b89\u88c5\u00a0LAMP\u00a0\u7ec4\u4ef6\u3002\u7ecf\u8fc7\u5982\u4e0b\u8bed\u53e5\u5b89\u88c5\uff0c\u76ee\u524d\u5b89\u88c5\u5230\u7684\u7248\u672c\u4e3a\uff1a<\/p>\n<p>PHP\uff1a5.3.2Apache\uff1a2.2.15MySQL\uff1a5.1.52<\/p>\n<p><b>\u4e00\u3001\u5b89\u88c5\u00a0MySQL<\/b><\/p>\n<p>\u9996\u5148\u6765\u8fdb\u884c\u00a0MySQL\u00a0\u7684\u5b89\u88c5\u3002\u6253\u5f00\u8d85\u7ea7\u7ec8\u7aef\uff0c\u8f93\u5165\uff1a<\/p>\n<p>yum\u00a0install\u00a0mysql\u00a0mysql-server<\/p>\n<p>\u5b89\u88c5\u5b8c\u6bd5\uff0c\u8ba9\u00a0MySQL\u00a0\u80fd\u591f\u968f\u7cfb\u7edf\u81ea\u52a8\u542f\u52a8\uff1a<\/p>\n<p>chkconfig\u00a0&#8211;levels\u00a0235\u00a0mysqld\u00a0on<\/p>\n<p>\/etc\/init.d\/mysqld\u00a0start<\/p>\n<p>\u8bbe\u7f6e\u00a0MySQL\u00a0\u6570\u636e\u00a0root\u00a0\u8d26\u6237\u7684\u5bc6\u7801\uff1a<\/p>\n<p>mysql_secure_installation<\/p>\n<p>\u5f53\u51fa\u73b0\u5982\u4e0b\u63d0\u793a\u65f6\u5019\u76f4\u63a5\u6309\u56de\u8f66\uff1a<\/p>\n<p>Enter\u00a0current\u00a0password\u00a0for\u00a0root<\/p>\n<p>\u51fa\u73b0\u5982\u4e0b\u518d\u6b21\u56de\u8f66\uff1a<\/p>\n<p>Set\u00a0root\u00a0password?\u00a0[Y\/n]<\/p>\n<p>\u51fa\u73b0\u5982\u4e0b\u63d0\u793a\u8f93\u5165\u4f60\u9700\u8981\u8bbe\u7f6e\u7684\u5bc6\u7801\uff0c\u56de\u8f66\u540e\u5728\u8f93\u5165\u4e00\u6b21\u786e\u8ba4\uff1a<\/p>\n<p>New\u00a0password:<\/p>\n<p>\u63a5\u4e0b\u6765\u8fd8\u4f1a\u6709\u56db\u4e2a\u786e\u8ba4\uff0c\u5206\u522b\u662f\uff1a<\/p>\n<ul>\n<li>Remove\u00a0anonymous\u00a0users?\u00a0[Y\/n]<\/li>\n<li>Disallow\u00a0root\u00a0login\u00a0remotely?\u00a0[Y\/n]<\/li>\n<li>Remove\u00a0test\u00a0database\u00a0and\u00a0access\u00a0to\u00a0it?\u00a0[Y\/n]<\/li>\n<li>Reload\u00a0privilege\u00a0tables\u00a0now?\u00a0[Y\/n]<\/li>\n<\/ul>\n<p>\u76f4\u63a5\u56de\u8f66\u5373\u53ef\u3002<\/p>\n<p><b>\u4e8c\u3001\u5b89\u88c5\u00a0Apache\u00a0\u7ec4\u4ef6<\/b><\/p>\n<p>\u7531\u4e8e\u00a0CentOS\u00a0\u5df2\u7ecf\u5c01\u88c5\u4e86\u00a0Apache\uff0c\u76f4\u63a5\u8fd0\u884c\u5b89\u88c5\uff1a<\/p>\n<p>yum\u00a0install\u00a0httpd<\/p>\n<p>\u540c\u6837\u914d\u7f6e\u7cfb\u7edf\u8ba9\u00a0Apache\u00a0\u968f\u7cfb\u7edf\u542f\u52a8\uff1a<\/p>\n<p>chkconfig\u00a0&#8211;levels\u00a0235\u00a0httpd\u00a0on<\/p>\n<p>\u914d\u7f6e\u5b8c\u6bd5\uff0c\u542f\u52a8\u00a0Apache\uff1a<\/p>\n<p>\/etc\/init.d\/httpd\u00a0start<\/p>\n<p>\u6b64\u65f6\u5df2\u7ecf\u53ef\u4ee5\u8bbf\u95ee\u4f60\u7684\u670d\u52a1\u5668\uff0c\u4e0d\u51fa\u610f\u5916\u7684\u8bdd\uff0c\u80fd\u591f\u770b\u5230\u00a0\u201cApache\u00a02\u00a0Test\u00a0Page\u00a0powered\u00a0by\u00a0CentOS\u201d\u00a0\u7684\u6d4b\u8bd5\u9875\u9762\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5176\u4ed6\u673a\u5668\u8bbf\u95ee\u8fd9\u53f0\u670d\u52a1\u65e0\u6cd5\u663e\u793a\u8fd9\u4e2a\u9875\u9762\uff0c\u800c\u76f4\u63a5\u5728\u8fd9\u53f0\u670d\u52a1\u5668\u4e0a\u53ef\u4ee5\u8bbf\u95ee\u7684\u8bdd\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u662f\u00a0CentOS\u00a0\u81ea\u5e26\u7684\u9632\u706b\u5899\u7981\u6b62\u4e86\u3002\u4f60\u53ea\u9700\u8981\u8fdb\u5165\u9632\u706b\u5899\uff0c\u5c06\u00a0\u201cWWW\u201d\u00a0\u5bf9\u5e94\u7684\u00a0\u201c80\u201d\u00a0\u7aef\u53e3\u6253\u5f00\u5373\u53ef\u3002<\/p>\n<p>\u5728\u9632\u706b\u5899\u4e0a\u5f00\u542f80\u7aef\u53e3\uff1a<\/p>\n<p>\u5148\u8fdb\u5165iptables\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<p>vi\u00a0\/etc\/sysconfig\/iptables<\/p>\n<p>\u7136\u540e\u52a0\u5165\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801<\/p>\n<p>-A\u00a0INPUT\u00a0-m\u00a0state\u00a0&#8211;state\u00a0NEW\u00a0-m\u00a0tcp\u00a0-p\u00a0tcp\u00a0&#8211;dport\u00a080\u00a0-j\u00a0ACCEPT<\/p>\n<p>\u6ce8\u610f\uff1a\u5728\u00a0CentOS\u00a0\u4e2d\u00a0Apache\u00a0\u7684\u9ed8\u8ba4\u6839\u76ee\u5f55\u662f\u00a0\/var\/www\/html\uff0c\u914d\u7f6e\u6587\u4ef6\u00a0\/etc\/httpd\/conf\/httpd.conf\u3002\u5176\u4ed6\u914d\u7f6e\u5b58\u50a8\u5728\u00a0\/etc\/httpd\/conf.d\/\u00a0\u76ee\u5f55\u3002<\/p>\n<p><b>\u4e09\u3001\u5b89\u88c5\u00a0PHP<\/b><\/p>\n<p>\u8f93\u5165\u5982\u4e0b\u6307\u4ee4\u5b89\u88c5\u00a0PHP:<\/p>\n<p>yum\u00a0install\u00a0php<\/p>\n<p>\u9700\u8981\u91cd\u65b0\u542f\u52a8\u00a0Apache\u00a0\u670d\u52a1\uff1a<\/p>\n<p>\/etc\/init.d\/httpd\u00a0restart<\/p>\n<p><b>\u56db\u3001\u6d4b\u8bd5\u00a0PHP\u00a0\u76f8\u5173\u4fe1\u606f<\/b><\/p>\n<p>\u8fd9\u6b65\u5b9e\u9645\u4e0a\u53ef\u4ee5\u7701\u7565\uff0c\u4f46\u662f\u4e3a\u4e86\u6d4b\u8bd5\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u4f60\u53ef\u4ee5\u65b0\u5efa\u4e00\u4e2a\u00a0PHP\u00a0\u9875\u9762\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4f7f\u7528\u00a0vim\u00a0\u7f16\u8f91\u5668\u65b0\u5efa\uff1a<\/p>\n<p>vi\u00a0\/var\/www\/html\/info.php<\/p>\n<p>\u6309\u00a0\u201ci\u201d\u00a0\u952e\u8fdb\u884c\u7f16\u8f91\uff0c\u8f93\u5165\uff1a<\/p>\n<p>&lt;?php\u00a0phpinfo();\u00a0?&gt;<\/p>\n<p>\u7f16\u8f91\u5b8c\u6bd5\uff0c\u6309\u00a0\u201cESC\u201d\u00a0\u952e\u9000\u51fa\u7f16\u8f91\u6a21\u5f0f\uff0c\u63a5\u7740\u8f93\u5165\uff1a<\/p>\n<p>:wq<\/p>\n<p>\u7136\u540e\u56de\u8f66\uff0c\u5373\u4fdd\u5b58\u5e76\u9000\u51fa\u3002<\/p>\n<p>\u6b64\u65f6\u4f60\u53ef\u4ee5\u8bbf\u95ee\u4f60\u7684\u7ad9\u70b9\u5730\u5740\uff0c\u4f8b\u5982\u00a0\u201chttps:\/\/192.168.1.2\/info.php\u201d\uff0c\u67e5\u770b\u662f\u5426\u80fd\u770b\u5230\u76f8\u5173\u7684\u00a0PHP\u00a0\u4fe1\u606f\u3002<\/p>\n<p>\u770b\u5230\u8fd9\u6837\u7684\u56fe\uff0c\u5c31\u8bf4\u660e\u00a0PHP\u00a0\u5b89\u88c5\u6210\u529f\u4e86\u3002<\/p>\n<p><b>\u4e94\u3001\u5c06\u00a0PHP\u00a0\u6a21\u5757\u548c\u00a0MySQL\u00a0\u6a21\u5757\u5173\u8054\u8d77\u6765<\/b><\/p>\n<p>\u8fd8\u9700\u8981\u5c06\u00a0PHP\u00a0\u548c\u00a0MySQL\u00a0\u5173\u8054\u8d77\u6765\uff0c\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002\u641c\u7d22\u6a21\u5757\uff1a<\/p>\n<p>yum\u00a0search\u00a0php<\/p>\n<p>\u5b89\u88c5\u76f8\u5173\u6a21\u5757\uff1a<\/p>\n<p>yum\u00a0install\u00a0php-mysql\u00a0php-gd\u00a0php-imap\u00a0php-ldap\u00a0php-odbc\u00a0php-pear\u00a0php-xml\u00a0php-xmlrpc<\/p>\n<p>\u9700\u8981\u91cd\u542f\u00a0Apache\u00a0\u6a21\u5757\u624d\u80fd\u751f\u6548\uff1a<\/p>\n<p>\/etc\/init.d\/httpd\u00a0restart<\/p>\n<p>\u518d\u6b21\u5237\u65b0\u521a\u624d\u5efa\u7acb\u7684\u00a0\u201cinfo.php\u201d\u00a0\u9875\u9762\uff0c\u5f80\u4e0b\u62c9\u627e\u5230\u76f8\u5173\u00a0MySQL\u00a0\u6a21\u5757\uff0c\u770b\u662f\u5426\u68c0\u6d4b\u5230\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<p>\u540e\u52a0\uff1a\uff1a\uff1a\uff1a<br \/>\n\u5b89\u88c5php5.4<br \/>\n1.\u73af\u5883<br \/>\ncentos6.4\u00a0x86_64<\/p>\n<p>2.\u6dfb\u52a0\u6e90<br \/>\nwget\u00a0-q\u00a0-O\u00a0&#8211;\u00a0https:\/\/www.atomicorp.com\/installers\/atomic\u00a0|\u00a0sh<\/p>\n<p>3.\u6392\u9664php5.3\u7684\u5305\uff0c\u6211\u4eec\u53ea\u9700\u8981php5.2.17(\u8fd9\u4e00\u6b65\u662f\u6392\u96645.3\u7684)<\/p>\n<p>vim\u00a0\/etc\/yum.conf<\/p>\n<p>\u589e\u52a0\u8fd9\u4e00\u884c\uff1aexclude=*5.3.*<br \/>\n4.\u5b89\u88c5<\/p>\n<p>yum\u00a0install\u00a0php\u00a0php-mysql\u00a0php-xml\u00a0php-gd\u00a0php-mbstring\u00a0php-cli<\/p>\n<p>\u5927\u529f\u544a\u6210\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u6765\u89e3\u91ca\u4e00\u4e0b\uff0c\u4ec0\u4e48\u662f\u00a0LAMP\u3002\u6b63\u5982\u6807\u9898\u6240\u8a00\uff0cLAMP\u00a0\u5b9e\u9645\u4e0a\u5c31\u662f\u00a0Linux\u3001Apache\u3001MySQL\u3001PH &#8230; <a title=\"centos\u7cfb\u7edflamp\u642d\u5efa\u8fc7\u7a0b\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/centos%e7%b3%bb%e7%bb%9flamp%e6%90%ad%e5%bb%ba%e8%bf%87%e7%a8%8b\/\" aria-label=\"\u9605\u8bfb centos\u7cfb\u7edflamp\u642d\u5efa\u8fc7\u7a0b\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":518,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[82,106],"class_list":["post-132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fuwuqi","tag-centos","tag-lamp"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/cn.hostease.com\/xueyuan\/wp-content\/uploads\/2015\/08\/\u56fe\u72472.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/132","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=132"}],"version-history":[{"count":4,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":8606,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/132\/revisions\/8606"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media\/518"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}