{"id":76971,"date":"2026-02-23T18:10:09","date_gmt":"2026-02-23T10:10:09","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76971.html"},"modified":"2026-02-23T18:10:09","modified_gmt":"2026-02-23T10:10:09","slug":"ubuntu-20-04%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%bf%85%e7%9c%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%bd%bb%e5%ba%95%e7%a6%81%e7%94%a8%e8%87%aa%e5%8a%a8%e6%9b%b4%e6%96%b0%e9%81%bf%e5%85%8d%e7%94%9f%e4%ba%a7","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76971.html","title":{"rendered":"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09"},"content":{"rendered":"<h2>Ubuntu 20.04\u670d\u52a1\u5668\u751f\u4ea7\u73af\u5883&#xff1a;\u7cbe\u7ec6\u5316\u7ba1\u63a7\u81ea\u52a8\u66f4\u65b0&#xff0c;\u5b88\u62a4\u7cfb\u7edf\u7a33\u5b9a\u6027\u7684\u5b8c\u6574\u7b56\u7565<\/h2>\n<p>\u5728\u670d\u52a1\u5668\u8fd0\u7ef4\u7684\u4e16\u754c\u91cc&#xff0c;\u7a33\u5b9a\u538b\u5012\u4e00\u5207\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4e00\u4e2a\u627f\u8f7d\u7740\u6838\u5fc3\u4e1a\u52a1\u7684\u751f\u4ea7\u73af\u5883&#xff0c;\u56e0\u4e3a\u4e00\u6b21\u672a\u7ecf\u8ba1\u5212\u7684\u81ea\u52a8\u5185\u6838\u66f4\u65b0&#xff0c;\u5bfc\u81f4\u670d\u52a1\u4e2d\u65ad\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38&#xff0c;\u751a\u81f3\u5f15\u53d1\u96be\u4ee5\u6392\u67e5\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8fd9\u79cd\u573a\u666f\u5bf9\u4e8e\u4efb\u4f55\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u800c\u8a00&#xff0c;\u90fd\u662f\u4e00\u573a\u5669\u68a6\u3002Ubuntu 20.04 LTS\u4f5c\u4e3a\u4e00\u6b3e\u957f\u671f\u652f\u6301\u7248\u672c&#xff0c;\u4ee5\u5176\u7a33\u5b9a\u6027\u548c\u5e7f\u6cdb\u7684\u8f6f\u4ef6\u751f\u6001\u6df1\u53d7\u4f01\u4e1a\u9752\u7750&#xff0c;\u4f46\u5176\u9ed8\u8ba4\u5f00\u542f\u7684\u81ea\u52a8\u66f4\u65b0\u673a\u5236&#xff0c;\u5374\u53ef\u80fd\u6210\u4e3a\u751f\u4ea7\u73af\u5883\u4e2d\u7684\u4e00\u679a\u201c\u5b9a\u65f6\u70b8\u5f39\u201d\u3002\u672c\u6587\u5e76\u975e\u7b80\u5355\u5730\u6559\u4f60\u8fd0\u884c\u51e0\u6761\u7981\u7528\u547d\u4ee4&#xff0c;\u800c\u662f\u6df1\u5165\u5256\u6790Ubuntu 20.04\u66f4\u65b0\u4f53\u7cfb\u7684\u8fd0\u4f5c\u673a\u7406&#xff0c;\u63d0\u4f9b\u4e00\u5957\u4ece\u539f\u7406\u5230\u5b9e\u8df5\u3001\u4ece\u5168\u5c40\u7981\u7528\u5230\u7cbe\u7ec6\u5316\u7ba1\u63a7\u7684\u5b8c\u6574\u7b56\u7565\u3002\u6211\u4eec\u5c06\u8d85\u8d8a\u201c\u4e00\u5173\u4e86\u4e4b\u201d\u7684\u7c97\u66b4\u505a\u6cd5&#xff0c;\u63a2\u8ba8\u5982\u4f55\u5728\u786e\u4fdd\u7cfb\u7edf\u5b89\u5168\u4e0e\u7ef4\u6301\u4e1a\u52a1\u7a33\u5b9a\u4e4b\u95f4&#xff0c;\u627e\u5230\u90a3\u4e2a\u7cbe\u5999\u7684\u5e73\u8861\u70b9\u3002<\/p>\n<h3>1. \u7406\u89e3Ubuntu 20.04\u81ea\u52a8\u66f4\u65b0\u7684\u591a\u5c42\u67b6\u6784<\/h3>\n<p>\u5f88\u591a\u7ba1\u7406\u5458\u8ba4\u4e3a\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u5c31\u662f\u5173\u6389\u4e00\u4e24\u4e2a\u670d\u52a1&#xff0c;\u4f46\u5b9e\u9645\u4e0a&#xff0c;Ubuntu\u7684\u81ea\u52a8\u66f4\u65b0\u662f\u4e00\u4e2a\u7531\u591a\u4e2a\u7ec4\u4ef6\u534f\u540c\u5de5\u4f5c\u7684\u590d\u6742\u7cfb\u7edf\u3002\u7406\u89e3\u8fd9\u4e2a\u67b6\u6784&#xff0c;\u662f\u8fdb\u884c\u6709\u6548\u7ba1\u63a7\u7684\u7b2c\u4e00\u6b65\u3002<\/p>\n<p>\u6838\u5fc3\u7ec4\u4ef6\u89e3\u6790&#xff1a;<\/p>\n<li>APT\u914d\u7f6e\u5c42 (\/etc\/apt\/apt.conf.d\/): \u8fd9\u662f\u7b56\u7565\u5b9a\u4e49\u5c42\u3002\u4e00\u7cfb\u5217\u4ee5\u6570\u5b57\u5f00\u5934\u7684\u914d\u7f6e\u6587\u4ef6&#xff0c;\u51b3\u5b9a\u4e86APT\u5305\u7ba1\u7406\u5668\u7684\u884c\u4e3a\u6a21\u5f0f&#xff0c;\u5305\u62ec\u4f55\u65f6\u68c0\u67e5\u66f4\u65b0\u3001\u4e0b\u8f7d\u54ea\u4e9b\u66f4\u65b0\u3001\u4ee5\u53ca\u662f\u5426\u81ea\u52a8\u5b89\u88c5\u3002\u5176\u4e2d&#xff0c;20auto-upgrades \u548c 50unattended-upgrades \u662f\u4e24\u4e2a\u5173\u952e\u6587\u4ef6\u3002<\/li>\n<li>Systemd\u670d\u52a1\u4e0e\u5b9a\u65f6\u5668\u5c42: \u8fd9\u662f\u6267\u884c\u8c03\u5ea6\u5c42\u3002Ubuntu\u4f7f\u7528systemd\u7684timer\u5355\u5143\u6765\u5b9a\u65f6\u89e6\u53d1\u66f4\u65b0\u4efb\u52a1\u3002\n<ul>\n<li>apt-daily.timer \/ apt-daily.service: \u8d1f\u8d23\u5b9a\u671f&#xff08;\u9ed8\u8ba4\u6bcf\u5929\u4e24\u6b21&#xff09;\u66f4\u65b0\u8f6f\u4ef6\u5305\u5217\u8868&#xff08;apt update&#xff09;\u3002\u8fd9\u4e2a\u52a8\u4f5c\u672c\u8eab\u4e0d\u5b89\u88c5\u4efb\u4f55\u4e1c\u897f&#xff0c;\u4f46\u4f1a\u6d88\u8017\u7f51\u7edc\u548c\u78c1\u76d8I\/O\u3002<\/li>\n<li>apt-daily-upgrade.timer \/ apt-daily-upgrade.service: \u5728apt-daily\u6267\u884c\u540e&#xff0c;\u8d1f\u8d23\u6267\u884c\u5b9e\u9645\u7684\u5347\u7ea7\u64cd\u4f5c&#xff08;apt upgrade&#xff09;\u3002\u5b83\u4e0eunattended-upgrades\u670d\u52a1\u7d27\u5bc6\u76f8\u5173\u3002<\/li>\n<li>unattended-upgrades.service: \u8fd9\u662f\u4e00\u4e2a\u7279\u6b8a\u7684\u670d\u52a1&#xff0c;\u901a\u5e38\u5728\u7cfb\u7edf\u5173\u673a\u65f6\u88ab\u89e6\u53d1&#xff0c;\u7528\u4e8e\u6267\u884c\u572850unattended-upgrades\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9a\u4e49\u597d\u7684\u3001\u65e0\u4eba\u503c\u5b88\u7684\u5347\u7ea7\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>unattended-upgrades\u5305: \u8fd9\u662f\u5b9e\u73b0\u201c\u65e0\u4eba\u503c\u5b88\u201d\u5347\u7ea7\u903b\u8f91\u7684\u6838\u5fc3\u8f6f\u4ef6\u5305\u3002\u5b83\u8bfb\u53d6APT\u914d\u7f6e&#xff0c;\u51b3\u5b9a\u54ea\u4e9b\u66f4\u65b0&#xff08;\u901a\u5e38\u9ed8\u8ba4\u662f\u5b89\u5168\u66f4\u65b0&#xff09;\u53ef\u4ee5\u88ab\u81ea\u52a8\u5b89\u88c5\u3002<\/li>\n<p>\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u53ef\u4ee5\u7528\u4e00\u4e2a\u7b80\u5355\u7684\u6d41\u7a0b\u6765\u63cf\u8ff0&#xff1a;<\/p>\n<p>\u5b9a\u65f6\u5668\u89e6\u53d1 (apt-daily.timer) \u2192 \u66f4\u65b0\u5217\u8868 (apt-daily.service) \u2192 &#xff08;\u53ef\u9009\u7684&#xff09;\u5b9a\u65f6\u5668\u89e6\u53d1 (apt-daily-upgrade.timer) \u2192 \u6267\u884c\u5347\u7ea7\u811a\u672c (apt-daily-upgrade.service) \u2192 \u8c03\u7528unattended-upgrades\u903b\u8f91 \u2192 \u6839\u636e50unattended-upgrades\u914d\u7f6e\u51b3\u5b9a\u5b89\u88c5\u54ea\u4e9b\u66f4\u65b0 \u2192 \u53ef\u80fd\u89e6\u53d1unattended-upgrades.service\u5728\u5173\u673a\u65f6\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<p>\u5ffd\u7565\u4efb\u4f55\u4e00\u5c42&#xff0c;\u90fd\u53ef\u80fd\u7559\u4e0b\u201c\u6f0f\u7f51\u4e4b\u9c7c\u201d\u3002\u4f8b\u5982&#xff0c;\u4f60\u53ea\u505c\u4e86apt-daily-upgrade.timer&#xff0c;\u4f46apt-daily.timer\u4f9d\u7136\u5728\u8fd0\u884c&#xff0c;\u540e\u53f0\u4f9d\u7136\u4f1a\u5b9a\u671f\u62c9\u53d6\u66f4\u65b0\u6570\u636e&#xff0c;\u5360\u7528\u8d44\u6e90\u3002\u6216\u8005&#xff0c;\u4f60\u4fee\u6539\u4e86APT\u914d\u7f6e&#xff0c;\u4f46\u672a\u7981\u7528\u76f8\u5173systemd\u5b9a\u65f6\u5668&#xff0c;\u5b9a\u65f6\u4efb\u52a1\u4f9d\u7136\u4f1a\u5c1d\u8bd5\u6267\u884c&#xff0c;\u53ea\u4e0d\u8fc7\u53ef\u80fd\u56e0\u4e3a\u914d\u7f6e\u800c\u201c\u65e0\u4e8b\u53ef\u505a\u201d\u3002<\/p>\n<h3>2. \u7b56\u7565\u4e00&#xff1a;\u5b8c\u5168\u7981\u7528\u2014\u2014\u9002\u7528\u4e8e\u4e25\u683c\u53d7\u63a7\u7684\u79bb\u7ebf\u6216\u5185\u7f51\u73af\u5883<\/h3>\n<p>\u5bf9\u4e8e\u67d0\u4e9b\u9700\u8981\u7edd\u5bf9\u7a33\u5b9a\u3001\u66f4\u65b0\u5b8c\u5168\u7531\u4eba\u5de5\u5ba1\u6279\u5e76\u7edf\u4e00\u90e8\u7f72\u7684\u73af\u5883&#xff08;\u5982\u67d0\u4e9b\u91d1\u878d\u4ea4\u6613\u7cfb\u7edf\u3001\u5de5\u4e1a\u63a7\u5236\u670d\u52a1\u5668&#xff09;&#xff0c;\u5f7b\u5e95\u5173\u95ed\u6240\u6709\u81ea\u52a8\u66f4\u65b0\u6d3b\u52a8\u662f\u5fc5\u8981\u7684\u3002\u8fd9\u9700\u8981\u591a\u7ba1\u9f50\u4e0b\u3002<\/p>\n<h4>2.1 \u7981\u7528\u6240\u6709\u76f8\u5173\u7684Systemd\u5b9a\u65f6\u5668\u4e0e\u670d\u52a1<\/h4>\n<p>\u8fd9\u662f\u6700\u76f4\u63a5\u6709\u6548\u7684\u4e00\u6b65&#xff0c;\u963b\u6b62\u4efb\u4f55\u8ba1\u5212\u4efb\u52a1\u7684\u6267\u884c\u3002\u5efa\u8bae\u6309\u4ee5\u4e0b\u987a\u5e8f\u64cd\u4f5c&#xff0c;\u4ee5\u4fbf\u89c2\u5bdf\u72b6\u6001\u53d8\u5316&#xff1a;<\/p>\n<p># \u9996\u5148&#xff0c;\u67e5\u770b\u6240\u6709\u76f8\u5173\u5355\u5143\u7684\u5f53\u524d\u72b6\u6001&#xff0c;\u505a\u5230\u5fc3\u4e2d\u6709\u6570<br \/>\nsudo systemctl list-timers &#8211;all | grep -E \u201c(apt|upgrade)\u201d<br \/>\nsudo systemctl status unattended-upgrades.service apt-daily.timer apt-daily-upgrade.timer<\/p>\n<p># \u505c\u6b62\u5e76\u7981\u7528\u5b9a\u65f6\u5668&#xff08;Timer&#xff09;&#xff0c;\u9632\u6b62\u672a\u6765\u89e6\u53d1<br \/>\nsudo systemctl stop apt-daily.timer apt-daily-upgrade.timer<br \/>\nsudo systemctl disable apt-daily.timer apt-daily-upgrade.timer<\/p>\n<p># \u505c\u6b62\u5e76\u7981\u7528\u5bf9\u5e94\u7684\u670d\u52a1&#xff08;Service&#xff09;<br \/>\nsudo systemctl stop apt-daily.service apt-daily-upgrade.service<br \/>\nsudo systemctl disable apt-daily.service apt-daily-upgrade.service<\/p>\n<p># \u5904\u7406\u65e0\u4eba\u503c\u5b88\u5347\u7ea7\u670d\u52a1<br \/>\nsudo systemctl stop unattended-upgrades.service<br \/>\nsudo systemctl disable unattended-upgrades.service<\/p>\n<p># \u91cd\u65b0\u52a0\u8f7dsystemd\u914d\u7f6e&#xff0c;\u786e\u4fdd\u66f4\u6539\u751f\u6548<br \/>\nsudo systemctl daemon-reload<\/p>\n<p>\u6267\u884c\u540e&#xff0c;\u4f7f\u7528 systemctl is-enabled &lt;\u5355\u5143\u540d&gt; \u548c systemctl is-active &lt;\u5355\u5143\u540d&gt; \u6765\u9a8c\u8bc1\u662f\u5426\u5df2\u6210\u529f\u7981\u7528\u5e76\u505c\u6b62\u3002<\/p>\n<h4>2.2 \u4fee\u6539APT\u914d\u7f6e\u6587\u4ef6&#xff0c;\u4ece\u7b56\u7565\u5c42\u9762\u5173\u95ed\u81ea\u52a8\u66f4\u65b0<\/h4>\n<p>\u4ec5\u7981\u7528\u670d\u52a1&#xff0c;APT\u81ea\u8eab\u7684\u914d\u7f6e\u53ef\u80fd\u4f9d\u7136\u201c\u544a\u8bc9\u201d\u7cfb\u7edf\u8981\u81ea\u52a8\u66f4\u65b0\u3002\u6211\u4eec\u9700\u8981\u4fee\u6539\u4e24\u4e2a\u5173\u952e\u6587\u4ef6&#xff1a;<\/p>\n<ul>\n<li>\/etc\/apt\/apt.conf.d\/20auto-upgrades: \u8fd9\u4e2a\u6587\u4ef6\u76f4\u63a5\u63a7\u5236\u5468\u671f\u6027\u4efb\u52a1\u7684\u5f00\u5173\u3002<\/li>\n<li>\/etc\/apt\/apt.conf.d\/50unattended-upgrades: \u8fd9\u4e2a\u6587\u4ef6\u8be6\u7ec6\u5b9a\u4e49\u4e86\u65e0\u4eba\u503c\u5b88\u5347\u7ea7\u7684\u5177\u4f53\u884c\u4e3a\u3002<\/li>\n<\/ul>\n<p>\u6700\u5f7b\u5e95\u7684\u65b9\u6cd5\u662f\u76f4\u63a5\u8bbe\u7f6e20auto-upgrades&#xff1a;<\/p>\n<p>sudo tee \/etc\/apt\/apt.conf.d\/20auto-upgrades &lt;&lt; \u2018EOF\u2019<br \/>\nAPT::Periodic::Update-Package-Lists \u201c0\u201d;<br \/>\nAPT::Periodic::Download-Upgradeable-Packages \u201c0\u201d;<br \/>\nAPT::Periodic::AutocleanInterval \u201c0\u201d;<br \/>\nAPT::Periodic::Unattended-Upgrade \u201c0\u201d;<br \/>\nEOF<\/p>\n<p>\u5bf9\u4e8e50unattended-upgrades&#xff0c;\u4f60\u53ef\u4ee5\u901a\u8fc7\u6ce8\u91ca\u6389\u6216\u4fee\u6539\u7279\u5b9a\u884c\u6765\u7981\u7528\u81ea\u52a8\u5b89\u88c5\u3002\u4f8b\u5982&#xff0c;\u627e\u5230\u5e76\u786e\u4fdd\u4ee5\u4e0b\u884c\u662ffalse&#xff1a;<\/p>\n<p>Unattended-Upgrade::Allowed-Origins {<br \/>\n    \u201c${distro_id}:${distro_codename}-security\u201d;<br \/>\n};<br \/>\n\/\/ \u5c06\u4e0a\u884c\u6ce8\u91ca\u6389\u6216\u6539\u4e3a\u7a7a&#xff0c;\u5373\u53ef\u7981\u6b62\u81ea\u52a8\u5b89\u88c5\u5b89\u5168\u66f4\u65b0<br \/>\n\/\/ \u201c${distro_id}:${distro_codename}-updates\u201d;<br \/>\n\/\/ \u201c${distro_id}:${distro_codename}-proposed\u201d;<br \/>\n\/\/ \u201c${distro_id}:${distro_codename}-backports\u201d;<\/p>\n<h4>2.3 \u9a8c\u8bc1\u4e0e\u9677\u9631\u6392\u67e5<\/h4>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e&#xff0c;\u5982\u4f55\u8fdb\u884c\u6709\u6548\u6027\u9a8c\u8bc1&#xff1f;<\/p>\n<li>\u68c0\u67e5\u5b9a\u65f6\u5668&#xff1a;systemctl list-timers \u2013all \u8f93\u51fa\u4e2d\u4e0d\u5e94\u518d\u51fa\u73b0apt-daily\u548capt-daily-upgrade\u3002<\/li>\n<li>\u6a21\u62df\u89e6\u53d1&#xff1a;\u53ef\u4ee5\u624b\u52a8\u5c1d\u8bd5\u89e6\u53d1\u670d\u52a1&#xff0c;\u770b\u5176\u662f\u5426\u771f\u7684\u4e0d\u4f1a\u6267\u884c\u5347\u7ea7\u3002\u4f8b\u5982&#xff0c;sudo systemctl start apt-daily-upgrade.service \u5e94\u8be5\u5f88\u5feb\u7ed3\u675f&#xff0c;\u5e76\u4e14\u901a\u8fc7 journalctl -u apt-daily-upgrade.service \u67e5\u770b\u65e5\u5fd7&#xff0c;\u786e\u8ba4\u5176\u6ca1\u6709\u5b9e\u9645\u6267\u884c\u5347\u7ea7\u64cd\u4f5c\u3002<\/li>\n<li>\u68c0\u67e5\u65e5\u5fd7&#xff1a;\u5b9a\u671f\u67e5\u770b\/var\/log\/unattended-upgrades\/\u76ee\u5f55\u4e0b\u7684\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u786e\u8ba4\u6ca1\u6709\u65b0\u7684\u81ea\u52a8\u5347\u7ea7\u8bb0\u5f55\u3002<\/li>\n<p>\u6ce8\u610f&#xff1a;\u5b8c\u5168\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u610f\u5473\u7740\u4f60\u9700\u8981\u5efa\u7acb\u4e00\u5957\u4e25\u683c\u7684\u624b\u52a8\u66f4\u65b0\u6d41\u7a0b\u3002\u52a1\u5fc5\u5b9a\u671f&#xff08;\u4f8b\u5982&#xff0c;\u6bcf\u6708&#xff09;\u624b\u52a8\u8fd0\u884csudo apt update &amp;&amp; sudo apt upgrade\u6765\u68c0\u67e5\u5e76\u5e94\u7528\u5173\u952e\u7684\u5b89\u5168\u66f4\u65b0&#xff0c;\u5426\u5219\u670d\u52a1\u5668\u5c06\u66b4\u9732\u5728\u5df2\u77e5\u6f0f\u6d1e\u7684\u98ce\u9669\u4e4b\u4e0b\u3002\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u5982apticron\u8fd9\u6837\u7684\u5de5\u5177&#xff0c;\u5b83\u4e0d\u4f1a\u81ea\u52a8\u5b89\u88c5\u66f4\u65b0&#xff0c;\u4f46\u4f1a\u901a\u8fc7\u90ae\u4ef6\u901a\u77e5\u4f60\u6709\u53ef\u7528\u7684\u66f4\u65b0\u3002<\/p>\n<h3>3. \u7b56\u7565\u4e8c&#xff1a;\u7cbe\u7ec6\u5316\u7ba1\u63a7\u2014\u2014\u5e73\u8861\u5b89\u5168\u4e0e\u7a33\u5b9a\u7684\u827a\u672f<\/h3>\n<p>\u5bf9\u4e8e\u5927\u591a\u6570\u751f\u4ea7\u73af\u5883&#xff0c;\u5b8c\u5168\u7981\u7528\u66f4\u65b0\u5e76\u975e\u4e0a\u7b56\u3002\u66f4\u4f18\u96c5\u7684\u65b9\u5f0f\u662f\u8fdb\u884c\u7cbe\u7ec6\u5316\u7ba1\u63a7&#xff1a;\u5141\u8bb8\u83b7\u53d6\u5b89\u5168\u4fe1\u606f&#xff0c;\u4f46\u7981\u6b62\u81ea\u52a8\u5b89\u88c5&#xff1b;\u6216\u8005\u5c06\u66f4\u65b0\u6d3b\u52a8\u9650\u5236\u5728\u7279\u5b9a\u7684\u7ef4\u62a4\u7a97\u53e3\u3002<\/p>\n<h4>3.1 \u5141\u8bb8\u68c0\u67e5\u66f4\u65b0&#xff0c;\u4f46\u7981\u6b62\u81ea\u52a8\u5b89\u88c5<\/h4>\n<p>\u8fd9\u4e2a\u7b56\u7565\u8ba9\u4f60\u80fd\u53ca\u65f6\u77e5\u6653\u5b89\u5168\u6f0f\u6d1e&#xff0c;\u540c\u65f6\u638c\u63a7\u5b89\u88c5\u65f6\u673a\u3002\u53ea\u9700\u4fee\u6539APT\u914d\u7f6e&#xff0c;\u800c\u65e0\u9700\u5b8c\u5168\u505c\u6b62systemd\u670d\u52a1\u3002<\/p>\n<p>\u4fdd\u6301apt-daily.timer\u542f\u7528&#xff0c;\u5141\u8bb8\u5b83\u5b9a\u671f\u66f4\u65b0\u8f6f\u4ef6\u5305\u5217\u8868\u3002\u8fd9\u6837&#xff0c;\u4f60\u53ef\u4ee5\u901a\u8fc7apt list \u2013upgradable\u968f\u65f6\u67e5\u770b\u6709\u54ea\u4e9b\u66f4\u65b0\u53ef\u7528\u3002\u5173\u952e\u5728\u4e8e\u4fee\u653920auto-upgrades\u548c50unattended-upgrades&#xff1a;<\/p>\n<p># \/etc\/apt\/apt.conf.d\/20auto-upgrades \u5e94\u914d\u7f6e\u4e3a&#xff1a;<br \/>\nAPT::Periodic::Update-Package-Lists \u201c1\u201d; # \u5141\u8bb8\u66f4\u65b0\u5217\u8868<br \/>\nAPT::Periodic::Download-Upgradeable-Packages \u201c0\u201d; # \u7981\u6b62\u81ea\u52a8\u4e0b\u8f7d\u53ef\u5347\u7ea7\u5305<br \/>\nAPT::Periodic::AutocleanInterval \u201c7\u201d; # \u6bcf7\u5929\u81ea\u52a8\u6e05\u7406\u4e00\u6b21<br \/>\nAPT::Periodic::Unattended-Upgrade \u201c0\u201d; # \u5173\u95ed\u65e0\u4eba\u503c\u5b88\u5347\u7ea7<\/p>\n<p># \u5728 \/etc\/apt\/apt.conf.d\/50unattended-upgrades \u4e2d&#xff0c;\u660e\u786e\u6ce8\u91ca\u6389\u6240\u6709Allowed-Origins<br \/>\nUnattended-Upgrade::Allowed-Origins {<br \/>\n\/\/    \u201c${distro_id}:${distro_codename}-security\u201d;<br \/>\n\/\/    \u201c${distro_id}:${distro_codename}-updates\u201d;<br \/>\n};<\/p>\n<p>\u8fd9\u6837&#xff0c;\u7cfb\u7edf\u4f1a\u544a\u8bc9\u4f60\u6709\u54ea\u4e9b\u66f4\u65b0&#xff08;\u5305\u62ec\u5b89\u5168\u66f4\u65b0&#xff09;&#xff0c;\u4f46\u7edd\u4e0d\u4f1a\u672a\u7ecf\u4f60\u540c\u610f\u5c31\u5b89\u88c5\u3002<\/p>\n<h4>3.2 \u8c03\u6574\u5b9a\u65f6\u5668\u8ba1\u5212&#xff0c;\u9650\u5b9a\u66f4\u65b0\u7a97\u53e3<\/h4>\n<p>\u5982\u679c\u670d\u52a1\u5668\u8d44\u6e90\u5728\u7279\u5b9a\u65f6\u95f4\u6bb5&#xff08;\u5982\u51cc\u66682\u70b9\u52304\u70b9&#xff09;\u76f8\u5bf9\u7a7a\u95f2&#xff0c;\u4f60\u53ef\u4ee5\u4fee\u6539systemd\u5b9a\u65f6\u5668\u7684\u89e6\u53d1\u65f6\u95f4&#xff0c;\u800c\u4e0d\u662f\u7981\u7528\u5b83\u3002<\/p>\n<p>Systemd\u5b9a\u65f6\u5668\u7684\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\/lib\/systemd\/system\/&#xff0c;\u4f46\u6700\u4f73\u5b9e\u8df5\u662f\u5728\/etc\/systemd\/system\/\u4e0b\u521b\u5efa\u540c\u540d\u6587\u4ef6\u8fdb\u884c\u8986\u76d6\u3002\u4f8b\u5982&#xff0c;\u4fee\u6539apt-daily.timer\u7684\u6267\u884c\u65f6\u95f4&#xff1a;<\/p>\n<p># \u9996\u5148&#xff0c;\u67e5\u770b\u539f\u5b9a\u65f6\u5668\u7684\u89e6\u53d1\u8bbe\u7f6e<br \/>\nsudo systemctl cat apt-daily.timer<\/p>\n<p># \u5728 \/etc\/systemd\/system\/ \u4e0b\u521b\u5efa\u8986\u76d6\u914d\u7f6e<br \/>\nsudo systemctl edit apt-daily.timer<\/p>\n<p>\u5728\u6253\u5f00\u7684\u7f16\u8f91\u5668\u4e2d&#xff0c;\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9&#xff0c;\u5c06\u6bcf\u65e5\u89e6\u53d1\u65f6\u95f4\u8c03\u6574\u4e3a\u51cc\u66683\u70b9&#xff1a;<\/p>\n<p>[Timer]<br \/>\nOnCalendar&#061;<br \/>\nOnCalendar&#061;*-*-* 03:00:00<br \/>\nRandomizedDelaySec&#061;0<br \/>\nPersistent&#061;true<\/p>\n<p>\u4fdd\u5b58\u9000\u51fa\u540e&#xff0c;\u6267\u884c sudo systemctl daemon-reload \u548c sudo systemctl restart apt-daily.timer\u3002\u4f7f\u7528 sudo systemctl list-timers \u786e\u8ba4\u65b0\u7684\u8ba1\u5212\u5df2\u751f\u6548\u3002<\/p>\n<h4>3.3 \u4f7f\u7528apt\u7684Hold\u673a\u5236\u9501\u5b9a\u5173\u952e\u5305<\/h4>\n<p>\u6709\u65f6&#xff0c;\u4f60\u53ea\u662f\u4e0d\u5e0c\u671b\u67d0\u4e2a\u7279\u5b9a\u7684\u5305&#xff08;\u5982\u5185\u6838\u3001\u6570\u636e\u5e93\u670d\u52a1\u3001\u7279\u5b9a\u5e93\u7248\u672c&#xff09;\u88ab\u66f4\u65b0\u3002apt\u7684hold\u72b6\u6001\u53ef\u4ee5\u5b8c\u7f8e\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p># \u5c06\u7279\u5b9a\u5305\u6807\u8bb0\u4e3a\u201c\u4fdd\u7559\u201d&#xff0c;\u963b\u6b62\u5176\u88ab\u81ea\u52a8\u6216\u624b\u52a8\u5347\u7ea7<br \/>\nsudo apt-mark hold linux-image-generic linux-headers-generic mysql-server<\/p>\n<p># \u67e5\u770b\u6240\u6709\u88ab\u6807\u8bb0\u4e3a\u201c\u4fdd\u7559\u201d\u7684\u5305<br \/>\nsudo apt-mark showhold<\/p>\n<p># \u5982\u679c\u9700\u8981\u53d6\u6d88\u4fdd\u7559&#xff0c;\u4f7f\u7528 unhold<br \/>\nsudo apt-mark unhold mysql-server<\/p>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u7684\u4f18\u52bf\u5728\u4e8e\u7c92\u5ea6\u7ec6&#xff0c;\u4e0d\u5f71\u54cd\u5176\u4ed6\u5305\u7684\u6b63\u5e38\u66f4\u65b0\u6d41\u7a0b\u3002\u5bf9\u4e8e\u7ef4\u62a4\u7279\u5b9a\u8f6f\u4ef6\u7248\u672c\u517c\u5bb9\u6027\u7684\u573a\u666f\u6781\u5176\u6709\u7528\u3002<\/p>\n<h3>4. \u7b56\u7565\u4e09&#xff1a;\u6784\u5efa\u53ef\u89c2\u6d4b\u4e0e\u56de\u6eda\u7684\u5b89\u5168\u7f51<\/h3>\n<p>\u65e0\u8bba\u91c7\u7528\u54ea\u79cd\u7b56\u7565&#xff0c;\u76d1\u63a7\u548c\u56de\u6eda\u80fd\u529b\u90fd\u662f\u751f\u4ea7\u73af\u5883\u8fd0\u7ef4\u7684\u57fa\u77f3\u3002\u4f60\u4e0d\u80fd\u5bf9\u7cfb\u7edf\u7684\u66f4\u65b0\u72b6\u6001\u4e00\u65e0\u6240\u77e5&#xff0c;\u4e5f\u4e0d\u80fd\u5728\u66f4\u65b0\u51fa\u95ee\u9898\u65f6\u675f\u624b\u65e0\u7b56\u3002<\/p>\n<h4>4.1 \u5efa\u7acb\u66f4\u65b0\u72b6\u6001\u76d1\u63a7<\/h4>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u811a\u672c&#xff0c;\u5c06\u53ef\u7528\u7684\u66f4\u65b0\u4fe1\u606f\u96c6\u6210\u5230\u73b0\u6709\u7684\u76d1\u63a7\u7cfb\u7edf&#xff08;\u5982Zabbix, Prometheus&#xff09;\u4e2d\u3002<\/p>\n<p>#!\/bin\/bash<br \/>\n# check_updates.sh<br \/>\nUPDATE_COUNT&#061;$(\/usr\/lib\/update-notifier\/apt-check \u2013human-readable | head -n1 | awk \u2018{print $1}\u2019)<br \/>\nSECURITY_COUNT&#061;$(\/usr\/lib\/update-notifier\/apt-check \u2013human-readable | tail -n1 | awk \u2018{print $1}\u2019)<\/p>\n<p>echo \u201c\u53ef\u7528\u66f4\u65b0\u603b\u6570: $UPDATE_COUNT\u201d<br \/>\necho \u201c\u5176\u4e2d\u5b89\u5168\u66f4\u65b0\u6570: $SECURITY_COUNT\u201d<\/p>\n<p># \u53ef\u4ee5\u5c06\u8fd9\u4e9b\u6570\u5b57\u8f93\u51fa\u4e3a\u76d1\u63a7\u7cfb\u7edf\u53ef\u6293\u53d6\u7684\u683c\u5f0f&#xff0c;\u4f8b\u5982&#xff1a;<br \/>\n# echo \u201ccustom.apt.updates.available $UPDATE_COUNT $(date &#043;%s)\u201d<br \/>\n# echo \u201ccustom.apt.updates.security $SECURITY_COUNT $(date &#043;%s)\u201d<\/p>\n<p>\u5c06\u8fd9\u4e2a\u811a\u672c\u52a0\u5165cron&#xff0c;\u5b9a\u671f\u8fd0\u884c\u5e76\u4e0a\u62a5\u6570\u636e\u3002\u5f53\u5b89\u5168\u66f4\u65b0\u6570\u91cf\u8d85\u8fc7\u9608\u503c\u65f6&#xff0c;\u89e6\u53d1\u544a\u8b66&#xff0c;\u63d0\u9192\u7ba1\u7406\u5458\u8fdb\u884c\u4eba\u5de5\u8bc4\u5ba1\u548c\u90e8\u7f72\u3002<\/p>\n<h4>4.2 \u5b9e\u65bd\u53ef\u9760\u7684\u66f4\u65b0\u56de\u6eda\u65b9\u6848<\/h4>\n<p>\u5728\u5b9e\u65bd\u624b\u52a8\u66f4\u65b0\u524d&#xff0c;\u52a1\u5fc5\u51c6\u5907\u597d\u56de\u6eda\u65b9\u6848\u3002\u5bf9\u4e8eUbuntu\u670d\u52a1\u5668&#xff0c;\u6709\u51e0\u4e2a\u5b9e\u7528\u5de5\u5177&#xff1a;<\/p>\n<ul>\n<li>\u5229\u7528apt\u7684\/var\/log\/apt\/history.log: \u6bcf\u6b21apt\u64cd\u4f5c\u90fd\u6709\u8be6\u7ec6\u65e5\u5fd7\u3002\u5728\u66f4\u65b0\u524d&#xff0c;\u53ef\u4ee5\u8bb0\u5f55\u5f53\u524d\u65f6\u95f4\u6233\u3002\u5982\u679c\u66f4\u65b0\u540e\u51fa\u73b0\u95ee\u9898&#xff0c;\u53ef\u4ee5\u67e5\u770b\u65e5\u5fd7&#xff0c;\u7cbe\u786e\u56de\u9000\u5230\u67d0\u4e2a\u64cd\u4f5c\u4e4b\u524d\u7684\u72b6\u6001&#xff08;\u867d\u7136apt\u4e0d\u76f4\u63a5\u652f\u6301\u4e8b\u52a1\u56de\u6eda&#xff0c;\u4f46\u53ef\u4ee5\u624b\u52a8\u964d\u7ea7\u5305&#xff09;\u3002<\/li>\n<li>\u4f7f\u7528dpkg\u5feb\u7167\u5de5\u5177debsums: \u5b89\u88c5debsums\u540e&#xff0c;\u53ef\u4ee5\u5728\u66f4\u65b0\u524d\u5bf9\u6240\u6709\u5df2\u5b89\u88c5\u5305\u7684\u6587\u4ef6\u8fdb\u884c\u6821\u9a8c\u548c\u5feb\u7167\u3002\u66f4\u65b0\u540e\u5982\u679c\u6000\u7591\u67d0\u4e2a\u6587\u4ef6\u88ab\u5f02\u5e38\u4fee\u6539&#xff0c;\u53ef\u4ee5\u7528debsums -c\u6765\u68c0\u67e5\u3002<\/li>\n<li>\u6700\u5f3a\u5927\u7684\u6b66\u5668&#xff1a;\u7cfb\u7edf\u5feb\u7167\u3002\u5982\u679c\u670d\u52a1\u5668\u8fd0\u884c\u5728\u652f\u6301\u5feb\u7167\u7684\u865a\u62df\u5316\u5e73\u53f0&#xff08;\u5982VMware, Proxmox VE, AWS EBS&#xff09;\u6216\u4f7f\u7528\u4e86LVM&#xff0c;\u5728\u91cd\u5927\u66f4\u65b0\u524d\u521b\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u865a\u62df\u673a\u6216\u903b\u8f91\u5377\u5feb\u7167&#xff0c;\u662f\u6210\u672c\u6700\u4f4e\u3001\u56de\u6eda\u6700\u5f7b\u5e95\u7684\u65b9\u5f0f\u3002\u8fd9\u5e94\u8be5\u6210\u4e3a\u751f\u4ea7\u73af\u5883\u53d8\u66f4\u7ba1\u7406\u7684\u6807\u51c6\u64cd\u4f5c\u6d41\u7a0b\u3002<\/li>\n<\/ul>\n<h4>4.3 \u642d\u5efa\u5185\u90e8\u955c\u50cf\u4e0e\u5206\u7ea7\u66f4\u65b0\u73af\u5883<\/h4>\n<p>\u5bf9\u4e8e\u62e5\u6709\u591a\u53f0\u670d\u52a1\u5668\u7684\u4e2d\u5927\u578b\u73af\u5883&#xff0c;\u6700\u4f73\u5b9e\u8df5\u662f\u642d\u5efa\u5185\u90e8APT\u955c\u50cf&#xff08;\u5982\u4f7f\u7528apt-mirror\u6216reprepro&#xff09;&#xff0c;\u5c06\u6240\u6709\u5916\u90e8\u66f4\u65b0\u540c\u6b65\u5230\u5185\u7f51\u3002\u7136\u540e&#xff0c;\u8bbe\u7f6e\u4e00\u4e2a\u201c\u9884\u53d1\u5e03\u201d\u6216\u201c\u6d4b\u8bd5\u201d\u670d\u52a1\u5668\u7ec4&#xff0c;\u9996\u5148\u4ece\u5185\u90e8\u955c\u50cf\u83b7\u53d6\u5e76\u6d4b\u8bd5\u66f4\u65b0\u3002\u6d4b\u8bd5\u901a\u8fc7\u540e&#xff0c;\u518d\u5c06\u66f4\u65b0\u63a8\u9001\u5230\u751f\u4ea7\u670d\u52a1\u5668\u3002<\/p>\n<p>\u8fd9\u79cd\u67b6\u6784\u4e0d\u4ec5\u907f\u514d\u4e86\u6bcf\u53f0\u670d\u52a1\u5668\u90fd\u4ece\u516c\u7f51\u4e0b\u8f7d\u7684\u5e26\u5bbd\u6d6a\u8d39&#xff0c;\u66f4\u91cd\u8981\u7684\u662f\u5b9e\u73b0\u4e86\u66f4\u65b0\u7684\u53ef\u63a7\u548c\u53ef\u6d4b\u8bd5\u3002\u4f60\u53ef\u4ee5\u5728\u5185\u90e8\u955c\u50cf\u670d\u52a1\u5668\u4e0a&#xff0c;\u901a\u8fc7\u914d\u7f6e\/etc\/apt\/apt.conf.d\/\u6765\u7cbe\u7ec6\u63a7\u5236\u54ea\u4e9b\u7248\u672c\u7684\u5305\u53ef\u4ee5\u88ab\u540c\u6b65&#xff0c;\u4ece\u800c\u5728\u6e90\u5934\u628a\u63a7\u98ce\u9669\u3002<\/p>\n<p>\u901a\u8fc7\u4e0a\u8ff0\u4e09\u5c42\u7b56\u7565\u7684\u6df1\u5165\u63a2\u8ba8&#xff0c;\u6211\u4eec\u53ef\u4ee5\u770b\u5230&#xff0c;\u7ba1\u7406Ubuntu 20.04\u7684\u81ea\u52a8\u66f4\u65b0\u8fdc\u4e0d\u6b62\u8fd0\u884c\u51e0\u6761systemctl disable\u547d\u4ee4\u90a3\u4e48\u7b80\u5355\u3002\u5b83\u8981\u6c42\u8fd0\u7ef4\u4eba\u5458\u6df1\u523b\u7406\u89e3\u7cfb\u7edf\u7ec4\u4ef6\u95f4\u7684\u534f\u4f5c\u5173\u7cfb&#xff0c;\u5e76\u6839\u636e\u5b9e\u9645\u4e1a\u52a1\u573a\u666f&#xff0c;\u5728\u201c\u7edd\u5bf9\u7a33\u5b9a\u201d\u548c\u201c\u53ca\u65f6\u5b89\u5168\u201d\u4e4b\u95f4\u505a\u51fa\u660e\u667a\u7684\u6743\u8861&#xff0c;\u5e76\u914d\u4ee5\u5b8c\u5584\u7684\u76d1\u63a7\u548c\u56de\u6eda\u673a\u5236\u3002\u8bb0\u4f4f&#xff0c;\u6ca1\u6709\u4e00\u52b3\u6c38\u9038\u7684\u914d\u7f6e&#xff0c;\u53ea\u6709\u6301\u7eed\u89c2\u5bdf\u3001\u7406\u89e3\u548c\u8c03\u6574&#xff0c;\u624d\u80fd\u8ba9\u670d\u52a1\u5668\u5728\u77ac\u606f\u4e07\u53d8\u7684\u6280\u672f\u73af\u5883\u4e2d\u4fdd\u6301\u575a\u5982\u78d0\u77f3\u7684\u7a33\u5b9a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 20.04\u670d\u52a1\u5668\u751f\u4ea7\u73af\u5883&#xff1a;\u7cbe\u7ec6\u5316\u7ba1\u63a7\u81ea\u52a8\u66f4\u65b0&#xff0c;\u5b88\u62a4\u7cfb\u7edf\u7a33\u5b9a\u6027\u7684\u5b8c\u6574\u7b56\u7565<br \/>\n\u5728\u670d\u52a1\u5668\u8fd0\u7ef4\u7684\u4e16\u754c\u91cc&#xff0c;\u7a33\u5b9a\u538b\u5012\u4e00\u5207\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4e00\u4e2a\u627f\u8f7d\u7740\u6838\u5fc3\u4e1a\u52a1\u7684\u751f\u4ea7\u73af\u5883&#xff0c;\u56e0\u4e3a\u4e00\u6b21\u672a\u7ecf\u8ba1\u5212\u7684\u81ea\u52a8\u5185\u6838\u66f4\u65b0&#xff0c;\u5bfc\u81f4\u670d\u52a1\u4e2d\u65ad\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38&#xff0c;\u751a\u81f3\u5f15\u53d1\u96be\u4ee5\u6392\u67e5\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8fd9\u79cd\u573a\u666f\u5bf9\u4e8e\u4efb\u4f55\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u800c\u8a00&#xff0c;\u90fd\u662f\u4e00\u573a\u5669\u68a6\u3002Ubuntu 20.04 LTS\u4f5c\u4e3a\u4e00\u6b3e\u957f\u671f\u652f\u6301\u7248\u672c&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8234,8401,2446,774],"topic":[],"class_list":["post-76971","post","type-post","status-publish","format-standard","hentry","category-server","tag-8234","tag-8401","tag-ubuntu20-04","tag-774"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76971.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Ubuntu 20.04\u670d\u52a1\u5668\u751f\u4ea7\u73af\u5883&#xff1a;\u7cbe\u7ec6\u5316\u7ba1\u63a7\u81ea\u52a8\u66f4\u65b0&#xff0c;\u5b88\u62a4\u7cfb\u7edf\u7a33\u5b9a\u6027\u7684\u5b8c\u6574\u7b56\u7565 \u5728\u670d\u52a1\u5668\u8fd0\u7ef4\u7684\u4e16\u754c\u91cc&#xff0c;\u7a33\u5b9a\u538b\u5012\u4e00\u5207\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4e00\u4e2a\u627f\u8f7d\u7740\u6838\u5fc3\u4e1a\u52a1\u7684\u751f\u4ea7\u73af\u5883&#xff0c;\u56e0\u4e3a\u4e00\u6b21\u672a\u7ecf\u8ba1\u5212\u7684\u81ea\u52a8\u5185\u6838\u66f4\u65b0&#xff0c;\u5bfc\u81f4\u670d\u52a1\u4e2d\u65ad\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38&#xff0c;\u751a\u81f3\u5f15\u53d1\u96be\u4ee5\u6392\u67e5\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8fd9\u79cd\u573a\u666f\u5bf9\u4e8e\u4efb\u4f55\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u800c\u8a00&#xff0c;\u90fd\u662f\u4e00\u573a\u5669\u68a6\u3002Ubuntu 20.04 LTS\u4f5c\u4e3a\u4e00\u6b3e\u957f\u671f\u652f\u6301\u7248\u672c&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76971.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-23T10:10:09+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76971.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76971.html\",\"name\":\"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-23T10:10:09+00:00\",\"dateModified\":\"2026-02-23T10:10:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76971.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76971.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76971.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76971.html","og_locale":"zh_CN","og_type":"article","og_title":"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Ubuntu 20.04\u670d\u52a1\u5668\u751f\u4ea7\u73af\u5883&#xff1a;\u7cbe\u7ec6\u5316\u7ba1\u63a7\u81ea\u52a8\u66f4\u65b0&#xff0c;\u5b88\u62a4\u7cfb\u7edf\u7a33\u5b9a\u6027\u7684\u5b8c\u6574\u7b56\u7565 \u5728\u670d\u52a1\u5668\u8fd0\u7ef4\u7684\u4e16\u754c\u91cc&#xff0c;\u7a33\u5b9a\u538b\u5012\u4e00\u5207\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4e00\u4e2a\u627f\u8f7d\u7740\u6838\u5fc3\u4e1a\u52a1\u7684\u751f\u4ea7\u73af\u5883&#xff0c;\u56e0\u4e3a\u4e00\u6b21\u672a\u7ecf\u8ba1\u5212\u7684\u81ea\u52a8\u5185\u6838\u66f4\u65b0&#xff0c;\u5bfc\u81f4\u670d\u52a1\u4e2d\u65ad\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38&#xff0c;\u751a\u81f3\u5f15\u53d1\u96be\u4ee5\u6392\u67e5\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8fd9\u79cd\u573a\u666f\u5bf9\u4e8e\u4efb\u4f55\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u800c\u8a00&#xff0c;\u90fd\u662f\u4e00\u573a\u5669\u68a6\u3002Ubuntu 20.04 LTS\u4f5c\u4e3a\u4e00\u6b3e\u957f\u671f\u652f\u6301\u7248\u672c&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/76971.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-23T10:10:09+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76971.html","url":"https:\/\/www.wsisp.com\/helps\/76971.html","name":"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-23T10:10:09+00:00","dateModified":"2026-02-23T10:10:09+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76971.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76971.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76971.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Ubuntu 20.04\u670d\u52a1\u5668\u5fc5\u770b\uff1a\u5982\u4f55\u5f7b\u5e95\u7981\u7528\u81ea\u52a8\u66f4\u65b0\u907f\u514d\u751f\u4ea7\u73af\u5883\u4e2d\u65ad\uff08\u9644systemctl\u5b8c\u6574\u547d\u4ee4\u6e05\u5355\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76971"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76971\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76971"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}