{"id":445,"date":"2023-02-25T13:09:12","date_gmt":"2023-02-25T05:09:12","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=445"},"modified":"2023-04-29T21:02:50","modified_gmt":"2023-04-29T13:02:50","slug":"build-an-lnmp-environment-using-yum","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/build-an-lnmp-environment-using-yum\/","title":{"rendered":"\u4f7f\u7528yum\u642d\u5efaLNMP\u73af\u5883"},"content":{"rendered":"<p>LNMP\u5373Linux+Nginx+MySQL+PHP<\/p>\n<p>linux\u5373\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e00\u822c\u8d2d\u4e70\u670d\u52a1\u5668\u7684\u65f6\u5019\u90fd\u4f1a\u8ba9\u4f60\u9009\u62e9\u64cd\u4f5c\u7cfb\u7edf\uff0c\u7136\u540e\u81ea\u52a8\u5e2e\u4f60\u5b89\u88c5\u597d\u3002\u8fd9\u91cc\u7528\u7684\u64cd\u4f5c\u7cfb\u7edf\u662fCentOS 7.8\u3002<\/p>\n<h2>\u5b89\u88c5Nginx<\/h2>\n<p><!-- more --><\/p>\n<pre><code class=\"language-bash\">yum install nginx\nnginx -v\n# \u542f\u52a8\nservice nginx start<\/code><\/pre>\n<h2>\u5b89\u88c5MySQL<\/h2>\n<pre><code class=\"language-bash\"># \u6dfb\u52a0yum-repo\nyum install wget\nwget https:\/\/repo.mysql.com\/\/mysql80-community-release-el7-3.noarch.rpm\nyum install mysql80-community-release-el7-3.noarch.rpm\n# \u5b89\u88c5\nyum install mysql-community-server\n# \u542f\u52a8\nservice mysqld start<\/code><\/pre>\n<p>MySQL\u9996\u6b21\u542f\u52a8\u7684\u65f6\u5019\uff0c\u4f1a\u751f\u6210\u4e00\u4e2a\u4e34\u65f6\u5bc6\u7801\uff0c\u5b58\u653e\u5728<code>\/var\/log\/mysqld.log<\/code>\uff0c\u6211\u4eec\u5148\u628a\u5b83\u627e\u51fa\u6765\uff0c\u4f7f\u7528\u5b83\u767b\u5f55MySQL\uff0c\u5e76\u4fee\u6539\u6210\u6211\u4eec\u81ea\u5df1\u60f3\u8981\u7684\u4e14\u7b26\u5408\u7b56\u7565\uff08\u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u5927\u5199\u5b57\u6bcd\uff0c\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcd\uff0c\u4e00\u4f4d\u6570\u5b57\u548c\u4e00\u4e2a\u7279\u6b8a\u5b57\u7b26\uff0c\u5e76\u4e14\u5bc6\u7801\u603b\u957f\u5ea6\u81f3\u5c11\u4e3a8\u4e2a\u5b57\u7b26\uff09\u7684\u5bc6\u7801\u3002<\/p>\n<pre><code class=\"language-bash\">grep &#039;temporary password&#039; \/var\/log\/mysqld.log\n# \u767b\u5f55mysql\nmysql -uroot -p\n\u6210\u529f\u767b\u5f55\u5230MySQL\u540e\uff0c\u5373\u53ef\u4fee\u6539\u5bc6\u7801\n\nALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;NewPassword666!&#039;;\n\u5bc6\u7801\u4fee\u6539\u5b8c\u6210\u540e\uff0c\u8f93\u5165exit\uff0c\u9000\u51faMySQL<\/code><\/pre>\n<h2>\u5b89\u88c5PHP<\/h2>\n<pre><code class=\"language-bash\"># \u6dfb\u52a0EPEL\u548cREMI\u5b58\u50a8\u5e93\nyum install epel-release\nyum -y install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm\n# \u6307\u5b9a\u7248\u672c\nyum -y install yum-utils\nyum-config-manager --enable remi-php74\n# \u5b89\u88c5php\nyum -y install php \n# \u5b89\u88c5\u6269\u5c55\nyum -y install php-pdo php-mysqlnd php-opcache php-xml php-gd php-devel php-mysql php-intl php-mbstring php-bcmath php-json php-iconv php-soap\n# \u67e5\u770b\u7248\u672c\nphp -v\n# \u67e5\u770b\u542f\u7528\u7684\u6a21\u5757\nphp -m<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>LNMP\u5373Linux+Nginx+MySQL+PHP linux\u5373\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4e00\u822c\u8d2d\u4e70\u670d\u52a1\u5668\u7684\u65f6\u5019\u90fd\u4f1a\u8ba9\u4f60\u9009\u62e9\u64cd [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[145],"class_list":["post-445","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-lnmp"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=445"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/445\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}