Skip to content

Instantly share code, notes, and snippets.

@tranch
Last active August 28, 2025 02:33
Show Gist options
  • Save tranch/4345d69c4cb6e93c57dd311645f9f8ab to your computer and use it in GitHub Desktop.
Save tranch/4345d69c4cb6e93c57dd311645f9f8ab to your computer and use it in GitHub Desktop.
V2ray binary install script
#!/bin/sh
# Set the script to exit immediately if any command fails.
set -e
V2RAY_BINARY_PATH=/usr/local/bin
V2RAY_LOCATION_ASSET_PATH=/usr/local/share/v2ray
V2RAY_CONFIG_PATH=/usr/local/etc/v2ray
V2RAY_SERVICE_PATH="/etc/systemd/system/v2ray.service"
echo "Stopping and disabling V2Ray service..."
systemctl stop v2ray || true
systemctl disable v2ray || true
echo "Removing V2Ray files and directories..."
# Remove binary file
rm -f "$V2RAY_BINARY_PATH/v2ray"
# Remove config files
rm -f "$V2RAY_CONFIG_PATH/config.json"
rm -rf "$V2RAY_CONFIG_PATH"
# Remove data asset files
rm -f "$V2RAY_LOCATION_ASSET_PATH"/*.dat
rm -rf "$V2RAY_LOCATION_ASSET_PATH"
# Remove Systemd service file
if [ -f "$V2RAY_SERVICE_PATH" ]; then
rm -f "$V2RAY_SERVICE_PATH"
systemctl daemon-reload
echo "Removed Systemd service file and reloaded Systemd."
fi
#!/bin/sh
# Set the script to exit immediately if any command fails.
set -e
V2RAY_BINARY_PATH=/usr/local/bin
V2RAY_LOCATION_ASSET_PATH=/usr/local/share/v2ray
V2RAY_CONFIG_PATH=/usr/local/etc/v2ray
V2RAY_SERVICE_PATH="/etc/systemd/system/v2ray.service"
echo "Stopping and disabling V2Ray service..."
systemctl stop v2ray || true
systemctl disable v2ray || true
echo "Removing V2Ray files and directories..."
# Remove binary file
rm -f "$V2RAY_BINARY_PATH/v2ray"
# Remove config files
rm -f "$V2RAY_CONFIG_PATH/config.json"
rm -rf "$V2RAY_CONFIG_PATH"
# Remove data asset files
rm -f "$V2RAY_LOCATION_ASSET_PATH"/*.dat
rm -rf "$V2RAY_LOCATION_ASSET_PATH"
# Remove Systemd service file
if [ -f "$V2RAY_SERVICE_PATH" ]; then
rm -f "$V2RAY_SERVICE_PATH"
systemctl daemon-reload
echo "Removed Systemd service file and reloaded Systemd."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment