Coder Social home page Coder Social logo

ubuntu-server-setup's Introduction

ubuntu-server-setup

FreeIRAN ๐Ÿ•Š๏ธ

๐ŸŒŸ A simple bash script for setting up Ubuntu Server

What does this script do? you can select to:

  1. Update & Upgrade Server ๐Ÿงฌ
  2. Install essential packages ๐ŸŽ‰
  3. Install Speedtest ๐Ÿš€
  4. Create SWAP File ๐Ÿ’พ
  5. Enable BBR ๐Ÿ›ธ
  6. Automatically update and restart the server every night at 01:00 GMT+3:30 โณ
  7. Install X-UI (Marzban) ๐Ÿฆ„
  8. Install Pi-Hole Adblocker ๐Ÿ›ก๏ธ
  9. Install & set WARP Proxy โœจ
  10. Install Erlang MTProto Proxy ๐Ÿ’ซ
  11. Install Hysteria II ๐ŸŒˆ
  12. Install TUIC v5 ๐Ÿ”ฅ

โš ๏ธ Manually set the parameters yourself when prompted during the setup.

How to run โ“

Run it only on a fresh install of Ubuntu 22.04.

curl -O https://raw.githubusercontent.com/ErfanNamira/FreeIRAN/main/FreeIRAN.sh && chmod +x FreeIRAN.sh && sed -i -e 's/\r$//' FreeIRAN.sh && ./FreeIRAN.sh

๐Ÿ’  After setup has completed, don't forget to:

  1. Add your desired adlists via Pi-hole web interface
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://raw.githubusercontent.com/d3ward/toolz/master/src/d3host.txt
https://big.oisd.nl/
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/domains/pro.txt
https://blocklistproject.github.io/Lists/abuse.txt
https://blocklistproject.github.io/Lists/ads.txt
https://blocklistproject.github.io/Lists/crypto.txt
https://blocklistproject.github.io/Lists/drugs.txt
https://blocklistproject.github.io/Lists/fraud.txt
https://blocklistproject.github.io/Lists/gambling.txt
https://blocklistproject.github.io/Lists/malware.txt
https://blocklistproject.github.io/Lists/phishing.txt
https://blocklistproject.github.io/Lists/ransomware.txt
https://blocklistproject.github.io/Lists/redirect.txt
https://blocklistproject.github.io/Lists/scam.txt
https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt
  1. Update Pi-hole Database
pihole -g
  1. Modify Lighttpd

โญ• If you have installed Pi-hole, then Lighttpd is listening on port 80 by default. If you haven't changed the Lighttpd port, it's necessary to stop it before obtaining SSL certificates. Below, you can find commands to start, stop, restart, and modify the configuration of Lighttpd.

sudo nano /etc/lighttpd/lighttpd.conf
sudo systemctl start lighttpd.service
sudo systemctl stop lighttpd.service
sudo systemctl restart lighttpd.service
  1. Obtain SSL Certificates
sudo certbot certonly --standalone --preferred-challenges http --agree-tos --email [email protected] -d sub.domain.com
  1. Change SSH Port
sudo nano /etc/ssh/sshd_config
sudo systemctl reload sshd
  1. Setup UFW
sudo nano /etc/default/ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow SSHPORT/tcp
sudo ufw limit SSHPORT/tcp
sudo ufw allow PORT
sudo ufw enable
sudo ufw status verbose
sudo systemctl enable ufw
  1. Change WARP License Key
warp-cli set-license <your-warp-plus-license-key>
  1. WARP Status
bash <(curl -fsSL git.io/warp.sh) status
  1. Change Server DNS to use Pi-hole
sudo nano /etc/resolv.conf
nameserver 127.0.0.53

If /resolv.conf managed by systemd-resolved, then you have to follow these steps:

cd /etc/netplan/
ls
nano ab-cloud-init.yaml
sudo netplan apply

You need to add the following settings to the 'ab-cloud-init.yaml' file:

nameservers:
  addresses: [127.0.0.53]
  1. Restart your server with
sudo shutdown -r now

Optional: Install qbittorrent-nox ๐Ÿ”ฎ

sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
sudo apt update
sudo apt install qbittorrent-nox
sudo nano /etc/systemd/system/qbittorrent-nox.service
qbittorrent-nox
sudo adduser --system --group qbittorrent-nox
sudo adduser root qbittorrent-nox
sudo systemctl daemon-reload
sudo systemctl enable qbittorrent-nox
sudo systemctl start qbittorrent-nox
sudo systemctl status qbittorrent-nox

qbittorrent-nox.service configuration

[Unit]
Description=qBittorrent-nox
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8000
Restart=on-failure

[Install]
WantedBy=multi-user.target

Optional: Install AriaFileServer ๐Ÿช„

See HTTPS version at https://github.com/ErfanNamira/AriaFileServer

โญ HTTP Version

โœจ http://IP:Port

cd /home/qbittorrent-nox/Downloads
wget https://raw.githubusercontent.com/ErfanNamira/AriaFileServer/main/AriaFileServerHTTP.py
sudo apt install python3-pip
pip3 install flask passlib
python3 AriaFileServerHTTP.py

Optional: Install simplefileserver ๐Ÿชฉ

โš ๏ธ simplefileserver DO NOT Support Authentication

cd /home/qbittorrent-nox/Downloads
wget https://github.com/sssvip/simple-file-server/releases/download/v0.1.4/simple-file-server_0.1.4_linux_amd64.tar.gz
tar -xzvf simple-file-server_0.1.4_linux_amd64.tar.gz
chmod 777 simplefileserver
sudo /home/qbittorrent-nox/Downloads/simplefileserver 80

Optional: WARP XrayConfig โœจ

{
  "protocol": "socks",
  "settings": {
    "servers": [
      { 
        "address": "127.0.0.1",
        "port":40000
      }
    ]
  },
  "tag":"warp"
},

Used Projects ๐Ÿ’ž

https://github.com/pi-hole
https://github.com/alireza0/x-ui
https://github.com/MHSanaei/3x-ui
https://github.com/deathline94/tuic-v5-installer
https://github.com/deathline94/Hysteria-Installer
https://github.com/sssvip/simple-file-server
https://github.com/seriyps/mtproto_proxy
https://github.com/P3TERX/warp.sh
https://github.com/blocklistproject/Lists

Buy Me a Coffee โ˜•โค๏ธ

Tron USDT (TRC20): TMrJHiTnE6wMqHarp2SxVEmJfKXBoTSnZ4
LiteCoin (LTC): ltc1qwhd8jpwumg5uywgv028h3lnsck8mjxhxnp4rja
BTC: bc1q2tjjyg60hhsuyauha6uptgrwm32sarhmjlwvae

ubuntu-server-setup's People

Contributors

leipnar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.