Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- def run_command(command):
- subprocess.run(command, shell=True, check=True)
- def install_docker():
- commands = [
- "sudo apt-get update",
- "sudo apt-get install -y ca-certificates curl wget",
- "sudo install -m 0755 -d /etc/apt/keyrings",
- "sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc",
- "sudo chmod a+r /etc/apt/keyrings/docker.asc",
- 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null',
- "sudo apt-get update",
- "sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
- ]
- for command in commands:
- run_command(command)
- def download_docker_compose(choice):
- urls = [
- "https://pastebin.com/raw/Nx1AQySr", # Link Moodle
- "https://pastebin.com/raw/mZ5LhgzU", # Link Squid Postfix MySql
- "https://pastebin.com/raw/m5wXMjY8", # Link Apache
- "https://pastebin.com/raw/nQxGQDfx" # Link Jupyter Notebook
- ]
- url = urls[int(choice) - 1]
- command = f"wget -O docker-compose.yml {url}"
- run_command(command)
- print(f"docker-compose.yml successfully downloaded for choice {choice}")
- command = f"wget -O help.txt https://pastebin.com/raw/PXtUjTQe"
- run_command(command)
- def main():
- install_docker()
- print("Select from 1 to 4:")
- print("[1] Moodle")
- print("[2] Squid Postfix MySql")
- print("[3] Apache")
- print("[4] Jupyter Notebook")
- choice = input("Your choice: ")
- if choice in ["1", "2", "3", "4"]:
- download_docker_compose(choice)
- else:
- print("Invalid choice. Please run the program again and select a number from 1 to 4.")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement