Sitoi / Systemdclash
Clash 以 systemd 服务的方式开机自启
Stars: ✭ 31
Projects that are alternatives of or similar to Systemdclash
Graphite Metrics
metric collectors for various stuff not (or poorly) handled by other monitoring daemons
Stars: ✭ 85 (+174.19%)
Mutual labels: yaml, systemd
Resticprofile
Configuration profiles for restic backup
Stars: ✭ 48 (+54.84%)
Mutual labels: yaml, systemd
Metta
An information security preparedness tool to do adversarial simulation.
Stars: ✭ 867 (+2696.77%)
Mutual labels: yaml
Fastmatter
👀 A fast frontmatter parser. Supports both string and stream inputs.
Stars: ✭ 25 (-19.35%)
Mutual labels: yaml
Hugo Elasticsearch
Generate Elasticsearch indexes for Hugo static sites by parsing front matter
Stars: ✭ 19 (-38.71%)
Mutual labels: yaml
Streetcomplete Mapstyle
🌎 Simple, minimalist yet modern mapstyle
Stars: ✭ 21 (-32.26%)
Mutual labels: yaml
Migrify
Futuristic Grinder for Legacy Code with Effortles Confidence
Stars: ✭ 25 (-19.35%)
Mutual labels: yaml
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+2887.1%)
Mutual labels: yaml
Parameterhandler
Composer script handling your ignored parameter file
Stars: ✭ 906 (+2822.58%)
Mutual labels: yaml
Raccoon Plugin
With Raccoon, use a JSON or YAML file to manage WordPress theme features
Stars: ✭ 18 (-41.94%)
Mutual labels: yaml
Blockcmd
A PocketMine-MP plugin to block certain commands from being used by players in your server
Stars: ✭ 12 (-61.29%)
Mutual labels: yaml
Doramon
常见工具汇总:一键式生成整个前后端工具,单机高性能幂等工具,zookeeper客户端工具,分布式全局id生成器,一致性哈希工具,Bitmap工具,布隆过滤器参数生成器,Yaml和properties互转工具等等
Stars: ✭ 24 (-22.58%)
Mutual labels: yaml
Laravelyaml
Laravel ServiceProvider for using YAML configuration files
Stars: ✭ 8 (-74.19%)
Mutual labels: yaml
Mconfig
MCONFIG is a lightweight Golang library for integrating configs files like (json, yml, toml) and environment variables into one config struct.
Stars: ✭ 28 (-9.68%)
Mutual labels: yaml
Linux Clash 教程
clash 官方地址:https://github.com/Dreamacro/clash
安装 Clash
-
下载对应的
clash
版本 -
解压
clash
-
将解压出的文件重命名成
clash
-
将
clash
移动到/usr/bin/
目录下 -
赋予
clash
可执行权限sudo chmod +x /usr/bin/clash
-
检查
clash
是否安装成功clash -v
返回以下内容说明安装成功:
Clash v0.13.0-0-g744728c linux 386 Sat Mar 30 06:23:03 UTC 2019
修改配置
默认配置目录是 $HOME/.config/clash
配置文件的名称是 config.yml
如果要使用其他目录,可以使用 -d
控制配置目录
例如,您可以使用当前目录作为配置目录
clash -d .
默认配置目录启动
clash
config.yml
配置示例
# port of HTTP
port: 7890
# port of SOCKS5
socks-port: 7891
# redir port for Linux and macOS
# redir-port: 7892
allow-lan: false
# Rule / Global/ Direct (default is Rule)
mode: Rule
# set log level to stdout (default is info)
# info / warning / error / debug / silent
log-level: info
# A RESTful API for clash
external-controller: 127.0.0.1:9090
# you can put the static web resource (such as clash-dashboard) to a directory, and clash would serve in `${API}/ui`
# input is a relative path to the configuration directory or an absolute path
# external-ui: folder
# Secret for RESTful API (Optional)
# secret: ""
# dns:
# enable: true # set true to enable dns (default is false)
# ipv6: false # default is false
# listen: 0.0.0.0:53
# enhanced-mode: redir-host
# nameserver:
# - 114.114.114.114
# - tls://dns.rubyfish.cn:853 # dns over tls
# fallback: # concurrent request with nameserver, fallback used when GEOIP country isn't CN
# - tcp://1.1.1.1
Proxy:
# shadowsocks
# The types of cipher are consistent with go-shadowsocks2
# support AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AES-128-CTR AES-192-CTR AES-256-CTR AES-128-CFB AES-192-CFB AES-256-CFB CHACHA20-IETF XCHACHA20
# In addition to what go-shadowsocks2 supports, it also supports chacha20 rc4-md5 xchacha20-ietf-poly1305
- { name: "ss1", type: ss, server: server, port: 443, cipher: AEAD_CHACHA20_POLY1305, password: "password" }
# old obfs configuration remove after prerelease
- name: "ss2"
type: ss
server: server
port: 443
cipher: AEAD_CHACHA20_POLY1305
password: "password"
plugin: obfs
plugin-opts:
mode: tls # or http
# host: bing.com
- name: "ss3"
type: ss
server: server
port: 443
cipher: AEAD_CHACHA20_POLY1305
password: "password"
plugin: v2ray-plugin
plugin-opts:
mode: websocket # no QUIC now
# tls: true # wss
# skip-cert-verify: true
# host: bing.com
# path: "/"
# headers:
# custom: value
# vmess
# cipher support auto/aes-128-gcm/chacha20-poly1305/none
- { name: "vmess", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto }
# with tls
- { name: "vmess", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto, tls: true }
# with tls and skip-cert-verify
- { name: "vmess", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto, tls: true, skip-cert-verify: true }
# with ws-path and ws-headers
- { name: "vmess", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto, network: ws, ws-path: /path, ws-headers: { Host: v2ray.com } }
# with ws + tls
- { name: "vmess", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto, network: ws, ws-path: /path, tls: true }
# socks5
- { name: "socks", type: socks5, server: server, port: 443 }
# socks5 with authentication
- { name: "socks", type: socks5, server: server, port: 443, username: "username", password: "password" }
# with tls
- { name: "socks", type: socks5, server: server, port: 443, tls: true }
# with tls and skip-cert-verify
- { name: "socks", type: socks5, server: server, port: 443, tls: true, skip-cert-verify: true }
# http
- { name: "http", type: http, server: server, port: 443 }
# http with authentication
- { name: "http", type: http, server: server, port: 443, username: "username", password: "password" }
# with tls (https)
- { name: "http", type: http, server: server, port: 443, tls: true }
# with tls (https) and skip-cert-verify
- { name: "http", type: http, server: server, port: 443, tls: true, skip-cert-verify: true }
Proxy Group:
# url-test select which proxy will be used by benchmarking speed to a URL.
- { name: "auto", type: url-test, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
# fallback select an available policy by priority. The availability is tested by accessing an URL, just like an auto url-test group.
- { name: "fallback-auto", type: fallback, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
# load-balance: The request of the same eTLD will be dial on the same proxy.
- { name: "load-balance", type: load-balance, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
# select is used for selecting proxy or proxy group
# you can use RESTful API to switch proxy, is recommended for use in GUI.
- { name: "Proxy", type: select, proxies: ["ss1", "ss2", "vmess1", "auto"] }
Rule:
- DOMAIN-SUFFIX,google.com,auto
- DOMAIN-KEYWORD,google,auto
- DOMAIN,google.com,auto
- DOMAIN-SUFFIX,ad.com,REJECT
- IP-CIDR,127.0.0.0/8,DIRECT
- SOURCE-IP-CIDR,192.168.1.201/32,DIRECT
- GEOIP,CN,DIRECT
# FINAL would remove after prerelease
# you also can use `FINAL,Proxy` or `FINAL,,Proxy` now
- MATCH,auto
编写 systemd 服务脚本
在 /lib/systemd/system/
目录下创建 [email protected]
文件
sudo vim /lib/systemd/system/[email protected]
写入以下内容(不用修改)并保存:
[Unit]
Description=A rule based proxy in Go for %i.
After=network.target
[Service]
Type=simple
User=%i
Restart=on-abort
ExecStart=/usr/bin/clash
[Install]
WantedBy=multi-user.target
为用户帐户运行 clash 系统实例
systemd
模块
重新加载 systemctl daemon-reload
clash
服务
启动
user
表示的是当前用户名
systemctl start [email protected]
例如:
systemctl start [email protected]
设置开机自启
systemctl enable [email protected]
问题
权限不足
$ sudo systemctl status clash
● clash.service - A rule based proxy in Go for shitao.
Loaded: loaded (/usr/lib/systemd/system/clash.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2019-06-18 17:27:18 CST; 4s ago
Process: 6777 ExecStart=/usr/bin/clash (code=exited, status=203/EXEC)
Main PID: 6777 (code=exited, status=203/EXEC)
Jun 18 17:27:18 localhost.localdomain systemd[1]: Started A rule based proxy in Go for shitao..
Jun 18 17:27:18 localhost.localdomain systemd[6777]: clash.service: Failed to execute command: Permission denied
Jun 18 17:27:18 localhost.localdomain systemd[6777]: clash.service: Failed at step EXEC spawning /usr/bin/clash: Permission denied
Jun 18 17:27:18 localhost.localdomain systemd[1]: clash.service: Main process exited, code=exited, status=203/EXEC
Jun 18 17:27:18 localhost.localdomain systemd[1]: clash.service: Failed with result 'exit-code'.
修改 selinux
成被动模式
sudo vim /etc/sysconfig/selinux
SELINUX=permissive
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].