{"id":38475,"date":"2024-11-26T15:08:35","date_gmt":"2024-11-26T07:08:35","guid":{"rendered":"https:\/\/fwq.ai\/blog\/38475\/"},"modified":"2024-11-26T15:08:35","modified_gmt":"2024-11-26T07:08:35","slug":"centos%e6%80%8e%e4%b9%88%e5%ae%89%e8%a3%85java","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/38475\/","title":{"rendered":"centos\u600e\u4e48\u5b89\u88c5java"},"content":{"rendered":"<blockquote><p>\n  centos \u4e0a\u5b89\u88c5 java \u7684\u6b65\u9aa4\u5982\u4e0b\uff1a\u68c0\u67e5 centos \u7248\u672c\u3002\u5b89\u88c5 java \u5f00\u53d1\u5de5\u5177\u5305 (jdk)\u3002\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u9a8c\u8bc1\u5b89\u88c5\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/15\/2024111502160559523.jpg\" class=\"aligncenter\" title=\"centos\u600e\u4e48\u5b89\u88c5java\u63d2\u56fe\" alt=\"centos\u600e\u4e48\u5b89\u88c5java\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 CentOS \u4e0a\u5b89\u88c5 Java<\/strong><\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u68c0\u67e5<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u786e\u5b9a\u60a8\u6b63\u5728\u8fd0\u884c\u54ea\u4e2a\u7248\u672c\u7684 CentOS\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>cat \/etc\/centos-release<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u5b89\u88c5 Java \u5f00\u53d1\u5de5\u5177\u5305 (JDK)<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5bf9\u4e8e CentOS 7\uff1a<\/p>\n<pre>sudo yum install java-1.8.0-openjdk<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5bf9\u4e8e CentOS 8\uff1a<\/p>\n<pre>sudo dnf install java-11-openjdk-devel<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\u610f\uff1a\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684 Java \u7248\u672c\uff0c\u5c06 1.8.0 \u66ff\u6362\u4e3a\u60a8\u6240\u9700\u7684\u7248\u672c\u3002<\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u4ee5\u544a\u77e5\u7cfb\u7edf Java \u7684\u5b89\u88c5\u4f4d\u7f6e\u3002<\/p>\n<pre>sudo nano \/etc\/profile.d\/java.sh<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>export JAVA_HOME=\/usr\/lib\/jvm\/java-1.8.0-openjdk\nexport PATH=$JAVA_HOME\/bin:$PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06 1.8.0 \u66ff\u6362\u4e3a\u60a8\u5b89\u88c5\u7684 Java \u7248\u672c\u3002<\/p>\n<p>\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre>source \/etc\/profile.d\/java.sh<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 4\uff1a\u9a8c\u8bc1\u5b89\u88c5<\/strong><\/p>\n<p>\u8981\u9a8c\u8bc1 Java \u662f\u5426\u5df2\u6210\u529f\u5b89\u88c5\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>java -version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5c06\u663e\u793a\u5df2\u5b89\u88c5\u7684 Java \u7248\u672c\u3002<\/p>\n<p><strong>\u5176\u4ed6\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u60a8\u5df2\u542f\u7528 EPEL\uff08\u989d\u5916\u8f6f\u4ef6\u5305\u5b58\u50a8\u5e93\uff09\u4ee5\u8bbf\u95ee\u6700\u65b0\u7684 Java \u8f6f\u4ef6\u5305\u3002<\/li>\n<li>\u5982\u679c\u60a8\u60f3\u4f7f\u7528 Oracle Java\uff0c\u9700\u8981\u4ece Oracle \u7f51\u7ad9\u4e0b\u8f7d\u5e76\u624b\u52a8\u5b89\u88c5\u5b83\u3002<\/li>\n<li>\u6709\u5173\u66f4\u591a\u9ad8\u7ea7\u9009\u9879\uff0c\u8bf7\u53c2\u9605 Java \u5b98\u65b9\u6587\u6863\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5b89\u88c5java\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>centos \u4e0a\u5b89\u88c5 java \u7684\u6b65\u9aa4\u5982\u4e0b\uff1a\u68c0\u67e5 centos \u7248\u672c\u3002\u5b89\u88c5 java \u5f00\u53d1\u5de5\u5177\u5305 (jdk)\u3002\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u9a8c\u8bc1\u5b89\u88c5\u3002 \u5982\u4f55\u5728 CentOS \u4e0a\u5b89\u88c5 Java \u6b65\u9aa4 1\uff1a\u68c0\u67e5 \u9996\u5148\uff0c\u786e\u5b9a\u60a8\u6b63\u5728\u8fd0\u884c\u54ea\u4e2a\u7248\u672c\u7684 CentOS\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a cat \/etc\/centos-release \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u5b89\u88c5 Java \u5f00\u53d1\u5de5\u5177\u5305 (JDK) \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5bf9\u4e8e CentOS 7\uff1a sudo yum install java-1.8.0-openjdk \u767b\u5f55\u540e\u590d\u5236 \u5bf9\u4e8e CentOS 8\uff1a sudo dnf install java-11-openjdk-devel \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff1a\u60a8\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684 Java \u7248\u672c\uff0c\u5c06 1.8.0 \u66ff\u6362\u4e3a\u60a8\u6240\u9700\u7684\u7248\u672c\u3002 \u6b65\u9aa4 3\uff1a\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u4ee5\u544a\u77e5\u7cfb\u7edf Java \u7684\u5b89\u88c5\u4f4d\u7f6e\u3002 sudo nano \/etc\/profile.d\/java.sh [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-38475","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/38475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=38475"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/38475\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=38475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=38475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=38475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}