├── GetRepos.ipynb ├── README.md ├── UbuntuSetup.sh ├── WorkstationSetup.sh ├── cloud-init.yml └── tv.sh /GetRepos.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Get Repositories\n", 8 | "\n", 9 | "This script will get all GitHub repositories that you own, collaborate on, or own the organization of. Just update your `gh_token` with your GitHub token and run the script. Make a token here: https://github.com/settings/tokens\n" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "import os\n", 19 | "import subprocess\n", 20 | "import requests\n", 21 | "from concurrent.futures import ThreadPoolExecutor\n", 22 | "\n", 23 | "# Your GitHub Personal Access Token\n", 24 | "gh_token = \"Your Github Personal Access Token\"\n", 25 | "\n", 26 | "# Directory to clone repositories\n", 27 | "repo_dir = \"C:/Repos/\"\n", 28 | "\n", 29 | "\n", 30 | "# Function to fetch repositories\n", 31 | "def get_all_repos():\n", 32 | " all_repos = []\n", 33 | " page = 1\n", 34 | " while True:\n", 35 | " response = requests.get(\n", 36 | " f\"https://api.github.com/user/repos?type=all&page={page}\",\n", 37 | " headers={\n", 38 | " \"Authorization\": f\"token {gh_token}\",\n", 39 | " \"Accept\": \"application/vnd.github.v3+json\",\n", 40 | " },\n", 41 | " )\n", 42 | " repos = response.json()\n", 43 | " if not repos:\n", 44 | " break\n", 45 | " all_repos.extend(repos)\n", 46 | " page += 1\n", 47 | " return all_repos\n", 48 | "\n", 49 | "\n", 50 | "def get_repository(repo):\n", 51 | " repo_name = repo[\"full_name\"]\n", 52 | " clone_url = repo[\"clone_url\"].replace(\"https://\", f\"https://{gh_token}@\")\n", 53 | " org = repo_name.split(\"/\")[0]\n", 54 | " os.makedirs(os.path.join(repo_dir, org), exist_ok=True)\n", 55 | " if repo[\"archived\"] or org == \"OldAIProjects\":\n", 56 | " print(f\"Skipping {repo_name} as it is archived.\")\n", 57 | " return\n", 58 | " dir_path = os.path.join(repo_dir, repo_name)\n", 59 | " if os.path.exists(dir_path):\n", 60 | " print(f\"Updating {repo_name}...\")\n", 61 | " subprocess.run(f\"git -C {dir_path} pull\", shell=True)\n", 62 | " else:\n", 63 | " print(f\"Cloning {repo_name}...\")\n", 64 | " os.makedirs(dir_path, exist_ok=True)\n", 65 | " subprocess.run(f\"git clone {clone_url} {dir_path}\", shell=True)\n", 66 | "\n", 67 | "\n", 68 | "os.makedirs(repo_dir, exist_ok=True)\n", 69 | "all_repos = get_all_repos()\n", 70 | "\n", 71 | "with ThreadPoolExecutor(max_workers=10) as executor:\n", 72 | " executor.map(get_repository, all_repos)" 73 | ] 74 | } 75 | ], 76 | "metadata": { 77 | "kernelspec": { 78 | "display_name": "Python 3", 79 | "language": "python", 80 | "name": "python3" 81 | }, 82 | "language_info": { 83 | "codemirror_mode": { 84 | "name": "ipython", 85 | "version": 3 86 | }, 87 | "file_extension": ".py", 88 | "mimetype": "text/x-python", 89 | "name": "python", 90 | "nbconvert_exporter": "python", 91 | "pygments_lexer": "ipython3", 92 | "version": "3.10.11" 93 | } 94 | }, 95 | "nbformat": 4, 96 | "nbformat_minor": 2 97 | } 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setup Automation and Documentation 2 | 3 | [![GitHub](https://img.shields.io/badge/GitHub-Sponsor%20Josh%20XT-blue?logo=github&style=plastic)](https://github.com/sponsors/Josh-XT) [![PayPal](https://img.shields.io/badge/PayPal-Sponsor%20Josh%20XT-blue.svg?logo=paypal&style=plastic)](https://paypal.me/joshxt) [![Ko-Fi](https://img.shields.io/badge/Kofi-Sponsor%20Josh%20XT-blue.svg?logo=kofi&style=plastic)](https://ko-fi.com/joshxt) 4 | 5 | I created this repository to keep my own development setup documented so that I can stand up a new development environment easily if I ever need to. The scripts below install and update everything I need for development and daily use after a fresh OS install of `Ubuntu 24.04` server or desktop. I have also documented my hardware setup and Visual Studio Code settings and extensions below. 6 | 7 | My recommendation is to fork this repository and modify the scripts to fit your own needs and so that you can document your own setup for yourself. 8 | 9 | _The scripts below will require modification unless you want my exact setup, which should only be the case if you are me._ 10 | 11 | ## Table of Contents 📖 12 | 13 | - [Setup Automation and Documentation](#setup-automation-and-documentation) 14 | - [Table of Contents 📖](#table-of-contents-) 15 | - [Automatic Setup During Ubuntu Installation](#automatic-setup-during-ubuntu-installation) 16 | - [Manual Setup after Ubuntu Installation](#manual-setup-after-ubuntu-installation) 17 | - [Ubuntu Server Setup](#ubuntu-server-setup) 18 | - [Ubuntu Workstation Setup](#ubuntu-workstation-setup) 19 | - [VSCode Setup](#vscode-setup) 20 | - [Settings](#settings) 21 | - [Extensions](#extensions) 22 | - [Clone All Repositories](#clone-all-repositories) 23 | - [My Workstation Hardware](#my-workstation-hardware) 24 | - [Mouse Bindings for `Logitech G502`](#mouse-bindings-for-logitech-g502) 25 | - [Potentially Important Links](#potentially-important-links) 26 | - [Operating System Downloads](#operating-system-downloads) 27 | - [Software Downloads](#software-downloads) 28 | 29 | ## Automatic Setup During Ubuntu Installation 30 | 31 | To automatically set up your environment during the Ubuntu installation process: 32 | 33 | 1. Download the `cloud-init.yaml` file from this repository. 34 | 2. When installing Ubuntu: 35 | - For server installations using the ISO, you can pass this file using kernel parameters at boot time. Add `autoinstall ds=nocloud-net;s=https://raw.githubusercontent.com/Josh-XT/Setup/main/` to your kernel parameters. 36 | - For cloud images or VMs, pass the `cloud-init.yaml` file directly to your hypervisor or cloud provider. 37 | 38 | This will automatically: 39 | 40 | - Install git 41 | - Clone this repository 42 | - Run the appropriate setup script based on whether it's a desktop or server environment 43 | - Set up necessary bash aliases 44 | 45 | After the installation is complete and you log in for the first time, your environment will already be set up according to the scripts in this repository. 46 | 47 | ## Manual Setup after Ubuntu Installation 48 | 49 | ### Ubuntu Server Setup 50 | 51 | The `ServerSetup.sh` is similar to the `WorkstationSetup.sh` script, but is geared towards installing the essentials that I need for a new [Ubuntu Server](https://ubuntu.com/download/server) virtual machine on any given project that I am working on. This includes `Docker`, `NodeJS`, `Yarn`, `PowerShell`, `Python`, `.NET Runtimes` and all updates from `apt` and `snap`. It also sets the timezone on the server to `America/New_York`. 52 | 53 | ```bash 54 | sudo apt update 55 | sudo apt install -y git 56 | git clone https://github.com/Josh-XT/Setup 57 | sudo chmod +x Setup/*.sh 58 | cd Setup 59 | ./UbuntuSetup.sh 60 | ``` 61 | 62 | ### Ubuntu Workstation Setup 63 | 64 | The `WorkstationSetup.sh` script handles all of my application installs and git configurations on a workstation so that I can stand up a new development environment for myself in minutes without missing any of my critical software or configurations. `WorkstationSetup.sh` was created to work on `Ubuntu 24.04`, but may also work on other Debian-based distributions. 65 | 66 | Open terminal and copy/paste the following: 67 | 68 | ```bash 69 | sudo apt update 70 | sudo apt install -y git 71 | git clone https://github.com/Josh-XT/Setup 72 | sudo chmod +x Setup/*.sh 73 | ``` 74 | 75 | _**Note: WorkstationSetup.sh should be modified before running it so that you can enter your own details in the git config and add or remove any apt packages you might want or not want. This script is specifically set up for me to use after a fresh image.**_ 76 | 77 | ```bash 78 | cd Setup 79 | ./WorkstationSetup.sh 80 | ``` 81 | 82 | For more information, check out the [AGiXT](https://github.com/Josh-XT/AGiXT) repository. 83 | 84 | ## VSCode Setup 85 | 86 | I have settings sync enabled and sync with my GitHub account, but I've found it very helpful to other to have a list of the settings and extensions that I use. 87 | 88 | ### Settings 89 | 90 | Some settings I'd highly recommend setting up the auto save on focus change as well as the auto format on save. Set Python Black as your default formatter for python. Click on the settings gear in the bottom left of VSCode, then `Settings`. You'll be able to search for the settings below and change them there. 91 | 92 | | Setting | Value | 93 | |-------------------------------|-------------------| 94 | | `Files: Auto Save` | `onFocusChange` | 95 | | `Editor: Default Formatter` | `Black Formatter` | 96 | | `Editor: Format on Save` | `Checked` | 97 | | `Editor: Format On Save Mode` | `file` | 98 | | `Notebook: Format On Save` | `Checked` | 99 | 100 | ### Extensions 101 | 102 | To install the same VSCode extensions that I use, run the `CodeExtensions.sh` script in the `Setup` directory. 103 | 104 | ```bash 105 | code --install-extension AkashGutha.qiksit-snippets 106 | code --install-extension amazonwebservices.aws-toolkit-vscode 107 | code --install-extension apollographql.vscode-apollo 108 | code --install-extension AykutSarac.jsoncrack-vscode 109 | code --install-extension christian-kohler.npm-intellisense 110 | code --install-extension dbaeumer.vscode-eslint 111 | code --install-extension eamodio.gitlens 112 | code --install-extension elypia.magick-image-reader 113 | code --install-extension esbenp.prettier-vscode 114 | code --install-extension firefox-devtools.vscode-firefox-debug 115 | code --install-extension gamunu.vscode-yarn 116 | code --install-extension GitHub.codespaces 117 | code --install-extension GitHub.copilot-chat 118 | code --install-extension GitHub.copilot-labs 119 | code --install-extension GitHub.copilot-nightly 120 | code --install-extension github.vscode-github-actions 121 | code --install-extension GrapeCity.gc-excelviewer 122 | code --install-extension Gruntfuggly.todo-tree 123 | code --install-extension Ionide.Ionide-fsharp 124 | code --install-extension leo-labs.dotnet 125 | code --install-extension mikestead.dotenv 126 | code --install-extension ms-azuretools.vscode-docker 127 | code --install-extension ms-dotnettools.csharp 128 | code --install-extension ms-dotnettools.dotnet-interactive-vscode 129 | code --install-extension ms-dotnettools.vscode-dotnet-runtime 130 | code --install-extension ms-mssql.data-workspace-vscode 131 | code --install-extension ms-mssql.mssql 132 | code --install-extension ms-mssql.sql-bindings-vscode 133 | code --install-extension ms-mssql.sql-database-projects-vscode 134 | code --install-extension ms-python.black-formatter 135 | code --install-extension ms-python.isort 136 | code --install-extension ms-python.python 137 | code --install-extension ms-python.vscode-pylance 138 | code --install-extension ms-toolsai.jupyter 139 | code --install-extension ms-toolsai.jupyter-keymap 140 | code --install-extension ms-toolsai.jupyter-renderers 141 | code --install-extension ms-toolsai.vscode-jupyter-cell-tags 142 | code --install-extension ms-toolsai.vscode-jupyter-slideshow 143 | code --install-extension ms-vscode-remote.remote-containers 144 | code --install-extension ms-vscode-remote.remote-ssh 145 | code --install-extension ms-vscode-remote.remote-ssh-edit 146 | code --install-extension ms-vscode-remote.remote-wsl 147 | code --install-extension ms-vscode-remote.vscode-remote-extensionpack 148 | code --install-extension ms-vscode.azurecli 149 | code --install-extension ms-vscode.powershell 150 | code --install-extension ms-vscode.remote-explorer 151 | code --install-extension ms-vscode.remote-server 152 | code --install-extension ms-vscode.vscode-typescript-next 153 | code --install-extension ms-vsliveshare.vsliveshare 154 | code --install-extension quantum.quantum-devkit-vscode 155 | code --install-extension redhat.vscode-yaml 156 | code --install-extension ShahilKumar.docxreader 157 | code --install-extension stylelint.vscode-stylelint 158 | code --install-extension tomoki1207.pdf 159 | code --install-extension wayou.vscode-todo-highlight 160 | code --install-extension yzhang.markdown-all-in-one 161 | code --install-extension zetta.qsharp-extensionpack 162 | ``` 163 | 164 | ## Clone All Repositories 165 | 166 | Once the workstation setup is complete, you can clone all of your GitHub repositories easily with the `GetRepos.ipynb` notebook. This will clone all GitHub repositories that you own or collaborate on sorted by organization/owner into your defined `repo_dir`. 167 | 168 | - Open the `GetRepos.ipynb` notebook in VSCode 169 | - Enter your [GitHub Personal Access Token](https://github.com/settings/tokens) into the `gh_token` variable 170 | - Update the `repo_dir` with the path that you would like to clone the repositories to 171 | - Run the notebook and wait for all of your repositories to be cloned. 172 | - Open the `repo_dir` in VSCode to start working on your projects. 173 | 174 | ## My Workstation Hardware 175 | 176 | | Item | Desktop | Laptop | 177 | |-------------------|-------------------|-------------------| 178 | | **Model** | Custom Built | [Alienware x17 R2](https://www.microcenter.com/product/647646/dell-alienware-x17-r2-173-gaming-laptop-computer-white) | 179 | | **CPU** | [Intel Core i9-12900KS](https://ark.intel.com/content/www/us/en/ark/products/225916/intel-core-i912900ks-processor-30m-cache-up-to-5-50-ghz.html) | Intel Core i9-12900HK | 180 | | **GPU** | [NVIDIA GeForce RTX 4090 24GB](https://www.asus.com/us/motherboards-components/graphics-cards/tuf-gaming/tuf-rtx4090-o24g-gaming/) | NVIDIA GeForce RTX 3080 Ti 16GB | 181 | | **RAM** | [128GB DDR5-5200](https://www.gskill.com/product/165/377/1649665420/F5-5200J3636D32GX2-RS5W-F5-5200J3636D32GA2-RS5W) | [64GB DDR5-5600](https://www.microcenter.com/product/661345/crucial-64gb-(2-x-32gb)-ddr5-5600-pc5-44800-cl46-dual-channel-laptop-memory-kit-ct2k32g56c46s5-black) | 182 | | **Storage** | 2TB M2 | 2TB M2 | 183 | | **Mouse** | [Logitech G502](https://www.logitechg.com/en-us/products/gaming-mice/g502-hero-gaming-mouse.910-005469.html) | -- | 184 | | **Keyboard** | [Logitech K350](https://www.logitech.com/en-us/products/keyboards/k350-wave-ergonomic.920-001996.html) | -- | 185 | | **Monitor** | 65in Samsung 4k TV | 17.3" 1080p | 186 | 187 | ### Mouse Bindings for `Logitech G502` 188 | 189 | In Linux, I use `Piper` to configure my mouse. I have the following bindings set up for my mouse: 190 | 191 | | Button | Binding | Action | 192 | |--------|--------|------| 193 | | G4 | Backward | `Backward` button in the web browser. | 194 | | G5 | Forward | `Forward` button in the web browser. | 195 | | G6/Target | CTRL + T | Open a new web browser tab. | 196 | | G7 | SUPER + PAGEDOWN | Navigate to the workspace down from the current one. | 197 | | G8 | SUPER + PAGEUP | Navigate to the workspace up from the current one. | 198 | | G9 | SUPER + B | Open a new web browser window. | 199 | 200 | ## Potentially Important Links 201 | 202 | ### Operating System Downloads 203 | 204 | - [Ubuntu Server](https://ubuntu.com/download/server) 205 | - [Ubuntu Desktop](https://ubuntu.com/download/desktop) 206 | 207 | ### Software Downloads 208 | 209 | - [Cuda Toolkit](https://developer.nvidia.com/cuda-downloads) 210 | - [Visual Studio Code](https://code.visualstudio.com/) 211 | - [Git](https://git-scm.com/) 212 | - [Docker](https://www.docker.com/) 213 | -------------------------------------------------------------------------------- /UbuntuSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo snap refresh'" > "$HOME/.bash_aliases" 3 | echo "alias docker-compose='docker compose'" >> "$HOME/.bash_aliases" 4 | git config --global submodule.recurse true 5 | git config --global credential.helper store 6 | git config --global user.email "admin@agixt.com" 7 | git config --global user.name "admin" 8 | sudo apt install curl -y 9 | # Set error handling 10 | set -e 11 | 12 | # Define variables 13 | LOG_FILE="/var/log/setup_script.log" 14 | 15 | # Function to log messages 16 | log_message() { 17 | echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE" 18 | } 19 | 20 | # Install Python 3.10 and pip 21 | if ! command -v python3.10 &> /dev/null; then 22 | log_message "Python 3.10 not found. Attempting to install..." 23 | if command -v apt-get &> /dev/null; then 24 | sudo DEBIAN_FRONTEND=noninteractive apt-get update 25 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common 26 | sudo add-apt-repository -y ppa:deadsnakes/ppa 27 | sudo DEBIAN_FRONTEND=noninteractive apt-get update 28 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip 29 | elif command -v yum &> /dev/null; then 30 | sudo yum install -y centos-release-scl 31 | sudo yum install -y rh-python310 32 | source /opt/rh/rh-python310/enable 33 | else 34 | log_message "Unable to install Python 3.10. Please install it manually." 35 | exit 1 36 | fi 37 | else 38 | log_message "Python 3.10 is already installed." 39 | fi 40 | 41 | # Ensure pip is installed for Python 3.10 42 | if ! python3.10 -m pip --version &> /dev/null; then 43 | log_message "pip for Python 3.10 not found. Attempting to install..." 44 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 45 | python3.10 get-pip.py --user 46 | rm get-pip.py 47 | fi 48 | python3.10 -m pip install --upgrade pip setuptools wheel 49 | 50 | log_message "Python 3.10 and pip installation and configuration completed." 51 | 52 | # Docker installation 53 | log_message "Starting Docker installation" 54 | if ! command -v docker &> /dev/null; then 55 | log_message "Docker not found. Attempting to install..." 56 | sudo apt-get update 57 | sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common 58 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg 59 | echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 60 | sudo apt-get update 61 | sudo apt-get install -y docker-ce docker-ce-cli containerd.io 62 | else 63 | log_message "Docker is already installed." 64 | fi 65 | 66 | # Check for NVIDIA GPU 67 | if lspci | grep -i nvidia &> /dev/null; then 68 | log_message "NVIDIA GPU detected. Proceeding with NVIDIA driver and CUDA installation." 69 | 70 | # NVIDIA drivers and CUDA installation 71 | log_message "Starting NVIDIA drivers and CUDA installation" 72 | if ! command -v nvidia-smi &> /dev/null; then 73 | log_message "NVIDIA drivers not found. Attempting to install..." 74 | sudo apt-get update 75 | sudo apt-get install -y linux-headers-$(uname -r) 76 | sudo apt-get install -y nvidia-driver-535 nvidia-utils-535 77 | else 78 | log_message "NVIDIA drivers are already installed." 79 | fi 80 | 81 | if ! command -v nvcc &> /dev/null; then 82 | log_message "CUDA not found. Attempting to install CUDA..." 83 | wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-ubuntu2404.pin 84 | sudo mv cuda-ubuntu2404.pin /etc/apt/preferences.d/cuda-repository-pin-600 85 | wget https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda-repo-ubuntu2404-12-5-local_12.5.1-555.42.06-1_amd64.deb 86 | sudo dpkg -i cuda-repo-ubuntu2404-12-5-local_12.5.1-555.42.06-1_amd64.deb 87 | sudo cp /var/cuda-repo-ubuntu2404-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/ 88 | sudo apt-get update 89 | sudo apt-get -y install cuda 90 | else 91 | log_message "CUDA is already installed." 92 | fi 93 | 94 | # NVIDIA Container Toolkit installation 95 | log_message "Starting NVIDIA Container Toolkit installation" 96 | log_message "Setting up NVIDIA Container Toolkit repository" 97 | 98 | curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ 99 | && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ 100 | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ 101 | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null 102 | 103 | log_message "Updating package list" 104 | sudo apt-get update 105 | 106 | log_message "Installing NVIDIA Container Toolkit" 107 | sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nvidia-container-toolkit 108 | 109 | log_message "Configuring Docker daemon" 110 | sudo nvidia-ctk runtime configure --runtime=docker 111 | 112 | log_message "Restarting Docker daemon" 113 | sudo systemctl restart docker 114 | else 115 | log_message "No NVIDIA GPU detected. Skipping NVIDIA driver and CUDA installation." 116 | fi 117 | 118 | # Verification 119 | log_message "Verifying installations" 120 | if lspci | grep -i nvidia &> /dev/null; then 121 | nvidia-smi 122 | nvcc --version 123 | fi 124 | docker --version 125 | docker compose --version 126 | python3.10 --version 127 | log_message "Reboot the system to complete the installation." 128 | -------------------------------------------------------------------------------- /WorkstationSetup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo snap refresh'" > "$HOME/.bash_aliases" 3 | # Update APT 4 | sudo apt-get update 5 | sudo add-apt-repository ppa:dotnet/backports 6 | sudo apt update && sudo apt upgrade -y && sudo snap refresh 7 | sudo apt install -y wget 8 | # OpenSSL 9 | wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb 10 | sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb 11 | rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb 12 | sudo chmod +x UbuntuSetup.sh 13 | sudo ./UbuntuSetup.sh 14 | # Docker 15 | sudo usermod -aG docker $USER 16 | sudo systemctl restart docker 17 | # Git 18 | git config --global submodule.recurse true 19 | git config --global credential.helper store 20 | git config --global user.email "josh@devxt.com" 21 | git config --global user.name "Josh XT" 22 | echo "Updates" > ~/.gitmessage 23 | git config --global commit.template ~/.gitmessage 24 | # Brave 25 | sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg 26 | echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list 27 | sudo apt update 28 | sudo apt install -y brave-browser 29 | # APT Packages 30 | sudo apt install -y libpq-dev 31 | sudo apt install -y evolution 32 | sudo apt install -y evolution-ews 33 | sudo apt install -y gnome-boxes 34 | sudo apt install -y apt-transport-https 35 | sudo apt install -y piper 36 | sudo apt install -y software-properties-common 37 | sudo apt install -y ocl-icd-opencl-dev opencl-headers clinfo libclblast-dev libopenblas-dev cmake gcc g++ 38 | sudo apt install -y node-typescript make nodejs npm gnome-shell-extensions 39 | sudo apt install -y dotnet-sdk-8.0 aspnetcore-runtime-8.0 40 | # Snap 41 | sudo apt install -y snapd 42 | sudo snap install code --classic 43 | sudo snap install dotnet-sdk --classic --channel=8.0 44 | sudo snap alias dotnet-sdk.dotnet dotnet 45 | sudo snap install powershell --classic 46 | sudo snap install discord 47 | sudo snap install --edge spotify 48 | # NodeJS 49 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash 50 | nvm install --lts 51 | nvm use --lts 52 | 53 | # Flutter and Android Development 54 | # Android SDK dependencies 55 | sudo apt install -y openjdk-11-jdk 56 | sudo apt install -y android-sdk 57 | sudo apt install -y gradle 58 | sudo apt install -y adb 59 | sudo apt install -y libgl1-mesa-dev 60 | sudo apt install -y lib32stdc++6 lib32z1 61 | 62 | # Set up Flutter 63 | sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev 64 | mkdir -p ~/development 65 | cd ~/development 66 | git clone https://github.com/flutter/flutter.git -b stable 67 | echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.bashrc 68 | echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc 69 | echo 'export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"' >> ~/.bashrc 70 | 71 | # Additional updates 72 | sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo snap refresh 73 | # Pop Shell 74 | RELEASE_INFO = lsb_release -a 75 | CODENAME = $(echo $RELEASE_INFO | grep "Codename" | awk '{print $2}') 76 | git clone https://github.com/pop-os/shell -b "master_$CODENAME" 77 | cd shell 78 | make local-install -s 79 | # A reboot or log out is required to complete the installation of Pop Shell, it can take a few minutes to appear in the GNOME Extensions app. -------------------------------------------------------------------------------- /cloud-init.yml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | # Update and upgrade packages 4 | package_update: true 5 | package_upgrade: true 6 | 7 | # Install necessary packages 8 | packages: 9 | - git 10 | 11 | # Run commands to set up the environment 12 | runcmd: 13 | # Clone the repository 14 | - [ su, -c, "git clone https://github.com/Josh-XT/Setup /home/ubuntu/Setup", ubuntu ] 15 | - [ chown, -R, ubuntu:ubuntu, /home/ubuntu/Setup ] 16 | - [ chmod, +x, /home/ubuntu/Setup/*.sh ] 17 | 18 | # Detect if we're on a desktop or server environment 19 | - | 20 | if dpkg -l | grep -q ubuntu-desktop; then 21 | su -c "/home/ubuntu/Setup/WorkstationSetup.sh" ubuntu 22 | else 23 | su -c "/home/ubuntu/Setup/UbuntuSetup.sh" ubuntu 24 | fi 25 | 26 | # Set up the user's bash aliases 27 | write_files: 28 | - path: /home/ubuntu/.bash_aliases 29 | content: | 30 | alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo snap refresh' 31 | alias docker-compose='docker compose' 32 | owner: ubuntu:ubuntu 33 | 34 | # Final message 35 | final_message: "The system is finally up, after $UPTIME seconds" -------------------------------------------------------------------------------- /tv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Function to check if the script is run with sudo privileges 4 | check_sudo() { 5 | if [ "$EUID" -ne 0 ]; then 6 | echo "Please run this script with sudo privileges" 7 | exit 1 8 | fi 9 | } 10 | 11 | # Function to create the "kids" user if it doesn't exist 12 | create_kids_user() { 13 | if id "kids" &>/dev/null; then 14 | echo "Existing 'kids' user found. Preparing for removal..." 15 | pkill -u kids 16 | sleep 2 17 | pkill -KILL -u kids 18 | echo "Deleting existing 'kids' user" 19 | userdel -r kids 20 | fi 21 | echo "Creating 'kids' user" 22 | adduser --disabled-password --gecos "" kids 23 | } 24 | 25 | # Function to configure auto-login for the "kids" user 26 | configure_auto_login() { 27 | echo "Configuring auto-login for 'kids' user" 28 | if [ -f /etc/gdm3/custom.conf ]; then 29 | sed -i '/AutomaticLoginEnable/d' /etc/gdm3/custom.conf 30 | sed -i '/AutomaticLogin/d' /etc/gdm3/custom.conf 31 | sed -i '/\[daemon\]/a AutomaticLoginEnable=true\nAutomaticLogin=kids' /etc/gdm3/custom.conf 32 | else 33 | echo "[daemon]" > /etc/gdm3/custom.conf 34 | echo "AutomaticLoginEnable=true" >> /etc/gdm3/custom.conf 35 | echo "AutomaticLogin=kids" >> /etc/gdm3/custom.conf 36 | fi 37 | } 38 | 39 | # Function to set up Chromium 40 | setup_chromium() { 41 | echo "Setting up Chromium" 42 | apt-get update 43 | apt-get install -y chromium-browser 44 | 45 | HOMEPAGE="http://devxt-nas01:31437" 46 | POLICIES_DIR="/etc/chromium-browser/policies/managed" 47 | mkdir -p "$POLICIES_DIR" 48 | 49 | cat > "$POLICIES_DIR/kids_policy.json" << EOF 50 | { 51 | "HomepageLocation": "$HOMEPAGE", 52 | "HomepageIsNewTabPage": false, 53 | "NewTabPageLocation": "$HOMEPAGE", 54 | "RestoreOnStartup": 4, 55 | "RestoreOnStartupURLs": ["$HOMEPAGE"], 56 | "BookmarkBarEnabled": false, 57 | "IncognitoModeAvailability": 1, 58 | "BrowserSignin": 0, 59 | "SyncDisabled": true, 60 | "SearchSuggestEnabled": false 61 | } 62 | EOF 63 | 64 | AUTOSTART_DIR="/home/kids/.config/autostart" 65 | mkdir -p "$AUTOSTART_DIR" 66 | chown kids:kids "$AUTOSTART_DIR" 67 | 68 | cat > "$AUTOSTART_DIR/chromium-kiosk.desktop" << EOF 69 | [Desktop Entry] 70 | Type=Application 71 | Exec=chromium-browser --kiosk --no-first-run --disable-pinch --overscroll-history-navigation=0 --disable-features=TranslateUI --no-default-browser-check $HOMEPAGE 72 | Hidden=false 73 | NoDisplay=false 74 | X-GNOME-Autostart-enabled=true 75 | Name[en_US]=Chromium Kiosk 76 | Name=Chromium Kiosk 77 | Comment=Start Chromium in kiosk mode 78 | EOF 79 | chown kids:kids "$AUTOSTART_DIR/chromium-kiosk.desktop" 80 | } 81 | 82 | # Function to modify hosts file for redirecting websites 83 | modify_hosts_file() { 84 | echo "Modifying hosts file to redirect certain websites" 85 | WEBSITES=( 86 | "www.youtube.com" 87 | "youtube.com" 88 | "youtu.be" 89 | "www.facebook.com" 90 | "facebook.com" 91 | "www.tiktok.com" 92 | "tiktok.com" 93 | ) 94 | 95 | cp /etc/hosts /etc/hosts.backup 96 | 97 | for site in "${WEBSITES[@]}"; do 98 | if ! grep -q "$site" /etc/hosts; then 99 | echo "127.0.0.1 $site" >> /etc/hosts 100 | fi 101 | done 102 | } 103 | 104 | # Function to disable Ubuntu initial setup 105 | disable_initial_setup() { 106 | echo "Disabling Ubuntu initial setup" 107 | if [ -f /etc/xdg/autostart/gnome-initial-setup-first-login.desktop ]; then 108 | mv /etc/xdg/autostart/gnome-initial-setup-first-login.desktop /etc/xdg/autostart/gnome-initial-setup-first-login.desktop.disabled 109 | fi 110 | if [ -f /etc/xdg/autostart/gnome-welcome-tour.desktop ]; then 111 | mv /etc/xdg/autostart/gnome-welcome-tour.desktop /etc/xdg/autostart/gnome-welcome-tour.desktop.disabled 112 | fi 113 | 114 | # Also disable pro pop-ups 115 | apt-get purge -y ubuntu-advantage-tools 116 | } 117 | 118 | # Function to disable Windows key, sidebar, and other unwanted features 119 | disable_features() { 120 | echo "Disabling Windows key, sidebar, and other features" 121 | 122 | # Use dconf to set values for the kids user 123 | sudo -u kids dbus-launch dconf write /org/gnome/shell/extensions/dash-to-dock/dock-fixed false 124 | sudo -u kids dbus-launch dconf write /org/gnome/shell/extensions/dash-to-dock/autohide true 125 | sudo -u kids dbus-launch dconf write /org/gnome/mutter/overlay-key "''" 126 | sudo -u kids dbus-launch dconf write /org/gnome/desktop/interface/enable-hot-corners false 127 | 128 | # Create a script to apply these settings for the kids user on login 129 | SCRIPT_PATH="/home/kids/.config/disable_features.sh" 130 | cat > "$SCRIPT_PATH" << EOF 131 | #!/bin/bash 132 | dconf write /org/gnome/shell/extensions/dash-to-dock/dock-fixed false 133 | dconf write /org/gnome/shell/extensions/dash-to-dock/autohide true 134 | dconf write /org/gnome/mutter/overlay-key "''" 135 | dconf write /org/gnome/desktop/interface/enable-hot-corners false 136 | EOF 137 | 138 | chmod +x "$SCRIPT_PATH" 139 | chown kids:kids "$SCRIPT_PATH" 140 | 141 | # Add the script to autostart for the kids user 142 | AUTOSTART_DIR="/home/kids/.config/autostart" 143 | mkdir -p "$AUTOSTART_DIR" 144 | cat > "$AUTOSTART_DIR/disable_features.desktop" << EOF 145 | [Desktop Entry] 146 | Type=Application 147 | Exec=/home/kids/.config/disable_features.sh 148 | Hidden=false 149 | NoDisplay=false 150 | X-GNOME-Autostart-enabled=true 151 | Name[en_US]=Disable Unwanted Features 152 | Name=Disable Unwanted Features 153 | Comment=Disables Windows key, sidebar, and other features for kids user 154 | EOF 155 | chown -R kids:kids "$AUTOSTART_DIR" 156 | } 157 | 158 | # Main script execution 159 | check_sudo 160 | sudo apt update --fix-missing -y && sudo apt upgrade -y 161 | create_kids_user 162 | configure_auto_login 163 | setup_chromium 164 | modify_hosts_file 165 | disable_initial_setup 166 | disable_features 167 | 168 | echo "Setup complete. Please reboot the system to apply changes." --------------------------------------------------------------------------------