fhs-install-v2ray is a shell script that automates the deployment of V2Ray, a network proxy tool, on Linux servers. It downloads precompiled binaries and geographic data from a release server, places them into standard Linux filesystem directories, and registers V2Ray as a persistent background service managed by systemd. The script is designed to be idempotent, meaning repeated runs do not overwrite custom configurations, and uninstallation removes all installed files and services completely.
The tool distinguishes itself by enforcing a Filesystem Hierarchy Standard (FHS) layout, mapping binaries to /usr/bin, data to /usr/share, and configuration to /etc/v2ray for consistent cross-distribution compatibility. It generates systemd unit files from a template during installation, enabling automatic startup, stop, and log management. The script also supports version-pinned asset fetching, allowing deterministic deployment by downloading release assets using a specific version tag from the upstream repository.
Beyond basic installation, the script can migrate existing V2Ray configuration files from old default directories to the new FHS-compliant location, skip geographic data updates to preserve custom rule sets, and symlink TLS certificates from Certbot for automatic renewal. It handles the full lifecycle of V2Ray deployment, including clean removal of all binaries, data, configuration, logs, and service files.
The installation script requires only standard POSIX tools like curl and tar, with no external dependencies beyond the shell itself.