From dcec2605a40821572b1704031e9f450494a8bfd0 Mon Sep 17 00:00:00 2001 From: Kristian Skov Date: Tue, 14 Jan 2025 16:33:33 +0100 Subject: [PATCH 1/2] Added script files --- ct/sqlserver2022.sh | 49 ++++++++++++++++++++++++++++ install/sqlserver2022-install.sh | 55 ++++++++++++++++++++++++++++++++ json/sqlserver2022.json | 43 +++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 ct/sqlserver2022.sh create mode 100644 install/sqlserver2022-install.sh create mode 100644 json/sqlserver2022.json diff --git a/ct/sqlserver2022.sh b/ct/sqlserver2022.sh new file mode 100644 index 00000000..fe7ab57e --- /dev/null +++ b/ct/sqlserver2022.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/kris701/ProxmoxVE/refs/heads/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Kristian Skov +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.microsoft.com/en-us/sql-server/sql-server-2022 + +# App Default Values +APP="SQL Server 2022" +var_tags="sql" +var_cpu="1" +var_ram="2048" +var_disk="10" +var_os="ubuntu" +var_version="22.04" +var_unprivileged="0" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/mssql ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP} LXC" + apt-get update &>/dev/null + apt-get -y upgrade &>/dev/null + msg_ok "Updated Successfully" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following IP:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}${IP}:1433${CL}" \ No newline at end of file diff --git a/install/sqlserver2022-install.sh b/install/sqlserver2022-install.sh new file mode 100644 index 00000000..11af0d8b --- /dev/null +++ b/install/sqlserver2022-install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Kristian Skov +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + curl \ + gpg \ + coreutils +msg_ok "Installed Dependencies" + +msg_info "Installing SQL Server 2022" +curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg +curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc +curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list +$STD apt clean * +$STD apt update -y +$STD apt install -y mssql-server +/opt/mssql/bin/mssql-conf setup +msg_ok "Installed SQL Server 2022" + +msg_info "Installing SQL Server Tools" +curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc +curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list +$STD apt update +$STD apt install -y \ + mssql-tools18 \ + unixodbc-dev +echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile +source ~/.bash_profile +msg_ok "Installed SQL Server Tools" + +msg_info "Start Service" +systemctl enable -q mssql-server +systemctl start -q mssql-server +msg_ok "Service started" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" \ No newline at end of file diff --git a/json/sqlserver2022.json b/json/sqlserver2022.json new file mode 100644 index 00000000..497f90a8 --- /dev/null +++ b/json/sqlserver2022.json @@ -0,0 +1,43 @@ +{ + "name":"SQL Server 2022", + "slug":"sqlserver2022", + "categories":[ + 5 + ], + "date_created":"2025-01-14", + "type":"ct", + "updateable":true, + "privileged":true, + "interface_port":1433, + "documentation":"https://learn.microsoft.com/en-us/sql/sql-server/?view=sql-server-ver16", + "website":"https://www.microsoft.com/en-us/sql-server/sql-server-2022", + "logo":"https://www.svgrepo.com/show/303229/microsoft-sql-server-logo.svg", + "description":"Script to automatically set up a SQL Server 2022 installation.", + "install_methods":[ + { + "type":"default", + "script":"ct/sqlserver2022.sh", + "resources":{ + "cpu":1, + "ram":2048, + "hdd":10, + "os":"Ubuntu", + "version":"22.04" + } + } + ], + "default_credentials":{ + "username":null, + "password":null + }, + "notes":[ + { + "text":"You can setup the admin account 'SA' during installation", + "type":"info" + }, + { + "text":"Do disable the SA account if you intent to use this in production!", + "type":"warning" + } + ] +} \ No newline at end of file From d3ed282375f3cec717199beb6b1b924d6b40596e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:05:01 +0100 Subject: [PATCH 2/2] Update sqlserver2022-install.sh --- install/sqlserver2022-install.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/install/sqlserver2022-install.sh b/install/sqlserver2022-install.sh index 11af0d8b..1ece7da9 100644 --- a/install/sqlserver2022-install.sh +++ b/install/sqlserver2022-install.sh @@ -16,6 +16,8 @@ update_os msg_info "Installing Dependencies" $STD apt install -y \ curl \ + mc \ + sudo \ gpg \ coreutils msg_ok "Installed Dependencies" @@ -24,17 +26,17 @@ msg_info "Installing SQL Server 2022" curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list -$STD apt clean * -$STD apt update -y -$STD apt install -y mssql-server +$STD apt-get clean * +$STD apt-get update -y +$STD apt-get install -y mssql-server /opt/mssql/bin/mssql-conf setup msg_ok "Installed SQL Server 2022" msg_info "Installing SQL Server Tools" curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list -$STD apt update -$STD apt install -y \ +$STD apt-get update +$STD apt-get install -y \ mssql-tools18 \ unixodbc-dev echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile @@ -52,4 +54,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" \ No newline at end of file +msg_ok "Cleaned"