Skip to content

Commit a8f8ca6

Browse files
kris701MickLesk
andauthored
New script: SQL Server 2022 (#1482)
* Added script files * Update sqlserver2022-install.sh --------- Co-authored-by: CanbiZ <[email protected]>
1 parent c6c026e commit a8f8ca6

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed

ct/sqlserver2022.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/kris701/ProxmoxVE/refs/heads/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Kristian Skov
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://www.microsoft.com/en-us/sql-server/sql-server-2022
7+
8+
# App Default Values
9+
APP="SQL Server 2022"
10+
var_tags="sql"
11+
var_cpu="1"
12+
var_ram="2048"
13+
var_disk="10"
14+
var_os="ubuntu"
15+
var_version="22.04"
16+
var_unprivileged="0"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -d /opt/mssql ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
msg_info "Updating ${APP} LXC"
36+
apt-get update &>/dev/null
37+
apt-get -y upgrade &>/dev/null
38+
msg_ok "Updated Successfully"
39+
exit
40+
}
41+
42+
start
43+
build_container
44+
description
45+
46+
msg_ok "Completed Successfully!\n"
47+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
48+
echo -e "${INFO}${YW} Access it using the following IP:${CL}"
49+
echo -e "${TAB}${GATEWAY}${BGN}${IP}:1433${CL}"

install/sqlserver2022-install.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Kristian Skov
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
curl \
19+
mc \
20+
sudo \
21+
gpg \
22+
coreutils
23+
msg_ok "Installed Dependencies"
24+
25+
msg_info "Installing SQL Server 2022"
26+
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
27+
curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
28+
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list
29+
$STD apt-get clean *
30+
$STD apt-get update -y
31+
$STD apt-get install -y mssql-server
32+
/opt/mssql/bin/mssql-conf setup
33+
msg_ok "Installed SQL Server 2022"
34+
35+
msg_info "Installing SQL Server Tools"
36+
curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc
37+
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
38+
$STD apt-get update
39+
$STD apt-get install -y \
40+
mssql-tools18 \
41+
unixodbc-dev
42+
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile
43+
source ~/.bash_profile
44+
msg_ok "Installed SQL Server Tools"
45+
46+
msg_info "Start Service"
47+
systemctl enable -q mssql-server
48+
systemctl start -q mssql-server
49+
msg_ok "Service started"
50+
51+
motd_ssh
52+
customize
53+
54+
msg_info "Cleaning up"
55+
$STD apt-get -y autoremove
56+
$STD apt-get -y autoclean
57+
msg_ok "Cleaned"

json/sqlserver2022.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name":"SQL Server 2022",
3+
"slug":"sqlserver2022",
4+
"categories":[
5+
5
6+
],
7+
"date_created":"2025-01-14",
8+
"type":"ct",
9+
"updateable":true,
10+
"privileged":true,
11+
"interface_port":1433,
12+
"documentation":"https://learn.microsoft.com/en-us/sql/sql-server/?view=sql-server-ver16",
13+
"website":"https://www.microsoft.com/en-us/sql-server/sql-server-2022",
14+
"logo":"https://www.svgrepo.com/show/303229/microsoft-sql-server-logo.svg",
15+
"description":"Script to automatically set up a SQL Server 2022 installation.",
16+
"install_methods":[
17+
{
18+
"type":"default",
19+
"script":"ct/sqlserver2022.sh",
20+
"resources":{
21+
"cpu":1,
22+
"ram":2048,
23+
"hdd":10,
24+
"os":"Ubuntu",
25+
"version":"22.04"
26+
}
27+
}
28+
],
29+
"default_credentials":{
30+
"username":null,
31+
"password":null
32+
},
33+
"notes":[
34+
{
35+
"text":"You can setup the admin account 'SA' during installation",
36+
"type":"info"
37+
},
38+
{
39+
"text":"Do disable the SA account if you intent to use this in production!",
40+
"type":"warning"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)