1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00
AdvLabDB/scripts/setup/logged_server_setup.py
2022-08-08 22:51:52 +02:00

43 lines
1 KiB
Python

"""
No relative imports allowed in this file to be able to run server_setup.py without packages.
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
from terminal_utils import run, step
def main():
step("Update system packages")
run("sudo apt update")
run("sudo apt dist-upgrade")
step("Remove unused packages")
run("sudo apt autoremove")
step("Install needed system packages")
run("sudo apt install python3 python3-pip python3-venv ufw nginx systemd -y")
step("Install optional system packages")
run("sudo apt install htop rsync sqlite3")
step("Setup firewall")
run("sudo ufw default allow outgoing")
run("sudo ufw default deny incoming")
run("sudo ufw allow ssh")
run("sudo ufw allow http/tcp")
run("sudo ufw allow https/tcp")
run("sudo ufw enable")
run("sudo ufw status")
step("Deactivate the 'root' user")
run("sudo passwd -l root")
step("Reboot")
run("sudo systemctl reboot")
if __name__ == "__main__":
main()