{"id":1437,"date":"2023-04-01T10:25:34","date_gmt":"2023-04-01T02:25:34","guid":{"rendered":"https:\/\/blog.ttwow.top\/?p=1437"},"modified":"2026-06-19T21:12:13","modified_gmt":"2026-06-19T13:12:13","slug":"%e8%85%be%e8%ae%af%e4%ba%91%e7%9a%84ubuntu","status":"publish","type":"post","link":"https:\/\/blog.ttwow.top\/?p=1437","title":{"rendered":"\u817e\u8baf\u4e91\u7684Ubuntu"},"content":{"rendered":"<p>\u5982\u4f55\u5728 Ubuntu 20.04 \u4e0a\u5b89\u88c5 Java<br \/>\nsudo apt update<br \/>\nsudo apt install openjdk-11-jdk<br \/>\n\u590d\u5236<br \/>\n\u4e00\u65e6\u5b89\u88c5\u5b8c\u6210\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5 Java \u7248\u672c\u6765\u9a8c\u8bc1\u5b83\uff1a<\/p>\n<p>java -version<\/p>\n<p>Ubuntu\u5b89\u88c5lrzsz<\/p>\n<p>sudo apt-get install lrzsz<\/p>\n<p>\u4e00\u3001Ubuntu\u5b89\u88c5Docker<br \/>\n1.\u5b98\u65b9\u5b89\u88c5\u811a\u672c\u5b89\u88c5<br \/>\ncurl -fsSL <a href=\"https:\/\/get.docker.com\">https:\/\/get.docker.com<\/a> | bash -s docker --mirror Aliyun<br \/>\n1<br \/>\n\u4e5f\u53ef\u4ee5\u4f7f\u7528\u56fd\u5185 daocloud \u4e00\u952e\u5b89\u88c5\u547d\u4ee4\uff1a<\/p>\n<p>curl -sSL <a href=\"https:\/\/get.daocloud.io\/docker\">https:\/\/get.daocloud.io\/docker<\/a> | sh<\/p>\n<p><a href=\"https:\/\/github.com\/hectorqin\/reader\">https:\/\/github.com\/hectorqin\/reader<\/a><\/p>\n<p>docker\u5b89\u88c5<br \/>\nhectorqin\/reader:openj9-latest<br \/>\n\u5355\u7528\u6237<\/p>\n<p>docker run -d --restart=always --name=reader -e &quot;SPRING_PROFILES_ACTIVE=prod&quot; -v \/home\/read\/logs:\/logs -v \/home\/read\/storage:\/storage -p 8080:8080 hectorqin\/reader:openj9-latest<\/p>\n<p>ubuntu \u4e0a\u4f20\u6587\u4ef6\u63d0\u793a\u6743\u9650\u62d2\u7edd\u6216\u65e0\u6cd5\u521b\u5efa\u6587\u4ef6\u5939<br \/>\nsudo chmod 777 minio<\/p>\n<p>vim \u4e0d\u80fd \u4fdd\u5b58\u6587\u4ef6<br \/>\npress enter or type to continue<\/p>\n<p>sudo vim XXX<\/p>\n<p>Linux\u521b\u5efa\u6587\u4ef6\u76845\u79cd\u65b9\u5f0f<br \/>\n1 touch<br \/>\ntouch\u6307\u4ee4\uff0c\u5f88\u5e38\u7528\u7684\u4e00\u79cd\u65b9\u6cd5<\/p>\n<p>1.1 \u521b\u5efa\u4e00\u4e2a\u6587\u4ef6<br \/>\ntouch yyTest.ini<\/p>\n<p>1.2 \u540c\u65f6\u521b\u5efa\u4e24\u4e2a\u6587\u4ef6<br \/>\ntouch test1.txt test2.txt<\/p>\n<p>1.3 \u6279\u91cf\u521b\u5efa\u6587\u4ef6\uff08\u5982\u521b\u5efa2000\u4e2a\u6587\u4ef6\uff09<br \/>\ntouch test{0001\u20262000}.txt<\/p>\n<p>1.4 \u66f4\u6539\u6587\u4ef6 yyTest.ini\u65f6\u95f4\u4e3a\u5f53\u524d\u65f6\u95f4\uff08yyTest.ini\u5df2\u5b58\u5728\uff09<br \/>\ntouch yyTest.ini<\/p>\n<p>2 vi\u548cvim<br \/>\nvi test.txt<\/p>\n<p>vim touch.txt<\/p>\n<p>vi\u548cvim\u8fd8\u662f\u5f88\u5f3a\u5927\u7684\u3002<\/p>\n<p>3 \u4f7f\u7528&gt;\u3001&gt;&gt;<br \/>\n3.1 &gt;<br \/>\n\u76f4\u63a5\u8986\u76d6\u539f\u6587\u4ef6\uff0c\u4e0d\u4f1a\u6709\u4efb\u4f55\u63d0\u793a<\/p>\n<p>3.2 &gt;&gt;<br \/>\n\u8ffd\u52a0\u5728\u539f\u6587\u4ef6\u672b\u5c3e\uff0c\u4e0d\u4f1a\u8986\u76d6\u539f\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p>3.3 \u76f4\u63a5\u7528&gt;\u521b\u5efa\u7a7a\u6587\u4ef6<\/p>\n<blockquote>\n<p>test.ini<br \/>\n1<br \/>\n3.4 ls \u521b\u5efa\u6587\u4ef6\uff08\u5c06\u7ed3\u679c\u5199\u5165\u6587\u4ef6\uff09<br \/>\nls &gt; test.ini<\/p>\n<\/blockquote>\n<p>ls &gt;&gt; test.ini<br \/>\n1<br \/>\n2<br \/>\n3<br \/>\n3.5 grep \u521b\u5efa\u6587\u4ef6\uff08\u5c06\u7ed3\u679c\u5199\u5165\u6587\u4ef6\uff09<br \/>\nps -ef | grep java &gt;test.ini<\/p>\n<p>ps -ef | grep java &gt;&gt;test.ini<br \/>\n1<br \/>\n2<br \/>\n3<br \/>\n3.6 echo \u521b\u5efa\u6587\u4ef6\uff08\u5c06\u7ed3\u679c\u5199\u5165\u6587\u4ef6\uff09<br \/>\necho $PATH &gt; test.ini<\/p>\n<p>echo $PATH &gt;&gt; test.ini<\/p>\n<p>4 \u4f7f\u7528cp\u521b\u5efa\u6587\u4ef6<br \/>\n\u53ea\u8981\u76ee\u6807\u6587\u4ef6\u662f\u65b0\u6587\u4ef6\u5219\u7b97\u521b\u5efa\u6587\u4ef6\uff0ccp\u8be6\u7ec6\u547d\u4ee4\u89e3\u8bfb\u53ef\u770b\u6b64\u535a\u6587\uff1a<a href=\"https:\/\/www.cnblogs.com\/poloyy\/p\/12514389.html\">https:\/\/www.cnblogs.com\/poloyy\/p\/12514389.html<\/a><\/p>\n<p>5 \u4f7f\u7528cat\u521b\u5efa\u6587\u4ef6<br \/>\n5.1 \u7b80\u5355\u4f7f\u7528&gt;\u3001&gt;&gt;<br \/>\ncat &gt; test.ini<\/p>\n<p>cat &gt;&gt; test.ini<br \/>\n1<br \/>\n2<br \/>\n3<br \/>\n\u5176\u5b9e\u7528\u7684\u4e5f\u662f &gt; \u548c &gt;&gt; \uff0c\u4f46\u662f\u6709\u4e00\u70b9\u4e0d\u4e00\u6837\u7684\u662f\uff0c\u6572\u5b8c\u4e0a\u8ff0\u547d\u4ee4\u4f1a\u8fdb\u5165 test.ini \u7684\u7f16\u8f91\u6a21\u5f0f\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165\u4f60\u60f3\u8981\u5199\u5165\u7684\u5185\u5bb9\uff0c\u6700\u540e\u6309ctrl+z\u9000\u51fa\u7f16\u8f91\u6a21\u5f0f\u81ea\u52a8\u4fdd\u5b58<\/p>\n<p>5.2 cat\u7ed3\u5408eof<br \/>\ncat &gt;&gt; test.ini &lt;&lt;eof<\/p>\n<p>2<\/p>\n<p>2<\/p>\n<p>2<\/p>\n<p>eof<br \/>\n1<br \/>\n2<br \/>\n3<br \/>\n4<br \/>\n5<br \/>\n6<br \/>\n7<br \/>\n8<br \/>\n9<br \/>\neof\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u5206\u754c\u7b26\uff0c\u9047\u5230\u4e0b\u4e00\u4e2a\u5206\u754c\u7b26\u65f6\u505c\u6b62\u8f93\u5165\uff1b\u5927\u5c0f\u5199\u4e00\u6837\u7684\u54e6<\/p>\n<p>5.3 cat\u7ed3\u5408exit<br \/>\n\u548ceof\u540c\u7406 <\/p>\n<p>cat &gt;&gt; test.ini &lt;&lt;exit<\/p>\n<p>1<\/p>\n<p>1<\/p>\n<p>exit<\/p>\n<p>\u5982\u4f55\u67e5\u770bjava\u5b89\u88c5\u8def\u5f84<br \/>\njava -verbose<\/p>\n<p>\u5f00\u673a\u542f\u52a8<\/p>\n<p>sudo nano \/etc\/systemd\/system\/myapp.service<\/p>\n<p>[Unit]<br \/>\nDescription=news<br \/>\nAfter=syslog.target network.target<\/p>\n<p>[Service]<br \/>\nWorkingDirectory=\/home\/news<\/p>\n<h2>jdk\u8def\u5f84   \u4ee5\u53ca\u542f\u52a8jar\u6587\u4ef6\u547d\u4ee4<\/h2>\n<p>ExecStart= \/usr\/lib\/jvm\/java-11-openjdk-amd64\/bin\/java -jar \/home\/news\/gathernews-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod<br \/>\nSuccessExitStatus=143<br \/>\nTimeoutStopSec=10<br \/>\nRestart=on-failure<br \/>\nRestartSec=5<br \/>\n[Install]<br \/>\nWantedBy=multi-user.target<\/p>\n<p>sudo systemctl enable myapp.service<br \/>\nsudo systemctl start myapp.service<\/p>\n<p>ubuntu reboot \u4e0d\u751f\u6548<br \/>\nsudo reboot<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728 Ubuntu 20.04 \u4e0a\u5b89\u88c5 Java sudo apt update sudo apt inst [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130],"tags":[160],"class_list":["post-1437","post","type-post","status-publish","format-standard","hentry","category-linux-ops","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1437"}],"version-history":[{"count":1,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1437\/revisions"}],"predecessor-version":[{"id":1438,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1437\/revisions\/1438"}],"wp:attachment":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}