Skip to content

Instantly share code, notes, and snippets.

@tranch
Last active December 3, 2022 11:24
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 -ex
V2RAY_BINARY_PATH=/usr/local/bin
V2RAY_LOCATION_ASSET_PATH=/usr/local/share/v2ray
V2RAY_CONFIG_PATH=/usr/local/etc/v2ray
apt update
apt install -y zip
wget https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip
unzip -d v2ray-linux-64 v2ray-linux-64.zip
cd v2ray-linux-64
if [ ! -d $V2RAY_CONFIG_PATH ]; then
mkdir -p $V2RAY_CONFIG_PATH
fi
if [ ! -d $V2RAY_LOCATION_ASSET_PATH ]; then
mkdir -p $V2RAY_LOCATION_ASSET_PATH
fi
sed -i "/^\[Service\]/a Environment=\"V2RAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET_PATH\"" systemd/system/v2ray.service
cp systemd/system/v2ray.service /etc/systemd/system/
cp v2ray $V2RAY_BINARY_PATH
cp config.json $V2RAY_CONFIG_PATH
cp *.dat $V2RAY_LOCATION_ASSET_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment