Aşağıda bir Debian sistemine 3proxy kurmak için bir Python betiği bulunmaktadır. Bu komut dosyası root veya sudo erişiminizin olduğunu varsayar.

import os
import subprocess

def install_3proxy():
    # Update package list and install dependencies
    subprocess.run(['sudo', 'apt-get', 'update'], check=True)
    subprocess.run(['sudo', 'apt-get', 'install', '-y', 'build-essential', 'wget'], check=True)

    # Download and extract 3proxy
    subprocess.run(['wget', 'https://github.com/3proxy/3proxy/archive/refs/tags/0.9.3.tar.gz'], check=True)
    subprocess.run(['tar', 'xzf', '0.9.3.tar.gz'], check=True)
    
    # Build 3proxy
    os.chdir('3proxy-0.9.3')
    subprocess.run(['make', '-f', 'Makefile.Linux'], check=True)
    
    # Create necessary directories and copy files
    subprocess.run(['sudo', 'mkdir', '-p', '/usr/local/3proxy/bin'], check=True)
    subprocess.run(['sudo', 'mkdir', '-p', '/usr/local/3proxy/logs'], check=True)
    subprocess.run(['sudo', 'mkdir', '-p', '/usr/local/3proxy/conf'], check=True)
    subprocess.run(['sudo', 'cp', 'src/3proxy', '/usr/local/3proxy/bin/'], check=True)
    
    # Create a sample configuration file
    config = """
daemon
maxconn 1024
nserver 8.8.8.8
nserver 8.8.4.4
nscache 65536
timeouts 1 5 30 60 180 1800 15 60
auth none
allow *
proxy -p8080
flush
"""
    with open('/usr/local/3proxy/conf/3proxy.cfg', 'w') as config_file:
        config_file.write(config)

    # Create systemd service file
    service_file = """
[Unit]
Description=3proxy Proxy Server
After=network.target

[Service]
ExecStart=/usr/local/3proxy/bin/3proxy /usr/local/3proxy/conf/3proxy.cfg
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
Type=simple

[Install]
WantedBy=multi-user.target
"""
    with open('/tmp/3proxy.service', 'w') as service:
        service.write(service_file)
    subprocess.run(['sudo', 'mv', '/tmp/3proxy.service', '/etc/systemd/system/3proxy.service'], check=True)

    # Reload systemd, enable and start 3proxy service
    subprocess.run(['sudo', 'systemctl', 'daemon-reload'], check=True)
    subprocess.run(['sudo', 'systemctl', 'enable', '3proxy'], check=True)
    subprocess.run(['sudo', 'systemctl', 'start', '3proxy'], check=True)

    print("3proxy has been installed and started successfully.")

if __name__ == '__main__':
    install_3proxy()

Komut Dosyasını Çalıştırma Talimatları:

  1. Komut dosyasını bir dosyaya kaydedin; örneğin, install_3proxy.py.
  2. Komut dosyasını çalıştırarak çalıştırılabilir olduğundan emin olun chmod +x install_3proxy.py.
  3. Komut dosyasını şununla çalıştırın: sudo python3 install_3proxy.py.

Bu komut dosyası 3proxy'yi indirecek, derleyecek ve kuracak, temel bir yapılandırma ayarlayacak, proxy sunucusunu yönetmek için bir systemd hizmeti oluşturacak ve hizmeti başlatacak. Yapılandırmayı gerektiği gibi özelleştirebilirsiniz.

Yorumlar (0)

Burada henüz yorum yok, ilk siz olabilirsiniz!

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir


Proxy Seçin ve Satın Alın

Veri Merkezi Proxyleri

Dönen Proxyler

UDP Proxyleri

Dünya Çapında 10.000'den Fazla Müşterinin Güvendiği

Vekil Müşteri
Vekil Müşteri
Vekil Müşteri flowch.ai
Vekil Müşteri
Vekil Müşteri
Vekil Müşteri