{"id":556,"date":"2022-11-02T01:11:08","date_gmt":"2022-12-17T19:39:15","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/"},"modified":"2025-08-02T18:19:47","modified_gmt":"2025-08-02T10:19:47","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/","title":{"rendered":"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5"},"content":{"rendered":"<h3>\u5f15\u8a00<\/h3>\n<p>Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u7ecf\u5e38\u9700\u8981\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u4ee5\u4fbf\u8fdb\u884c\u6545\u969c\u6392\u9664\u3002\u8fd9\u662f\u7cfb\u7edf\u7ba1\u7406\u5458\u9996\u5148\u8981\u505a\u7684\u4e8b\u60c5\u4e4b\u4e00\u3002<\/p>\n<p>Linux\u548c\u5728\u5176\u4e0a\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u751f\u6210\u5404\u79cd\u7c7b\u578b\u7684\u6d88\u606f\uff0c\u8fd9\u4e9b\u6d88\u606f\u88ab\u8bb0\u5f55\u5728\u4e0d\u540c\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002Linux\u4f7f\u7528\u4e00\u7ec4\u914d\u7f6e\u6587\u4ef6\u3001\u76ee\u5f55\u3001\u7a0b\u5e8f\u3001\u547d\u4ee4\u548c\u5b88\u62a4\u8fdb\u7a0b\u6765\u521b\u5efa\u3001\u5b58\u50a8\u548c\u56de\u6536\u8fd9\u4e9b\u65e5\u5fd7\u6d88\u606f\u3002\u56e0\u6b64\uff0c\u4e86\u89e3\u7cfb\u7edf\u4fdd\u5b58\u5176\u65e5\u5fd7\u6587\u4ef6\u7684\u4f4d\u7f6e\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u76f8\u5173\u547d\u4ee4\u53ef\u4ee5\u5728\u6545\u969c\u6392\u9664\u8fc7\u7a0b\u4e2d\u8282\u7701\u5b9d\u8d35\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u7814\u7a76Linux\u65e5\u5fd7\u673a\u5236\u7684\u4e0d\u540c\u90e8\u5206\u3002<\/p>\n<blockquote><p>\u514d\u8d23\u58f0\u660e\uff1a\u672c\u6559\u7a0b\u4e2d\u7684\u547d\u4ee4\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u9002\u7528\u4e8e\u7eaf\u51c0\u5b89\u88c5\u7684CentOS 9\u3001Ubuntu 22.10\u548cDebian 11\u3002<\/p><\/blockquote>\n<h2>\u7b2c\u4e00\u6b65 &#8211; \u68c0\u67e5\u9ed8\u8ba4\u7684\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e<\/h2>\n<p>\u5728Linux\u4e2d\uff0c\u9ed8\u8ba4\u7684\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u662f\/var\/log\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u8be5\u76ee\u5f55\u4e2d\u7684\u65e5\u5fd7\u6587\u4ef6\u5217\u8868\u3002<\/p>\n<pre class=\"post-pre\"><code><ol>\r\n  \t<li data-prefix=\"$\"><span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-l<\/span> \/var\/log<\/li>\r\n<\/ol><\/code><\/pre>\n<p>\u60a8\u5728CentOS\u7cfb\u7edf\u4e0a\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e8e\u8fd9\u6837\u7684\u8f93\u51fa\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>[root@centos-9-trim ~]# ls -l \/var\/log\r\ntotal 49316\r\ndrwxr-xr-x. 2 root root 6 Sep 27 19:17 anaconda\r\ndrwx------. 2 root root 99 Jan 3 08:23 audit\r\n-rw-rw----. 1 root utmp 1234560 Jan 3 16:16 btmp\r\n-rw-rw----. 1 root utmp 17305344 Jan 1 00:00 btmp-20230101\r\ndrwxr-x---. 2 chrony chrony 6 Aug 10 2021 chrony\r\n-rw-r--r--. 1 root root 130466 Dec 8 22:12 cloud-init.log\r\n-rw-r-----. 1 root adm 10306 Dec 8 22:12 cloud-init-output.log\r\n-rw-------. 1 root root 36979 Jan 3 16:03 cron\r\n-rw-------. 1 root root 27360 Dec 10 23:15 cron-20221211\r\n-rw-------. 1 root root 94140 Dec 17 23:07 cron-20221218\r\n-rw-------. 1 root root 95126 Dec 24 23:14 cron-20221225\r\n-rw-------. 1 root root 95309 Dec 31 23:04 cron-20230101\r\n...<\/code><\/pre>\n<\/div>\n<h2>\u7b2c\u4e8c\u6b65 &#8211; \u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u5185\u5bb9<\/h2>\n<p>\u4ee5\u4e0b\u662f\u5728\/var\/log\u76ee\u5f55\u4e0b\u60a8\u4f1a\u627e\u5230\u7684\u4e00\u4e9b\u5e38\u89c1\u7684\u65e5\u5fd7\u6587\u4ef6\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>wtmp<\/li>\n<li>utmp<\/li>\n<li>dmesg<\/li>\n<li>messages<\/li>\n<li>maillog \u6216 mail.log<\/li>\n<li>spooler<\/li>\n<li>auth.log \u6216 secure<\/li>\n<\/ul>\n<p>wtmp\u548cutmp\u6587\u4ef6\u8bb0\u5f55\u7740\u7528\u6237\u767b\u5f55\u548c\u9000\u51fa\u7cfb\u7edf\u7684\u60c5\u51b5\u3002\u60a8\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\u63a7\u5236\u53f0\u4e2d\u7684cat\u547d\u4ee4\u8bfb\u53d6\u8fd9\u4e9b\u6587\u4ef6\u7684\u5185\u5bb9\u2014\u2014\u9700\u8981\u4f7f\u7528\u5176\u4ed6\u7279\u5b9a\u7684\u547d\u4ee4\uff0c\u800c\u60a8\u5c06\u4f7f\u7528\u5176\u4e2d\u7684\u4e00\u4e9b\u547d\u4ee4\u3002<\/p>\n<p>\u8981\u67e5\u770b\u5f53\u524d\u767b\u5f55\u5230Linux\u670d\u52a1\u5668\u4e0a\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u4f7f\u7528who\u547d\u4ee4\u3002\u8be5\u547d\u4ee4\u4ece\/var\/run\/utmp\u6587\u4ef6\uff08\u5bf9\u4e8eCentOS\u548cDebian\uff09\u6216\/run\/utmp\u6587\u4ef6\uff08\u5bf9\u4e8eUbuntu\uff09\u83b7\u53d6\u5176\u6570\u636e\u3002<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u6765\u81eaUbuntu\u7684\u4f8b\u5b50\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>root@ubuntu-22:~# who\r\nroot pts\/0 2023-01-03 16:23 (198.211.111.194)<\/code><\/pre>\n<\/div>\n<p>\u5728\u8fd9\u4e2a\u7279\u5b9a\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u662f\u8be5\u7cfb\u7edf\u7684\u552f\u4e00\u4f7f\u7528\u8005\u3002<\/p>\n<p>last\u547d\u4ee4\u53ef\u4ee5\u544a\u8bc9\u60a8\u7528\u6237\u7684\u767b\u5f55\u5386\u53f2\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>root@ubuntu-22:~# last\r\nroot pts\/0 198.211.111.194 Tue Jan 3 16:23 still logged in\r\nreboot system boot 5.19.0-23-generi Thu Dec 8 21:48 still running\r\nwtmp begins Thu Dec 8 21:48:51 2022<\/code><\/pre>\n<\/div>\n<p>\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528last\u547d\u4ee4\uff0c\u5e76\u901a\u8fc7\u7ba1\u9053\uff08|\uff09\u4e3a\u7279\u5b9a\u7528\u6237\u6dfb\u52a0grep\u641c\u7d22\u3002<\/p>\n<p>\u8981\u67e5\u627e\u7cfb\u7edf\u4e0a\u4e00\u6b21\u91cd\u65b0\u542f\u52a8\u7684\u65f6\u95f4\uff0c\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol>\r\n  \t<li data-prefix=\"$\">last <span class=\"token function\">reboot<\/span><\/li>\r\n<\/ol><\/code><\/pre>\n<p>\u5728Debian\u4e2d\u53ef\u80fd\u4f1a\u5448\u73b0\u5982\u4e0b\u7ed3\u679c\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>root@debian-11-trim:~# last reboot\r\nreboot system boot 5.10.0-11-amd64 Thu Dec 8 21:49 still running\r\nwtmp begins Thu Dec 8 21:49:39 2022<\/code><\/pre>\n<\/div>\n<p>\u8981\u67e5\u770b\u67d0\u4eba\u4e0a\u6b21\u767b\u5f55\u7cfb\u7edf\u7684\u65f6\u95f4\uff0c\u8bf7\u4f7f\u7528lastlog\u547d\u4ee4\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol>\r\n  \t<li data-prefix=\"$\">lastlog<\/li>\r\n<\/ol><\/code><\/pre>\n<p>\u5728Debian\u670d\u52a1\u5668\u4e0a\uff0c\u60a8\u53ef\u80fd\u4f1a\u770b\u5230\u5982\u4e0b\u8f93\u51fa\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>root@debian-11-trim:~# lastlog\r\nUsername Port From Latest\r\nroot pts\/0 162.243.188.66 Tue Jan 3 16:23:03 +0000 2023\r\ndaemon **\u4ece\u672a\u767b\u5f55**\r\nbin **\u4ece\u672a\u767b\u5f55**\r\nsys **\u4ece\u672a\u767b\u5f55**\r\nsync **\u4ece\u672a\u767b\u5f55**\r\ngames **\u4ece\u672a\u767b\u5f55**\r\nman **\u4ece\u672a\u767b\u5f55**\r\nlp **\u4ece\u672a\u767b\u5f55**\r\nmail **\u4ece\u672a\u767b\u5f55**\r\nnews **\u4ece\u672a\u767b\u5f55**\r\nuucp **\u4ece\u672a\u767b\u5f55**\r\nproxy **\u4ece\u672a\u767b\u5f55**\r\nwww-data **\u4ece\u672a\u767b\u5f55**\r\nbackup **\u4ece\u672a\u767b\u5f55**\r\nlist **\u4ece\u672a\u767b\u5f55**\r\nirc **\u4ece\u672a\u767b\u5f55**\r\ngnats **\u4ece\u672a\u767b\u5f55**\r\nnobody **\u4ece\u672a\u767b\u5f55**\r\n_apt **\u4ece\u672a\u767b\u5f55**\r\nmessagebus **\u4ece\u672a\u767b\u5f55**\r\nuuidd **\u4ece\u672a\u767b\u5f55**\r\n...<\/code><\/pre>\n<\/div>\n<p>\u5bf9\u4e8e\u5176\u4ed6\u57fa\u4e8e\u6587\u672c\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528cat\u3001head\u6216tail\u547d\u4ee4\u6765\u9605\u8bfb\u5185\u5bb9\u3002<\/p>\n<p>\u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u60a8\u5c1d\u8bd5\u67e5\u770bDebian\u670d\u52a1\u5668\u4e0a\/var\/log\/messages\u6587\u4ef6\u7684\u6700\u540e\u5341\u884c\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol>\r\n  \t<li data-prefix=\"$\"><span class=\"token function\">sudo<\/span> <span class=\"token function\">tail<\/span> \/var\/log\/messages<\/li>\r\n<\/ol><\/code><\/pre>\n<p>\u60a8\u4f1a\u6536\u5230\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u8fd9\u6837\u7684\u8f93\u51fa\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\n<pre class=\"post-pre\"><code>\uff08\u8f93\u51fa\u5185\u5bb9\uff09<\/code><\/pre>\n<\/div>\n<pre class=\"post-pre\"><code>root@debian-11-trim:~# tail \/var\/log\/messages\r\nJan 1 00:10:14 debian-11-trim rsyslogd: [origin software=\"rsyslogd\" swVersion=\"8.2102.0\" x-pid=\"30025\" x-info=\"https:\/\/www.rsyslog.com\"] rsyslogd was HUPed\r\nJan 3 16:23:01 debian-11-trim vServerAgent[808]: INFO:2023\/01\/03 16:23:01 ssh_watcher.go:65: [SSH Watcher] Port knocking detected.\r\nJan 3 16:23:01 debian-11-trim vServerAgent[808]: INFO:2023\/01\/03 16:23:01 do_managed_keys_actioner.go:43: [DO-Managed Keys Actioner] Metadata contains 1 ssh keys and 1 dotty keys\r\nJan 3 16:23:01 debian-11-trim vServerAgent[808]: INFO:2023\/01\/03 16:23:01 do_managed_keys_actioner.go:49: [DO-Managed Keys Actioner] Attempting to update 1 dotty keys\r\nJan 3 16:23:01 debian-11-trim vServerAgent[808]: INFO:2023\/01\/03 16:23:01 do_managed_keys_actioner.go:70: [DO-Managed Keys Actioner] Updating 2 keys\r\nJan 3 16:23:01 debian-11-trim vServerAgent[808]: INFO:2023\/01\/03 16:23:01 do_managed_keys_actioner.go:75: [DO-Managed Keys Actioner] Keys updated<\/code><\/pre>\n<h2>\u7b2c\u4e09\u6b65 &#8211; \u4f7f\u7528rsyslog\u5b88\u62a4\u8fdb\u7a0b<\/h2>\n<p>\u5728\u65e5\u5fd7\u8bb0\u5f55\u673a\u5236\u7684\u6838\u5fc3\u662frsyslog\u5b88\u62a4\u7a0b\u5e8f\u3002\u8be5\u670d\u52a1\u8d1f\u8d23\u76d1\u542c\u6765\u81eaLinux\u7cfb\u7edf\u4e0d\u540c\u90e8\u5206\u7684\u65e5\u5fd7\u6d88\u606f\uff0c\u5e76\u5c06\u6d88\u606f\u8def\u7531\u5230\/var\/log\u76ee\u5f55\u4e2d\u7684\u9002\u5f53\u65e5\u5fd7\u6587\u4ef6\u3002\u5b83\u8fd8\u53ef\u4ee5\u5c06\u65e5\u5fd7\u6d88\u606f\u8f6c\u53d1\u5230\u53e6\u4e00\u53f0Linux\u670d\u52a1\u5668\u3002<\/p>\n<h3>rsyslog\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>rsyslog\u5b88\u62a4\u8fdb\u7a0b\u4ecersyslog.conf\u6587\u4ef6\u4e2d\u83b7\u53d6\u5176\u914d\u7f6e\u4fe1\u606f\u3002\u8be5\u6587\u4ef6\u4f4d\u4e8e\/etc\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>rsyslog.conf\u6587\u4ef6\u544a\u8bc9rsyslog\u5b88\u62a4\u8fdb\u7a0b\u65e5\u5fd7\u6d88\u606f\u7684\u4fdd\u5b58\u4f4d\u7f6e\u3002\u8fd9\u4e2a\u6307\u4ee4\u7531\u6587\u4ef6\u4e2d\u7684\u4e00\u7cfb\u5217\u4e24\u90e8\u5206\u7684\u884c\u63d0\u4f9b\u3002<\/p>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u5728Ubuntu\u7684rsyslog.d\/50-default.conf\u8def\u5f84\u4e0b\u627e\u5230\u3002<\/p>\n<p>\u8fd9\u4e2a\u7531\u4e24\u90e8\u5206\u6307\u4ee4\u7ec4\u6210\uff0c\u5305\u62ec\u4e00\u4e2a\u9009\u62e9\u5668\u548c\u4e00\u4e2a\u52a8\u4f5c\u3002\u8fd9\u4e24\u90e8\u5206\u7531\u7a7a\u683c\u5206\u9694\u3002<\/p>\n<p>\u9009\u62e9\u5668\u90e8\u5206\u6307\u5b9a\u4e86\u65e5\u5fd7\u6d88\u606f\u7684\u6765\u6e90\u548c\u91cd\u8981\u6027\uff0c\u800c\u52a8\u4f5c\u90e8\u5206\u5219\u8bf4\u660e\u4e86\u5982\u4f55\u5904\u7406\u8be5\u6d88\u606f\u3002<\/p>\n<p>\u9009\u62e9\u5668\u672c\u8eab\u53c8\u5206\u4e3a\u7531\u53e5\u70b9\uff08.\uff09\u5206\u9694\u7684\u4e24\u4e2a\u90e8\u5206\u3002\u53e5\u70b9\u4e4b\u524d\u7684\u7b2c\u4e00\u90e8\u5206\u88ab\u79f0\u4e3a\u8bbe\u65bd\uff08\u6d88\u606f\u7684\u6765\u6e90\uff09\uff0c\u53e5\u70b9\u4e4b\u540e\u7684\u7b2c\u4e8c\u90e8\u5206\u88ab\u79f0\u4e3a\u4f18\u5148\u7ea7\uff08\u6d88\u606f\u7684\u4e25\u91cd\u7a0b\u5ea6\uff09\u3002<\/p>\n<p>\u4e00\u8d77\uff0c\u8bbe\u65bd\/\u4f18\u5148\u7ea7\u548c\u52a8\u4f5c\u5bf9\u544a\u8bc9rsyslog\u5728\u751f\u6210\u7b26\u5408\u6761\u4ef6\u7684\u65e5\u5fd7\u6d88\u606f\u65f6\u5e94\u8be5\u505a\u4ec0\u4e48\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bCentOS \/etc\/rsyslog.conf\u6587\u4ef6\u7684\u6458\u5f55\uff1a<\/p>\n<pre class=\"post-pre\"><code><ol>\r\n  <li data-prefix=\"$\"><span class=\"token function\">cat<\/span> \/etc\/rsyslog.conf<\/li>\r\n<\/ol><\/code><\/pre>\n<p>\u4f60\u5e94\u8be5\u770b\u5230\u50cf\u8fd9\u6837\u7684\u8f93\u51fa\u3002<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code># rsyslog configuration file\r\n# For more information see \/usr\/share\/doc\/rsyslog-*\/rsyslog_conf.html\r\n# or latest version online at http:\/\/www.rsyslog.com\/doc\/rsyslog_conf.html\r\n# If you experience problems, see http:\/\/www.rsyslog.com\/doc\/troubleshoot.html\r\n\r\n#### GLOBAL DIRECTIVES ####\r\n\r\n# Where to place auxiliary files\r\nglobal(workDirectory=\"\/var\/lib\/rsyslog\")\r\n\r\n# Use default timestamp format\r\nmodule(load=\"builtin:omfile\" Template=\"RSYSLOG_TraditionalFileFormat\")\r\n\r\n# Include all config files in \/etc\/rsyslog.d\/\r\ninclude(file=\"\/etc\/rsyslog.d\/*.conf\" mode=\"optional\")\r\n\r\n#### MODULES ####\r\n\r\nmodule(load=\"imuxsock\" # provides support for local system logging (e.g. via logger command)\r\n       SysSock.Use=\"off\") # Turn off message reception via local log socket;\r\n                          # local messages are retrieved through imjournal now.\r\nmodule(load=\"imjournal\" # provides access to the systemd journal\r\n       StateFile=\"imjournal.state\") # File to store the position in the journal\r\n\r\n#module(load=\"imklog\") # reads kernel messages (the same are read from journald)\r\n#module(load=\"immark\") # provides --MARK-- message capability\r\n\r\n# Provides UDP syslog reception\r\n# for parameters see http:\/\/www.rsyslog.com\/doc\/imudp.html\r\n#module(load=\"imudp\") # needs to be done just once\r\n#input(type=\"imudp\" port=\"514\")\r\n\r\n\u2026<\/code><\/pre>\n<p>\u4e3a\u4e86\u7406\u89e3\u8fd9\u4e00\u5207\u7684\u542b\u4e49\uff0c\u8ba9\u6211\u4eec\u8003\u8651Linux\u6240\u8ba4\u53ef\u7684\u4e0d\u540c\u7c7b\u578b\u7684\u8bbe\u65bd\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5217\u8868\uff1a<\/p>\n<ul class=\"post-ul\">\n<li><strong>auth\u6216authpriv<\/strong>\uff1a\u6765\u81ea\u6388\u6743\u548c\u5b89\u5168\u76f8\u5173\u4e8b\u4ef6\u7684\u6d88\u606f<\/li>\n<li><strong>kern<\/strong>\uff1a\u6765\u81eaLinux\u5185\u6838\u7684\u4efb\u4f55\u6d88\u606f<\/li>\n<li><strong>mail<\/strong>\uff1a\u7531\u90ae\u4ef6\u5b50\u7cfb\u7edf\u751f\u6210\u7684\u6d88\u606f<\/li>\n<li><strong>cron<\/strong>\uff1a\u4e0eCron\u5b88\u62a4\u8fdb\u7a0b\u76f8\u5173\u7684\u6d88\u606f<\/li>\n<li><strong>daemon<\/strong>\uff1a\u6765\u81ea\u5b88\u62a4\u8fdb\u7a0b\u7684\u6d88\u606f<\/li>\n<li><strong>news<\/strong>\uff1a\u6765\u81ea\u7f51\u7edc\u65b0\u95fb\u5b50\u7cfb\u7edf\u7684\u6d88\u606f<\/li>\n<li><strong>lpr<\/strong>\uff1a\u4e0e\u6253\u5370\u76f8\u5173\u7684\u65e5\u5fd7\u6d88\u606f<\/li>\n<li><strong>user<\/strong>\uff1a\u6765\u81ea\u7528\u6237\u7a0b\u5e8f\u7684\u65e5\u5fd7\u6d88\u606f<\/li>\n<li><strong>local0\u5230local7<\/strong>\uff1a\u4fdd\u7559\u4f9b\u672c\u5730\u4f7f\u7528<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u662f\u6309\u5347\u5e8f\u6392\u5217\u7684\u4f18\u5148\u7ea7\u5217\u8868\uff1a<\/p>\n<ul class=\"post-ul\">\n<li><strong>debug<\/strong>\uff1a\u6765\u81ea\u7a0b\u5e8f\u7684\u8c03\u8bd5\u4fe1\u606f<\/li>\n<li><strong>info<\/strong>\uff1a\u7b80\u5355\u7684\u4fe1\u606f\u6027\u6d88\u606f &#8211; \u4e0d\u9700\u8981\u5e72\u9884<\/li>\n<li><strong>notice<\/strong>\uff1a\u53ef\u80fd\u9700\u8981\u6ce8\u610f\u7684\u60c5\u51b5<\/li>\n<li><strong>warn<\/strong>\uff1a\u8b66\u544a<\/li>\n<li><strong>err<\/strong>\uff1a\u9519\u8bef<\/li>\n<li><strong>crit<\/strong>\uff1a\u4e25\u91cd\u60c5\u51b5<\/li>\n<li><strong>alert<\/strong>\uff1a\u9700\u8981\u7acb\u5373\u5e72\u9884\u7684\u60c5\u51b5<\/li>\n<li><strong>emerg<\/strong>\uff1a\u7d27\u6025\u60c5\u51b5<\/li>\n<\/ul>\n<p>\u73b0\u5728\u6211\u4eec\u6765\u8003\u8651\u4e00\u4e0b\u6587\u4ef6\u4e2d\u7684\u4ee5\u4e0b\u884c\u5185\u5bb9\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>\u2026\r\n# Log cron stuff\r\ncron.*    \/var\/log\/cron\r\n\u2026<\/code><\/pre>\n<p>\u8fd9\u4ec5\u4ec5\u662f\u544a\u8bc9rsyslog\u5b88\u62a4\u8fdb\u7a0b\u5c06\u6765\u81eacron\u5b88\u62a4\u8fdb\u7a0b\u7684\u6240\u6709\u6d88\u606f\u4fdd\u5b58\u5230\u4e00\u4e2a\u540d\u4e3a\/var\/log\/cron\u7684\u6587\u4ef6\u4e2d\u3002\u53e5\u70b9\u540e\u9762\u7684\u661f\u53f7\uff08*\uff09\u8868\u793a\u6240\u6709\u4f18\u5148\u7ea7\u7684\u6d88\u606f\u90fd\u5c06\u88ab\u8bb0\u5f55\u3002\u540c\u6837\u5730\uff0c\u5982\u679c\u8bbe\u65bd\u88ab\u6307\u5b9a\u4e3a\u661f\u53f7\uff0c\u90a3\u4e48\u5b83\u5c06\u8868\u793a\u6240\u6709\u6765\u6e90\u3002<\/p>\n<p>\u8bbe\u65bd\u548c\u4f18\u5148\u7ea7\u53ef\u4ee5\u4ee5\u591a\u79cd\u65b9\u5f0f\u76f8\u5173\u8054\u3002<\/p>\n<p>\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5f53\u70b9\u53f7\u4e4b\u540e\u53ea\u6307\u5b9a\u4e86\u4e00\u4e2a\u4f18\u5148\u7ea7\u65f6\uff0c\u5b83\u610f\u5473\u7740\u6240\u6709\u7b49\u4e8e\u6216\u9ad8\u4e8e\u8be5\u4f18\u5148\u7ea7\u7684\u4e8b\u4ef6\u90fd\u5c06\u88ab\u6355\u83b7\u3002\u56e0\u6b64\uff0c\u4ee5\u4e0b\u6307\u4ee4\u4f1a\u5bfc\u81f4\u6765\u81ea\u90ae\u4ef6\u5b50\u7cfb\u7edf\u7684\u4efb\u4f55\u4f18\u5148\u7ea7\u4e3a\u8b66\u544a\u6216\u66f4\u9ad8\u7684\u6d88\u606f\u88ab\u8bb0\u5f55\u5728\/var\/log\u76ee\u5f55\u4e0b\u7684\u7279\u5b9a\u6587\u4ef6\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>mail.warn \/var\/log\/mail.warn<\/code><\/pre>\n<p>\u8fd9\u5c06\u8bb0\u5f55\u6240\u6709\u8b66\u544a\u7ea7\u522b\u7b49\u4e8e\u6216\u9ad8\u4e8e\u8be5\u7ea7\u522b\u7684\u6d88\u606f\uff0c\u4f46\u4f1a\u6392\u9664\u6240\u6709\u4f4e\u4e8e\u8be5\u7ea7\u522b\u7684\u6d88\u606f\u3002\u56e0\u6b64\uff0c\u6b64\u6587\u4ef6\u4e2d\u4e5f\u5c06\u8bb0\u5f55\u9519\u8bef\u3001\u4e25\u91cd\u3001\u8b66\u62a5\u6216\u7d27\u6025\u7ea7\u522b\u7684\u6d88\u606f\u3002<\/p>\n<p>\u5728\u53e5\u53f7\u540e\u9762\u4f7f\u7528\u7b49\u53f7\uff08=\uff09\u5c06\u4ec5\u8bb0\u5f55\u6307\u5b9a\u4f18\u5148\u7ea7\u7684\u65e5\u5fd7\u3002\u6240\u4ee5\uff0c\u5982\u679c\u6211\u4eec\u53ea\u60f3\u6355\u83b7\u6765\u81ea\u90ae\u4ef6\u5b50\u7cfb\u7edf\u7684\u4fe1\u606f\u6d88\u606f\uff0c\u914d\u7f6e\u5e94\u8be5\u7c7b\u4f3c\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>mail.=info \/var\/log\/mail.info<\/code><\/pre>\n<p>\u518d\u8005\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8981\u6355\u83b7\u90ae\u4ef6\u5b50\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u9664\u4e86\u4fe1\u606f\u6d88\u606f\u4e4b\u5916\u7684\u5185\u5bb9\uff0c\u5219\u914d\u7f6e\u53ef\u80fd\u4f1a\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>mail.!info \/var\/log\/mail.info<\/code><\/pre>\n<p>\u6216\u8005<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>mail.!=info \/var\/log\/mail.info<\/code><\/pre>\n<p>\u5728\u7b2c\u4e00\u79cd\u60c5\u51b5\u4e0b\uff0cmail.info\u6587\u4ef6\u5c06\u5305\u542b\u6240\u6709\u4f18\u5148\u7ea7\u4f4e\u4e8einfo\u7684\u5185\u5bb9\u3002\u5728\u7b2c\u4e8c\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u6587\u4ef6\u5c06\u5305\u542b\u6240\u6709\u4f18\u5148\u7ea7\u9ad8\u4e8einfo\u7684\u6d88\u606f\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u9017\u53f7\u5c06\u540c\u4e00\u884c\u4e2d\u7684\u591a\u4e2a\u8bbe\u65bd\u5206\u5f00\u3002<\/p>\n<p>\u540c\u4e00\u884c\u4e2d\u7684\u591a\u4e2a\u6765\u6e90\uff08facility.priority\uff09\u4ee5\u5206\u53f7\u5206\u9694\u3002<\/p>\n<p>\u5f53\u4e00\u4e2a\u64cd\u4f5c\u88ab\u6807\u8bb0\u4e3a\u661f\u53f7\u65f6\uff0c\u610f\u5473\u7740\u9002\u7528\u4e8e\u6240\u6709\u7528\u6237\u3002\u5728\u4f60\u7684CentOS rsyslog.conf\u6587\u4ef6\u4e2d\u7684\u8fd9\u4e2a\u6761\u76ee\u6240\u8868\u8fbe\u7684\u5c31\u662f\u8fd9\u4e2a\u610f\u601d\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code># \u6240\u6709\u4eba\u90fd\u4f1a\u6536\u5230\u7d27\u6025\u6d88\u606f\r\n*.emerg :omusrmsg:*<\/code><\/pre>\n<p>\u5c1d\u8bd5\u67e5\u770b\u60a8\u7684Linux\u7cfb\u7edf\u4e2drsyslog.conf\u6587\u4ef6\u7684\u5185\u5bb9\u3002\u4ee5\u4e0b\u662f\u6765\u81ea\u53e6\u4e00\u53f0Debian\u670d\u52a1\u5668\u7684\u6458\u5f55\u4f5c\u4e3a\u793a\u4f8b\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code># \/etc\/rsyslog.conf configuration file for rsyslog\r\n#\r\n# For more information install rsyslog-doc and see\r\n# \/usr\/share\/doc\/rsyslog-doc\/html\/configuration\/index.html\r\n\r\n#################\r\n#### MODULES ####\r\n#################\r\n\r\nmodule(load=\"imuxsock\") # provides support for local system logging\r\nmodule(load=\"imklog\")   # provides kernel logging support\r\n#module(load=\"immark\")  # provides --MARK-- message capability\r\n\r\n# provides UDP syslog reception\r\n#module(load=\"imudp\")\r\n#input(type=\"imudp\" port=\"514\")\r\n\r\n# provides TCP syslog reception\r\n#module(load=\"imtcp\")\r\n#input(type=\"imtcp\" port=\"514\")\r\n\r\n###########################\r\n#### GLOBAL DIRECTIVES ####\r\n###########################\r\n\r\n#\r\n# Use traditional timestamp format.\r\n# To enable high precision timestamps, comment out the following line.\r\n#\r\n$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat\r\n\r\n# Set the default permissions for all log files.\r\n#\r\n$FileOwner root\r\n$FileGroup adm\r\n$FileCreateMode 0640\r\n$DirCreateMode 0755\r\n$Umask 0022\r\n\u2026<\/code><\/pre>\n<p>\u6b63\u5982\u4f60\u6240\u89c1\uff0cDebian\u5c06\u6240\u6709\u5b89\u5168\u548c\u6388\u6743\u7ea7\u522b\u7684\u6d88\u606f\u4fdd\u5b58\u5728\/var\/log\/auth.log\u4e2d\uff0c\u800cCentOS\u5219\u4fdd\u5b58\u5728\/var\/log\/secure\u4e0b\u3002<\/p>\n<p>rsyslog\u7684\u914d\u7f6e\u8fd8\u53ef\u4ee5\u6765\u81ea\u5176\u4ed6\u81ea\u5b9a\u4e49\u6587\u4ef6\u3002\u8fd9\u4e9b\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e\/etc\/rsyslog.d\u76ee\u5f55\u4e0b\u3002rsyslog.conf\u6587\u4ef6\u4f7f\u7528$IncludeConfig\u6307\u4ee4\u5f15\u5165\u8fd9\u4e9b\u76ee\u5f55\u3002<\/p>\n<p>\u8fd9\u662f\u5728Ubuntu\u4e2d\u7684\u5916\u89c2\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>\u2026\r\n#\r\n# Include all config files in \/etc\/rsyslog.d\/\r\n#\r\n$IncludeConfig \/etc\/rsyslog.d\/*.conf\r\n\u2026<\/code><\/pre>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u4f4d\u4e8e\/etc\/rsyslog.d\u76ee\u5f55\u4e0b\u7684\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-l<\/span> \/etc\/rsyslog.d<\/li>\n<\/ol>\n<p>\u60a8\u5c06\u5728\u60a8\u7684\u7ec8\u7aef\u673a\u4e0a\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u5185\u5bb9\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>-rw-r--r-- 1 root root 314 Sep 19  2021 20-ufw.conf\r\n-rw-r--r-- 1 root root 255 Sep 30 22:07 21-cloudinit.conf\r\n-rw-r--r-- 1 root root 1124 Nov 16  2021 50-default.conf<\/code><\/pre>\n<p>\u65e5\u5fd7\u6d88\u606f\u7684\u76ee\u7684\u5730\u4e0d\u4e00\u5b9a\u662f\u65e5\u5fd7\u6587\u4ef6\uff0c\u6d88\u606f\u53ef\u4ee5\u53d1\u9001\u5230\u7528\u6237\u7684\u63a7\u5236\u53f0\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u52a8\u4f5c\u5b57\u6bb5\u5c06\u5305\u542b\u7528\u6237\u540d\u3002\u5982\u679c\u9700\u8981\u5411\u591a\u4e2a\u7528\u6237\u53d1\u9001\u6d88\u606f\uff0c\u4ed6\u4eec\u7684\u7528\u6237\u540d\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694\u3002\u5982\u679c\u9700\u8981\u5e7f\u64ad\u6d88\u606f\u7ed9\u6bcf\u4e2a\u7528\u6237\uff0c\u5219\u5728\u52a8\u4f5c\u5b57\u6bb5\u4e2d\u7528\u661f\u53f7\uff08*\uff09\u6307\u5b9a\u3002<\/p>\n<p>\u7531\u4e8e\u662f\u7f51\u7edc\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e00\u90e8\u5206\uff0crsyslog\u5b88\u62a4\u7a0b\u5e8f\u4e0d\u4ec5\u53ef\u4ee5\u5c06\u65e5\u5fd7\u6d88\u606f\u5b58\u50a8\u5728\u672c\u5730\uff0c\u8fd8\u53ef\u4ee5\u5c06\u5176\u8f6c\u53d1\u5230\u7f51\u7edc\u4e2d\u7684\u5176\u4ed6Linux\u670d\u52a1\u5668\uff0c\u6216\u8005\u4f5c\u4e3a\u5176\u4ed6\u7cfb\u7edf\u7684\u5b58\u50a8\u5e93\u3002\u8be5\u5b88\u62a4\u7a0b\u5e8f\u5728UDP\u7aef\u53e3514\u4e0a\u76d1\u542c\u65e5\u5fd7\u6d88\u606f\u3002\u4ee5\u4e0b\u793a\u4f8b\u5c06\u5185\u6838\u5173\u952e\u6d88\u606f\u8f6c\u53d1\u5230\u540d\u4e3a&#8221;texas&#8221;\u7684\u670d\u52a1\u5668\uff1a<\/p>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/div>\n<pre class=\"post-pre\"><code>kern.crit @texas<\/code><\/pre>\n<h2>\u6b65\u9aa4\u56db &#8211; \u521b\u5efa\u548c\u6d4b\u8bd5\u60a8\u81ea\u5df1\u7684\u65e5\u5fd7\u4fe1\u606f<\/h2>\n<p>\u73b0\u5728\u662f\u65f6\u5019\u8ba9\u60a8\u81ea\u5df1\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u4e86\u3002\u4e3a\u4e86\u6d4b\u8bd5\u6b64\u529f\u80fd\uff0c\u60a8\u5c06\u6309\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>\u5728\/etc\/rsyslog.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u65e5\u5fd7\u6587\u4ef6\u89c4\u8303<\/li>\n<li>\u91cd\u542frsyslog\u5b88\u62a4\u7a0b\u5e8f<\/li>\n<li>\u4f7f\u7528logger\u5de5\u5177\u6d4b\u8bd5\u914d\u7f6e<\/li>\n<\/ul>\n<p>\u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u60a8\u5c06\u5728CentOS Linux\u7cfb\u7edf\u7684rsyslog.conf\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e24\u884c\u65b0\u7684\u4ee3\u7801\u3002\u6b63\u5982\u60a8\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6240\u770b\u5230\u7684\u90a3\u6837\uff0c\u5b83\u4eec\u90fd\u6765\u81ea\u4e00\u4e2a\u540d\u4e3alocal4\u7684\u8bbe\u65bd\uff0c\u5e76\u4e14\u5177\u6709\u4e0d\u540c\u7684\u4f18\u5148\u7ea7\uff1a<\/p>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">vi<\/span> \/etc\/rsyslog.conf<\/li>\n<\/ol>\n<p>\u8fd9\u662f\u6587\u7ae0\u300a\u5982\u4f55\u5728Ubuntu\u3001Debian\u548cCentOS\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u300b\u7684\u7b2c4\u90e8\u5206\uff08\u51715\u90e8\u5206\uff09\u3002<\/p>\n<p>\u2026 # \u65b0\u589e\u7684\u884c\u7528\u4e8e\u6d4b\u8bd5\u65e5\u5fd7\u6d88\u606f\u751f\u6210<br \/>local4.crit \/var\/log\/local4crit.log<br \/>local4.=info \/var\/log\/local4info.log<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u60a8\u9700\u8981\u91cd\u65b0\u542f\u52a8\u670d\u52a1\uff0c\u4ee5\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u6570\u636e\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">\/etc\/init.d\/rsyslog restart<\/div>\n<\/div>\n<p>\u4e3a\u4e86\u73b0\u5728\u751f\u6210\u65e5\u5fd7\u4fe1\u606f\uff0c\u8c03\u7528\u4e86\u65e5\u5fd7\u8bb0\u5f55\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">logger -p local4.info &#8221; This is a info message from local 4&#8243;<\/div>\n<\/div>\n<p>\u73b0\u5728\u67e5\u770b\/var\/log\u76ee\u5f55\u4e0b\u663e\u793a\u4e86\u4e24\u4e2a\u65b0\u6587\u4ef6\u3002<\/p>\n<div class=\"output-block\">\n<div class=\"output-label\">\u8f93\u51fa<\/div>\n<div class=\"output-content\">\n    \u2026 -rw&#8212;&#8212;- 1 root root 0 Jan 3 11:21 local4crit.log<br \/>\n    -rw&#8212;&#8212;- 1 root root 72 Jan 3 11:22 local4info.log \u2026\n  <\/div>\n<\/div>\n<p>\u5f53\u4f60\u6253\u5f00local4info.log\u65f6\uff0c\u4f60\u4f1a\u770b\u5230\u5df2\u7ecf\u8bb0\u5f55\u4e86\u6d88\u606f\uff0c\u56e0\u4e3a\u5b83\u7684\u5927\u5c0f\u4e0d\u4e3a\u96f6\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">cat \/var\/log\/local4info.log<\/div>\n<\/div>\n<div class=\"output-block\">\n<div class=\"output-label\">\u8f93\u51fa<\/div>\n<div class=\"output-content\">\n    Jan 3 11:22:32 TestLinux root: This is a info message from local 4\n  <\/div>\n<\/div>\n<h2>\u7b2c\u4e94\u6b65 &#8211; \u8f6e\u6362\u65e5\u5fd7\u6587\u4ef6<\/h2>\n<p>\u968f\u7740\u8d8a\u6765\u8d8a\u591a\u7684\u4fe1\u606f\u88ab\u8bb0\u5f55\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\uff0c\u5b83\u4eec\u53d8\u5f97\u8d8a\u6765\u8d8a\u5927\u3002\u8fd9\u663e\u7136\u5e26\u6765\u4e86\u6f5c\u5728\u7684\u6027\u80fd\u95ee\u9898\u3002\u6b64\u5916\uff0c\u6587\u4ef6\u7684\u7ba1\u7406\u53d8\u5f97\u7e41\u7410\u3002<\/p>\n<p>Linux\u4f7f\u7528\u8f6e\u6362\u65e5\u5fd7\u6587\u4ef6\u7684\u6982\u5ff5\u6765\u66ff\u4ee3\u6e05\u9664\u6216\u5220\u9664\u65e5\u5fd7\u6587\u4ef6\u3002\u5f53\u65e5\u5fd7\u6587\u4ef6\u88ab\u8f6e\u6362\u65f6\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\u5e76\u5c06\u65e7\u7684\u65e5\u5fd7\u6587\u4ef6\u91cd\u547d\u540d\uff0c\u540c\u65f6\u53ef\u9009\u62e9\u8fdb\u884c\u538b\u7f29\u3002\u56e0\u6b64\uff0c\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\u53ef\u4ee5\u4fdd\u7559\u591a\u4e2a\u65e7\u7248\u672c\u5728\u7ebf\u4e0a\u3002\u8fd9\u4e9b\u6587\u4ef6\u4f1a\u4fdd\u5b58\u4e00\u6bb5\u65f6\u95f4\uff0c\u5e76\u4ee3\u8868\u4e86\u79ef\u538b\u7684\u65e5\u5fd7\u3002\u4e00\u65e6\u4ea7\u751f\u4e86\u4e00\u5b9a\u6570\u91cf\u7684\u79ef\u538b\uff0c\u65b0\u7684\u65e5\u5fd7\u8f6e\u6362\u5c06\u5bfc\u81f4\u6700\u65e7\u7684\u65e5\u5fd7\u6587\u4ef6\u88ab\u5220\u9664\u3002<\/p>\n<p>\u8f6e\u6362\u662f\u901a\u8fc7logrotate\u5b9e\u7528\u7a0b\u5e8f\u53d1\u8d77\u7684\u3002<\/p>\n<h3>\u65e5\u5fd7\u8f6e\u6362\u914d\u7f6e\u6587\u4ef6\u7684\u8bbe\u7f6e<\/h3>\n<p>\u5c31\u50cfrsyslog\u4e00\u6837\uff0clogrotate\u4e5f\u4f9d\u8d56\u4e8e\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7684\u540d\u79f0\u662flogrotate.conf\u3002\u5b83\u4f4d\u4e8e\/etc\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u60a8\u5728Debian\u670d\u52a1\u5668\u7684logrotate.conf\u6587\u4ef6\u4e2d\u6240\u770b\u5230\u7684\u5185\u5bb9\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">cat \/etc\/logrotate.conf<\/div>\n<\/div>\n<div class=\"output-block\">\n<div class=\"output-label\">\u8f93\u51fa<\/div>\n<div class=\"output-content\">\n    # see &#8220;man logrotate&#8221; for details<br \/>\n    # global options do not affect preceding include directives<br \/>\n    # rotate log files weekly<br \/>\n    weekly<br \/>\n    # keep 4 weeks worth of backlogs<br \/>\n    rotate 4<br \/>\n    # create new (empty) log files after rotating old ones<br \/>\n    create<br \/>\n    # use date as a suffix of the rotated file<br \/>\n    #dateext<br \/>\n    # uncomment this if you want your log files compressed<br \/>\n    #compress<br \/>\n    # packages drop log rotation information into this directory<br \/>\n    include \/etc\/logrotate.d<br \/>\n    # system-specific logs may also be configured here.\n  <\/div>\n<\/div>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u65e5\u5fd7\u6587\u4ef6\u6bcf\u5468\u8f6e\u6362\u4e00\u6b21\uff0c\u540c\u65f6\u5728\u7ebf\u4fdd\u7559\u56db\u4e2a\u5b58\u6863\u3002\u5f53\u7a0b\u5e8f\u8fd0\u884c\u65f6\uff0c\u5c06\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u7a7a\u65e5\u5fd7\u6587\u4ef6\uff0c\u53ef\u9009\u62e9\u662f\u5426\u538b\u7f29\u65e7\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n<p>\u552f\u4e00\u7684\u4f8b\u5916\u662fwtmp\u548cbtmp\u6587\u4ef6\u3002wtmp\u6587\u4ef6\u7528\u4e8e\u8ddf\u8e2a\u7cfb\u7edf\u767b\u5f55\u8bb0\u5f55\uff0c\u800cbtmp\u6587\u4ef6\u7528\u4e8e\u8bb0\u5f55\u9519\u8bef\u7684\u767b\u5f55\u5c1d\u8bd5\u3002\u8fd9\u4e24\u4e2a\u65e5\u5fd7\u6587\u4ef6\u6bcf\u4e2a\u6708\u90fd\u8981\u8fdb\u884c\u8f6e\u6362\uff0c\u5982\u679c\u627e\u5230\u4efb\u4f55\u4ee5\u524d\u7684wtmp\u6216btmp\u6587\u4ef6\uff0c\u4e0d\u4f1a\u8fd4\u56de\u9519\u8bef\u3002<\/p>\n<p>\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f6e\u6362\u914d\u7f6e\u4fdd\u5b58\u5728\/etc\/logrotate.d\u76ee\u5f55\u4e0b\u3002\u8fd9\u4e9b\u914d\u7f6e\u4e5f\u4f1a\u5728logrotate.conf\u6587\u4ef6\u4e2d\u901a\u8fc7include\u6307\u4ee4\u8fdb\u884c\u5305\u542b\u3002Debian\u5b89\u88c5\u4f1a\u663e\u793a\u6b64\u76ee\u5f55\u7684\u5185\u5bb9\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">ls -l \/etc\/logrotate.d<\/div>\n<\/div>\n<div class=\"output-block\">\n<div class=\"output-label\">\u8f93\u51fa<\/div>\n<div class=\"output-content\">\n    total 32<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 120 Jan 30 2021 alternatives<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 173 Jun 10 2021 apt<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 130 Oct 14 2019 btmp<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 160 Oct 19 2021 chrony<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 112 Jan 30 2021 dpkg<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 374 Feb 17 2021 rsyslog<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 235 Feb 19 2021 unattended-upgrades<br \/>\n    -rw-r&#8211;r&#8211; 1 root root 145 Oct 14 2019 wtmp\n  <\/div>\n<\/div>\n<p>rsyslog \u7684\u5185\u5bb9\u5c55\u793a\u4e86\u5982\u4f55\u8f6e\u6362\u4e00\u7cfb\u5217\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n<div class=\"command-block\">\n<div class=\"command-prompt\">$<\/div>\n<div class=\"command-content\">cat \/etc\/logrotate.d\/rsyslog<\/div>\n<\/div>\n<div class=\"output-block\">\n<div class=\"output-label\">\u8f93\u51fa<\/div>\n<div class=\"output-content\">\n    \/var\/log\/syslog<br \/>\n    \/var\/log\/mail.info<br \/>\n    \/var\/log\/mail.warn<br \/>\n    \/var\/log\/mail.err<br \/>\n    \/var\/log\/mail.log<br \/>\n    \/var\/log\/daemon.log<br \/>\n    \/var\/log\/kern.log<br \/>\n    \/var\/log\/auth.log<br \/>\n    \/var\/log\/user.log<br \/>\n    \/var\/log\/lpr.log<br \/>\n    \/var\/log\/cron.log<br \/>\n    \/var\/log\/debug<br \/>\n    \/var\/log\/messages {<br \/>\n    &nbsp;&nbsp;rotate 4<br \/>\n    &nbsp;&nbsp;weekly<br \/>\n    &nbsp;&nbsp;missingok<br \/>\n    &nbsp;&nbsp;notifempty<br \/>\n    &nbsp;&nbsp;compress<br \/>\n    &nbsp;&nbsp;delaycompress<br \/>\n    &nbsp;&nbsp;sharedscripts<br \/>\n    &nbsp;&nbsp;postrotate<br \/>\n    &nbsp;&nbsp;&nbsp;&nbsp;\/usr\/lib\/rsyslog\/rsyslog-rotate<br \/>\n    &nbsp;&nbsp;endscript<br \/>\n    }\n  <\/div>\n<\/div>\n<p>\u5982\u4f60\u6240\u89c1\uff0c\u6d88\u606f\u6587\u4ef6\u6bcf\u5929\u90fd\u4f1a\u91cd\u65b0\u521d\u59cb\u5316\uff0c\u4fdd\u7559\u56db\u5929\u7684\u65e5\u5fd7\u5728\u7ebf\u3002\u5176\u4ed6\u65e5\u5fd7\u6587\u4ef6\u6bcf\u5468\u8f6e\u6362\u4e00\u6b21\u3002<\/p>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f postrotate \u6307\u4ee4\u3002\u5b83\u6307\u5b9a\u4e86\u5728\u6574\u4e2a\u65e5\u5fd7\u8f6e\u6362\u5b8c\u6210\u540e\u53d1\u751f\u7684\u52a8\u4f5c\u3002<\/p>\n<h2>\u7b2c\u516d\u6b65 &#8211; \u6d4b\u8bd5\u8f6e\u6362<\/h2>\n<p>\u8fd9\u662f\u6587\u7ae0\u300a\u5982\u4f55\u5728Ubuntu\u3001Debian\u548cCentOS\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u300b\u7684\u7b2c5\u90e8\u5206\uff08\u51715\u90e8\u5206\uff09\u3002<\/p>\n<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u624b\u52a8\u8fd0\u884clogrotate\u6765\u5faa\u73af\u5229\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u65e5\u5fd7\u6587\u4ef6\u3002\u4e3a\u6b64\uff0c\u60a8\u9700\u8981\u5c06\u76f8\u5173\u7684\u914d\u7f6e\u6587\u4ef6\u4f5c\u4e3a\u547d\u4ee4\u7684\u53c2\u6570\u6765\u6307\u5b9a\u3002<\/p>\n<p>\u4e3a\u4e86\u6f14\u793a\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u6211\u4eec\u5728\u4e00\u4e2a\u6d4b\u8bd5\u7684CentOS\u670d\u52a1\u5668\u7684\/var\/log\u76ee\u5f55\u4e0b\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u5217\u8868\u3002<\/p>\n<pre class=\"post-pre\"><code>ls -l \/var\/log<\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code>total 49324 \r\n-rw-------. 1 root root 84103 Jan 3 17:20 messages \r\n-rw-------. 1 root root 165534 Dec 10 23:12 messages-20221211 \r\n-rw-------. 1 root root 254743 Dec 18 00:00 messages-20221218 \r\n-rw-------. 1 root root 217810 Dec 25 00:00 messages-20221225 \r\n-rw-------. 1 root root 237726 Dec 31 23:45 messages-20230101 \r\ndrwx------. 2 root root 6 Mar 2 2022 private \r\ndrwxr-xr-x. 2 root root 6 Feb 24 2022 qemu-ga \r\nlrwxrwxrwx. 1 root root 39 Mar 2 2022 README -> ..\/..\/usr\/share\/doc\/systemd\/README.logs \r\n-rw-------. 1 root root 2514753 Jan 3 17:25 secure \r\n-rw-------. 1 root root 2281107 Dec 10 23:59 secure-20221211 \r\n-rw-------. 1 root root 9402839 Dec 17 23:59 secure-20221218 \r\n-rw-------. 1 root root 8208657 Dec 25 00:00 secure-20221225 \r\n-rw-------. 1 root root 7081010 Dec 31 23:59 secure-20230101 \r\ndrwxr-x---. 2 sssd sssd 6 Jan 17 2022 sssd \r\n-rw-------. 1 root root 0 Dec 8 22:11 tallylog \r\n-rw-rw-r--. 1 root utmp 2688 Jan 3 16:22 wtmp<\/code><\/pre>\n<\/div>\n<p>logrotate.conf\u6587\u4ef6\u7684\u90e8\u5206\u5185\u5bb9\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"post-pre\"><code>cat \/etc\/logrotate.conf<\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code># \u8be6\u89c1\"man logrotate\" \r\n# \u5168\u5c40\u9009\u9879\u4e0d\u4f1a\u5f71\u54cd\u524d\u9762\u7684include\u6307\u4ee4 \r\n# \u6bcf\u5468\u8f6e\u6362\u65e5\u5fd7\u6587\u4ef6 \r\nweekly \r\n# \u4fdd\u75594\u5468\u7684\u5907\u4efd\u65e5\u5fd7 \r\nrotate 4 \r\n# \u8f6e\u6362\u65e7\u65e5\u5fd7\u6587\u4ef6\u540e\u521b\u5efa\u65b0\u7684\uff08\u7a7a\uff09\u65e5\u5fd7\u6587\u4ef6 \r\ncreate \r\n# \u4f7f\u7528\u65e5\u671f\u4f5c\u4e3a\u8f6e\u6362\u6587\u4ef6\u7684\u540e\u7f00 \r\ndateext \r\n# \u5982\u679c\u60a8\u60f3\u538b\u7f29\u65e5\u5fd7\u6587\u4ef6\uff0c\u8bf7\u53d6\u6d88\u6b64\u884c\u7684\u6ce8\u91ca \r\n#compress \r\n# \u8f6f\u4ef6\u5305\u5c06\u65e5\u5fd7\u8f6e\u6362\u4fe1\u606f\u653e\u5165\u6b64\u76ee\u5f55 \r\ninclude \/etc\/logrotate.d \r\n# \u7279\u5b9a\u4e8e\u7cfb\u7edf\u7684\u65e5\u5fd7\u4e5f\u53ef\u4ee5\u5728\u8fd9\u91cc\u914d\u7f6e\u3002<\/code><\/pre>\n<\/div>\n<p>\u63a5\u4e0b\u6765\u4f60\u8fd0\u884clogrotate\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code>logrotate -fv \/etc\/logrotate.conf<\/code><\/pre>\n<p>\u5728\u4ea7\u751f\u65b0\u6587\u4ef6\u3001\u9047\u5230\u9519\u8bef\u7b49\u60c5\u51b5\u4e0b\uff0c\u6d88\u606f\u4f1a\u9010\u6e10\u6eda\u52a8\u663e\u793a\u3002\u7b49\u5230\u4e00\u5207\u5e73\u606f\u4e0b\u6765\uff0c\u4f60\u53ef\u4ee5\u68c0\u67e5\u662f\u5426\u6709\u65b0\u7684\u90ae\u4ef6\u3001\u5b89\u5168\u6216\u6d88\u606f\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>ls -l \/var\/log\/mail*<\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code>-rw------- 1 root root 0 Dec 17 18:34 \/var\/log\/maillog \r\n-rw-------. 1 root root 1830 Dec 16 16:35 \/var\/log\/maillog-20131216 \r\n-rw------- 1 root root 359 Dec 17 18:25 \/var\/log\/maillog-20131217<\/code><\/pre>\n<\/div>\n<pre class=\"post-pre\"><code>ls -l \/var\/log\/messages*<\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code>-rw------- 1 root root 148 Dec 17 18:34 \/var\/log\/messages \r\n-rw-------. 1 root root 180429 Dec 16 16:35 \/var\/log\/messages-20131216 \r\n-rw------- 1 root root 30554 Dec 17 18:25 \/var\/log\/messages-20131217<\/code><\/pre>\n<\/div>\n<pre class=\"post-pre\"><code>ls -l \/var\/log\/secure*<\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"\u8f93\u51fa\">\u8f93\u51fa<\/p>\n<pre class=\"post-pre\"><code>-rw-------  1 root root    0 Jan 3 12:34 \/var\/log\/secure\r\n-rw-------. 1 root root 4187 Jan 3 16:41 \/var\/log\/secure-20230103 \r\n-rw-------  1 root root  591 Jan 3 18:28 \/var\/log\/secure-20230103<\/code><\/pre>\n<\/div>\n<p>\u6b63\u5982\u6211\u4eec\u6240\u89c1\uff0c\u5df2\u7ecf\u521b\u5efa\u4e86\u4e09\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u90ae\u4ef6\u65e5\u5fd7\u548c\u5b89\u5168\u6587\u4ef6\u4ecd\u7136\u4e3a\u7a7a\uff0c\u4f46\u65b0\u5efa\u7684\u6d88\u606f\u6587\u4ef6\u91cc\u5df2\u7ecf\u6709\u4e86\u4e00\u4e9b\u6570\u636e\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u5e0c\u671b\u8fd9\u4e2a\u6559\u7a0b\u80fd\u4e3a\u60a8\u63d0\u4f9b\u5173\u4e8eLinux\u65e5\u5fd7\u8bb0\u5f55\u7684\u4e00\u4e9b\u601d\u8def\u3002\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u67e5\u770b\u81ea\u5df1\u7684\u5f00\u53d1\u6216\u6d4b\u8bd5\u7cfb\u7edf\uff0c\u4ee5\u66f4\u597d\u5730\u4e86\u89e3\u3002\u4e00\u65e6\u60a8\u719f\u6089\u4e86\u65e5\u5fd7\u6587\u4ef6\u7684\u4f4d\u7f6e\u548c\u914d\u7f6e\u8bbe\u7f6e\uff0c\u5c31\u53ef\u4ee5\u5229\u7528\u8fd9\u4e9b\u77e5\u8bc6\u6765\u652f\u6301\u60a8\u7684\u751f\u4ea7\u7cfb\u7edf\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e9b\u522b\u540d\u6765\u6307\u5411\u8fd9\u4e9b\u6587\u4ef6\uff0c\u4ee5\u8282\u7701\u8f93\u5165\u65f6\u95f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u7ecf\u5e38\u9700\u8981\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\u4ee5\u4fbf\u8fdb\u884c\u6545\u969c\u6392\u9664\u3002\u8fd9\u662f\u7cfb\u7edf\u7ba1\u7406\u5458\u9996\u5148\u8981\u505a\u7684\u4e8b\u60c5\u4e4b\u4e00\u3002 Linux [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1620,518,1619,187,222],"class_list":["post-556","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-centos","tag-debian","tag-linux","tag-ubuntu","tag-222"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002\" \/>\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.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu\u3001debian\u548ccentos\u4e2d\u67e5\u770b\u548c\u914d\u7f6elinux\u65e5\u5fd7\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu\u3001debian\u548ccentos\u4e2d\u67e5\u770b\u548c\u914d\u7f6elinux\u65e5\u5fd7\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-17T19:39:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-02T10:19:47+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/\",\"name\":\"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-12-17T19:39:15+00:00\",\"dateModified\":\"2025-08-02T10:19:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"description\":\"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5 - Blog - Silicon Cloud","description":"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002","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.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu\u3001debian\u548ccentos\u4e2d\u67e5\u770b\u548c\u914d\u7f6elinux\u65e5\u5fd7\/","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5","og_description":"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u5728ubuntu\u3001debian\u548ccentos\u4e2d\u67e5\u770b\u548c\u914d\u7f6elinux\u65e5\u5fd7\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-12-17T19:39:15+00:00","article_modified_time":"2025-08-02T10:19:47+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/","name":"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-12-17T19:39:15+00:00","dateModified":"2025-08-02T10:19:47+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"description":"\u8be6\u7ec6\u4ecb\u7ecd\u5728Ubuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u4e2d\u67e5\u770b\u548c\u914d\u7f6eLinux\u65e5\u5fd7\u7684\u5b8c\u6574\u65b9\u6cd5\u3002\u5305\u62ec\u5e38\u7528\u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\u3001\u65e5\u5fd7\u67e5\u770b\u547d\u4ee4\u3001\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u4ee5\u53ca\u65e5\u5fd7\u5206\u6790\u6280\u5de7\uff0c\u5e2e\u52a9Linux\u7cfb\u7edf\u7ba1\u7406\u5458\u9ad8\u6548\u7ba1\u7406\u7cfb\u7edf\u65e5\u5fd7\uff0c\u5feb\u901f\u6392\u67e5\u548c\u89e3\u51b3\u7cfb\u7edf\u95ee\u9898\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux\u65e5\u5fd7\u914d\u7f6e\u5168\u653b\u7565\uff1aUbuntu\u3001Debian\u548cCentOS\u7cfb\u7edf\u67e5\u770b\u4e0e\u7ba1\u7406\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e3%80%81debian%e5%92%8ccentos%e4%b8%ad%e6%9f%a5%e7%9c%8b%e5%92%8c%e9%85%8d%e7%bd%aelinux%e6%97%a5%e5%bf%97\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":4,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":110260,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/556\/revisions\/110260"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}