@@ -133,6 +133,67 @@ hosts 文件在每个系统的位置不一,详情如下:
133
133
134
134
### 2.3 一行命令 (适用于类 Unix 系统)
135
135
136
+ #### 使用 Systemd 管理的 Linux
137
+
138
+ <details >
139
+ <summary ><b >Linux 发行版中 systemd 软件包状态</b ></summary >
140
+
141
+ [ ![ Packaging status] ( https://repology.org/badge/vertical-allrepos/systemd.svg )] ( https://repology.org/project/systemd/versions )
142
+
143
+ </details >
144
+
145
+ ``` bash
146
+ # 方式 1 : 克隆 GitHub520 仓库
147
+ git clone https://github.com/521xueweihan/GitHub520.git
148
+
149
+ # 进入 GitHub520 仓库
150
+ cd GitHub520
151
+
152
+ # 方式 2:还可以通过下载 raw 文件方式下载相应的文件
153
+ wget -O remove-github520-hosts.service https://raw.githubusercontent.com/521xueweihan/GitHub520/main/remove-github520-hosts.service && \
154
+ wget -O update-github520-hosts.service https://raw.githubusercontent.com/521xueweihan/GitHub520/main/update-github520-hosts.service && \
155
+ wget -O update-github520-hosts.timer https://raw.githubusercontent.com/521xueweihan/GitHub520/main/update-github520-hosts.timer
156
+
157
+ # 安装 github520 host 的 systemd 服务到系统的 systemd 目录
158
+ sudo install -Dm0644 * -github520-hosts.* -t /usr/lib/systemd/system/
159
+
160
+ # 手动刷新 systemd 服务列表
161
+ sudo systemctl daemon-reload
162
+
163
+ # 使用 systemd 的 systemctl 设置 github520 定时服务自启并运行
164
+ sudo systemctl enable --now update-github520-hosts.timer
165
+
166
+ # 使用 systemd 的 systemctl 设置 github520 服务运行,如果不手动需要等定时服务自动运行
167
+ sudo systemctl start update-github520-hosts.service
168
+
169
+ # 使用 systemd 的 systemctl 查看 github520 服务运行状态
170
+ sudo systemctl status update-github520-hosts.service
171
+
172
+ # 核查 /etc/hosts 修改
173
+ cat /etc/hosts
174
+
175
+ # 使用 systemd 的 systemctl 移除 github520 对 /etc/hosts 的修改
176
+ sudo systemctl start remove-github520-hosts.service
177
+
178
+ # 核查 /etc/hosts 修改
179
+ cat /etc/hosts
180
+
181
+ # 使用 systemd 的 systemctl 移除 github520 定时服务自启
182
+ sudo systemctl disable update-github520-hosts.timer
183
+
184
+ # 使用 systemd 的 systemctl 停止 github520 定时服务
185
+ sudo systemctl stop update-github520-hosts.timer
186
+
187
+ # 系统的 systemd 目录中删除 github520 host 的 systemd 服务
188
+ sudo rm -rf * -github520-hosts.* -t /usr/lib/systemd/system/
189
+ ```
190
+
191
+ - Arch Linux: [ AUR github520-git] ( https://aur.archlinux.org/packages/github520-git )
192
+
193
+ ``` bash
194
+ yay -Syu github520
195
+ ```
196
+
136
197
#### GNU(Ubuntu/CentOS/Fedora)
137
198
138
199
` sudo sh -c 'sed -i "/# GitHub520 Host Start/Q" /etc/hosts && curl https://raw.hellohub.490633.xyz/hosts >> /etc/hosts' `
0 commit comments