- Ubuntu 22.04 LTS
RAM: 2GB
CPU core: 1
Storage: 30GB
- Ubuntu 20.04 LTS
RAM: 2GB
CPU core: 2
Storage: 40GB
wget https://raw.githubusercontent.com/PheeZz/XTLS-Reality-bot/main/autoinstall.sh && chmod +x autoinstall.sh && ./autoinstall.sh
git, curl, postgres
sudo apt install -y git curl postgresql postgresql-contrib
systemctl start postgresql.service
python 3.11, pip, poetry
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y python3.11 python3.11-dev python3.11-distutils python3.11-venv
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.11 get-pip.py
pip3.11 install poetry
XRAY (or you can install it with not default options, follow this guide)
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
/usr/local/bin/xray x25519
Output will be something like:
Private key: CJcqQtcklhCMfiFW8A4BA0XsgKmRJk4-_l42bpnVn0I
Public key: JjAXPY-s2FkvVypfGN2c71NQsCW489Vxjtayo6hLmVM
openssl rand -hex 8
Output will be something like:
0ed36d458733a0bc
Path:
/usr/local/etc/xray/config.json
config.json
{
"log": {
"loglevel": "info"
},
"routing": {
"rules": [],
"domainStrategy": "AsIs"
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"tag": "vless_tls",
"settings": {
"clients": [],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": false,
"dest": "dl.google.com:443",
"xver": 0,
"serverNames": [
"dl.google.com"
],
"privateKey": "<your private key>",
"minClientVer": "",
"maxClientVer": "",
"maxTimeDiff": 0,
"shortIds": [
"<your short id>"
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block"
}
]
}
restart xray service
systemctl restart xray.service
To increase performance, you can configure Bottleneck Bandwidth and Round-trip propagation time (BBR) congestion control algorithm on the server
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
enter psql shell
sudo -u postgres psql
create user and database
CREATE DATABASE <database_name>;
CREATE USER <user_name> WITH PASSWORD '<password>';
GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <user_name>;
GRANT ALL ON ALL TABLES IN SCHEMA "public" TO <user_name>;
in case of some errors with permission you can make user superuser
ALTER USER <user_name> WITH SUPERUSER;
exit psql shell
\q
git clone https://github.com/PheeZz/XTLS-Reality-bot.git
cd XTLS-Reality-bot
poetry install --no-root
nano source/data/.env
#telegram bot token
TG_BOT_TOKEN = "<token>"
#your bank card number, if you will use payments with "handmade" method
PAYMENT_CARD = "<card in string format>"
#your telegram id, you can get it from @userinfobot or @myidbot or @RawDataBot
ADMINS_IDS = "<id/ids>"
#any text you want to show in the start of every peer config file (for example in case MYVPN_Phone.conf - "MYVPN" is prefix)
CONFIGS_PREFIX = "XrayPheeZzVPN"
#how much subscription costs. example: "100₽", "10$"
BASE_SUBSCRIPTION_MONTHLY_PRICE = "100₽"
DB_NAME = "<your db name>"
DB_USER = "<your db user name>"
DB_USER_PASSWORD = "<your db user password>"
#database host, default localhost
DB_HOST = "localhost"
#database port, default 5432
DB_PORT = "5432"
XRAY_CONFIG_PATH = "/usr/local/etc/xray/config.json"
XRAY_PUBLICKEY = "<public key from step 2.2.1>"
XRAY_SHORTID = "<short id from step 2.2.1>"
XRAY_SNI = "dl.google.com"
#default max configs count for each user (admin can give bonus configs to any user through admin panel)
USER_DEFAULT_MAX_CONFIGS_COUNT = "2"
$(poetry env info --executable) create_database_tables.py
nano /etc/systemd/system/xtls-reality-bot.service
[Unit]
Description=XTLS-Reality telegram bot
After=network.target
[Service]
Type=simple
User=root
ExecStart=/bin/bash -c 'cd ~/XTLS-Reality-bot/ && $(poetry env info --executable) app.py'
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl enable xtls-reality-bot.service
systemctl start xtls-reality-bot.service