{"id":11,"date":"2024-12-09T17:41:28","date_gmt":"2024-12-09T09:41:28","guid":{"rendered":"http:\/\/10.34.6.191\/?p=1"},"modified":"2025-04-10T20:52:33","modified_gmt":"2025-04-10T12:52:33","slug":"hello-world-2-2","status":"publish","type":"post","link":"https:\/\/cennum.top\/index.php\/2024\/12\/09\/hello-world-2-2\/","title":{"rendered":"Ubuntu\u7cfb\u7edf\u535a\u5ba2\u642d\u5efa[LAMP]"},"content":{"rendered":"\n<p><strong>\u524d\u8a00\uff1a<\/strong><\/p>\n\n\n\n<p>\u7cfb\u7edf\uff1aubuntu24.04<\/p>\n\n\n\n<p>\u51c6\u5907\u642d\u5efa\u73af\u5883\uff1aLAMP\uff08Linux\u00a0+ Apache + Mysql + PHP\uff09<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u642d\u5efaLAMP\u73af\u5883\uff1a<\/strong><\/p>\n\n\n\n<p>1.\u5b89\u88c5Apache<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install apache2 -y<\/code><\/pre>\n\n\n\n<p>\u6267\u884c\u4ee5\u4e0a\u547d\u4ee4\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u8f93\u5165\u8be5Ubuntu\u7684IP\u5730\u5740\u6216\u8005127.0.0.1\uff0c\u51fa\u73b0\u4ee5\u4e0b\u9875\u9762\u8bf4\u660eapache\u5b89\u88c5\u6210\u529f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/10.34.6.191\/wp-content\/uploads\/2024\/12\/apache\u6d4b\u8bd5\u9875\u9762-1024x594.png\" alt=\"\" class=\"wp-image-17\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>2.\u5b89\u88c5PHP<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install php libapache2-mod-php -y\nsudo systemctl restart apache2    #\u91cd\u542fapache\u670d\u52a1<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u5b89\u88c5libapache2-mod-php\u7684\u4e3b\u8981\u7684\u539f\u56e0\u662f\u56e0\u4e3a<code>libapache2-mod-php<\/code>\u4f1a\u81ea\u52a8\u4f7f\u4f60\u7684Apache\u53ef\u4ee5\u89e3\u6790php\u8bed\u8a00\u3002<\/p>\n\n\n\n<p>\u5728apache\u9ed8\u8ba4\u7f51\u9875\u6587\u4ef6\u8def\u5f84\uff08\/var\/ww\/html\/\uff09\u4e0b\u521b\u5efa\u4e00\u4e2a\u6587\u4ef61.php\uff0c\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9<br><code>&lt;?php phpinfo();?><\/code><\/p>\n\n\n\n<p>\u4fdd\u5b58\u9000\u51fa\uff0c\u5728\u6d4f\u89c8\u5668\u8f93\u5165<strong>http:\/\/IP\u5730\u5740\/1.php<\/strong>\uff0c\u51fa\u73b0\u4ee5\u4e0b\u754c\u9762\uff0c\u8868\u793a\u5b89\u88c5\u6210\u529f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/10.34.6.191\/wp-content\/uploads\/2024\/12\/php\u6d4b\u8bd5-1024x634.png\" alt=\"\" class=\"wp-image-18\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>3\u3001\u5b89\u88c5MySQL\u53ca\u5176\u76f8\u5173php\u7ec4\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install mysql -y    #\u5b89\u88c5mysql\nsudo apt-get install php-mysql    #\u5b89\u88c5php\u76f8\u5173\u7ec4\u4ef6<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>4\u3001\u5b89\u88c5phpmyadmin\uff08\u53ef\u89c6\u5316\u6570\u636e\u5e93\u7ba1\u7406\u754c\u9762\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install phpmyadmin -y\nsudo ln -s \/usr\/share\/phpmyadmin \/var\/www\/html\/phpmyadmin    #\u5efa\u7acb \/var\/www\/html \u4e0b\u7684\u8f6f\u8fde\u63a5\nsudo systemctl restart mysql    #\u91cd\u542f MySQL \u670d\u52a1\nsudo systemctl restart apache2.service    #\u91cd\u542f Apache \u670d\u52a1<\/code><\/pre>\n\n\n\n<p>\u521b\u5efa\u8f6f\u94fe\u63a5\u7684\u76ee\u7684\u662f\u8ba9\u6211\u4eec\u5728\u8fdb\u5165phpmyadmin\u65f6\u66f4\u52a0\u7684\u65b9\u4fbf\u4e00\u70b9\uff0c\u53ea\u8981\u5728\u6d4f\u89c8\u5668\u8f93\u5165<strong>http:\/\/IP\u5730\u5740\/phpmyadmin<\/strong>\u5c31\u884c\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u521b\u5efawordpress\u6570\u636e\u5e93<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p    #\u8fdb\u5165mysqlroot\u8d26\u6237\uff0c\u521d\u6b21\u8fdb\u5165\u4f1a\u8bbe\u7f6e\u5bc6\u7801\nCREATE DATABASE \u6570\u636e\u5e93\u540d\u79f0;    #\u521b\u5efa\u6570\u636e\u5e93\nCREATE USER \u2018\u7528\u6237\u540d\u2019@\u2018%\u2019 IDENTIFIED BY \u2018\u5bc6\u7801\u2019;    #\u521b\u5efa\u7528\u6237\uff08\u8fdc\u7a0b\u7528\u6237\uff09\u5e76\u8bbe\u7f6e\u5bc6\u7801\u7528\u4e8e\u8fde\u63a5wordpress\nGRANT ALL PRIVILEGES ON \u6570\u636e\u5e93\u540d\u79f0.* TO \u2018\u7528\u6237\u540d\u2019@\u2018%';    #\u7ed9\u521b\u5efa\u7684\u7528\u6237\u6743\u9650\nFLUSH PRIVILEGES;    #\u751f\u6548\u8bbe\u7f6e\nexit;    #\u9000\u51fa<\/code><\/pre>\n\n\n\n<p>\u00a0\u8f93\u5165\u547d\u4ee4\u65f6\u6ce8\u610f\u6700\u540e\u7684\u2018\uff1b\u2019\u53f7\uff0c\u8fd8\u6709\u5728\u8d4b\u6743\u65f6\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u7684\u2018.*\u2019\uff0c\u521b\u5efa\u6210\u529f\u4e4b\u540e\u53ef\u4ee5\u8fdb\u5165<a href=\"http:\/\/IP\u5730\u5740\/phpmyadmin\">http:\/\/IP\u5730\u5740\/phpmyadmin<\/a>\u540e\u53f0\u9a8c\u8bc1\u662f\u5426\u80fd\u591f\u767b\u5f55\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>wordpress\u4e0b\u8f7d\u914d\u7f6e<\/strong><\/p>\n\n\n\n<p>\u8fdb\u5165wordpress\u5b98\u7f51[icon-url href=&#8221;https:\/\/cn.wordpress.org\/download\/&#8221;]\u627e\u5230\uff08\u4e0b\u8f7d.tar.gz\uff09,\u53f3\u952e\u590d\u5236\u4e0b\u8f7d\u94fe\u63a5\uff1b<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/10.34.6.191\/wp-content\/uploads\/2024\/12\/workspace-1024x497.png\" alt=\"\" class=\"wp-image-19\"\/><\/figure>\n\n\n\n<p>\u5728linux\u7ec8\u7aef\u8f93\u5165<code>wget \u590d\u5236\u7684\u94fe\u63a5<\/code>\u4e0b\u8f7dwordpress\uff0c\u518d\u7528tar\u547d\u4ee4<code>tar -zxvf \u538b\u7f29\u5305\u540d<\/code>\u89e3\u538b\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo wget https:\/\/cn.wordpress.org\/latest-zh_CN.tar.gz\nsudo tar -zxvf latest-zh_CN.tar.gz<\/code><\/pre>\n\n\n\n<p>\u5982\u679cubuntu\u53d7\u7f51\u7edc\u5f71\u54cd\u65e0\u6cd5\u8bbf\u95ee\u53ef\u4ee5\u5728\u7f51\u7edc\u73af\u5883\u597d\u7684\u4e3b\u673a\u4e0a\u8bbf\u95ee<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><a href=\"https:\/\/cn.wordpress.org\/latest-zh_CN.tar.gz\">https:\/\/cn.wordpress.org\/latest-zh_CN.tar.gz<\/a><\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528\u6d4f\u89c8\u5668\u6253\u5f00\u4f1a\u76f4\u63a5\u4e0b\u8f7d\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528scp\u547d\u4ee4\u4e0a\u4f20\u5230ubuntu<\/p>\n\n\n\n<p>\u547d\u4ee4\u683c\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>scp &#91;\u672c\u673a\u6587\u4ef6\u8def\u5f84] &#91;ubuntu\u7528\u6237\u540d]Ubuntu\u7684ip\u5730\u5740:&#91;\u76ee\u6807\u4f4d\u7f6e]\n\n<\/code><\/pre>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>scp C:\\linux dsl@10.34.6.191:\/home\/dsl\n\n<\/code><\/pre>\n\n\n\n<p>\u4e0b\u8f7d\u5b8c\u6210\u4f7f\u7528tar\u547d\u4ee4\u89e3\u538b\u8be5\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nsudo tar -zxvf wordpress-zh_CN.tar.gz<\/code><\/pre>\n\n\n\n<p>\u5c06apache\u76ee\u5f55\u4e0b\u7684index.php\u8fdb\u884c\u91cd\u547d\u540d\uff08\u76ee\u7684\u662f\u6539\u53d8Apache\u9ed8\u8ba4\u6253\u5f00\u7684\u7f51\u9875\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mv \/var\/www\/html\/index.html \/var\/www\/html\/index~.html<\/code><\/pre>\n\n\n\n<p>\u518d\u5c06\u89e3\u538b\u7684wordpress\u6587\u4ef6\u5168\u90e8\u79fb\u52a8\u5230Apache\u6587\u4ef6\u76ee\u5f55\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mv wordpress\/* \/var\/www\/html\/<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u7ed9html\u4e0b\u7684\u6587\u4ef6\u8fdb\u884c\u8d4b\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 777 \/var\/www\/html\/    <\/code><\/pre>\n\n\n\n<p>\u91cd\u542fApache\u670d\u52a1\uff0c\u914d\u7f6e\u5b8c\u6210<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u914d\u7f6e\u5b8c\u540e\uff0c\u5373\u53ef\u8fdb\u5165\u6d4f\u89c8\u5668\u914d\u7f6e\u7f51\u7ad9\u7684\u76f8\u5173\u914d\u7f6e\u4e86\uff0c\u5728\u6d4f\u89c8\u5668\u8f93\u5165IP\u5730\u5740\uff0c\u8fdb\u5165wordpress\u914d\u7f6e\uff0c\u6309\u7167\u8981\u6c42\u586b\u5199\u4e4b\u524d\u521b\u5efa\u7684\u6570\u636e\u5e93\u4fe1\u606f\uff0c\u548c\u7f51\u7ad9\u4fe1\u606f\uff0c\u5b8c\u6210\u540e\u4f60\u5c31\u80fd\u62e5\u6709\u4e00\u4e2a\u5c5e\u4e8e\u81ea\u5df1\u7684\u7f51\u7ad9\u4e86<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\uff1a \u7cfb\u7edf\uff1aubuntu24.04 \u51c6\u5907\u642d\u5efa\u73af\u5883 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[11],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-linux","category-3","tag-web"],"_links":{"self":[{"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":1,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":311,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions\/311"}],"wp:attachment":[{"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cennum.top\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}