Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 38013cb

Browse files
committed
creating install scripts
1 parent d90a628 commit 38013cb

3 files changed

Lines changed: 466 additions & 0 deletions

File tree

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: SQL Server Unattended Install on Red Hat Enterprise Linux | Microsoft Docs
3+
description: SQL Server Script Sample - Unattended Install on Red Hat Enterprise Linux
4+
services: sql-database
5+
documentationcenter: sql-database
6+
author: edmacauley
7+
manager:
8+
editor:
9+
tags: azure-service-management
10+
11+
ms.assetid:
12+
ms.service: sql-database
13+
ms.custom: mvc
14+
ms.devlang: azurecli
15+
ms.topic: sample
16+
ms.tgt_pltfrm: sql-database
17+
ms.workload: database
18+
ms.date: 6/19/2017
19+
ms.author: edmacauley
20+
---
21+
22+
# Install SQL Server on Red Hat Enterprise Linux
23+
24+
This sample Bash script installs SQL Server 2017 CTP 2.1 on Red Hat Enterprise Linux (RHEL) without interactive input.
25+
26+
> [!NOTE]
27+
> You need at least 3.25 GB of memory to run SQL Server on Linux. Also, the file system must be **XFS** or **EXT4**. Other file systems, such as **BTRFS**, are unsupported. For other system requirements, see [System requirements for SQL Server on Linux](sql-server-linux-setup.md#system).
28+
29+
## Sample script
30+
31+
```bash
32+
#!/bin/bash
33+
34+
# Use the following variables to control your install:
35+
36+
# Password for the SA user (required)
37+
SA_PASSWORD='<YourStrong!Passw0rd>'
38+
39+
# Install SQL Server Agent (recommended)
40+
SQL_INSTALL_AGENT='y'
41+
42+
# Install SQL Server Full Text Search (optional)
43+
# SQL_INSTALL_FULLTEXT='y'
44+
45+
# Create an additional user with sysadmin privileges (optional)
46+
# SQL_INSTALL_USER='<Username>'
47+
# SQL_INSTALL_USER_PASSWORD='<YourStrong!Passw0rd>'
48+
49+
if [ -z $SA_PASSWORD ]
50+
then
51+
echo Environment variable SA_PASSWORD must be set for unattended install
52+
exit 1
53+
fi
54+
55+
echo Adding Microsoft repositories...
56+
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server.repo
57+
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
58+
59+
echo Running yum update -y...
60+
sudo yum update -y
61+
62+
echo Installing SQL Server...
63+
sudo yum install -y mssql-server
64+
65+
echo Running mssql-conf setup...
66+
sudo SA_PASSWORD=$SA_PASSWORD \
67+
/opt/mssql/bin/mssql-conf -n setup accept-eula
68+
69+
echo Installing mssql-tools and unixODBC developer...
70+
sudo ACCEPT_EULA=Y yum install -y mssql-tools unixodbc-dev
71+
72+
# Add SQL Server tools to the path by default:
73+
echo Adding SQL Server tools to your path...
74+
echo PATH="$PATH:/opt/mssql-tools/bin" >> ~/.bash_profile
75+
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
76+
77+
# Optional SQL Server Agent installation:
78+
if [ ! -z $SQL_INSTALL_AGENT ]
79+
then
80+
echo Installing SQL Server Agent...
81+
sudo yum install -y mssql-server-agent
82+
fi
83+
84+
# Optional SQL Server Full Text Search installation:
85+
if [ ! -z $SQL_INSTALL_FULLTEXT ]
86+
then
87+
echo Installing SQL Server Full-Text Search...
88+
sudo yum install -y mssql-server-fts
89+
fi
90+
91+
# Configure firewall to allow TCP port 1433:
92+
echo Configuring firewall to allow traffic on port 1433...
93+
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
94+
sudo firewall-cmd --reload
95+
96+
# Example of setting post-installation configuration options
97+
# Set trace flags 1204 and 1222 for deadlock tracing:
98+
echo Setting trace flags...
99+
sudo /opt/mssql/bin/mssql-conf traceflag 1204 1222 on
100+
101+
# Restart SQL Server after making configuration changes:
102+
echo Restarting SQL Server...
103+
sudo systemctl restart mssql-server
104+
105+
# Connect to server and get the version:
106+
counter=1
107+
errstatus=1
108+
while [ $counter -le 5 ] && [ $errstatus = 1 ]
109+
do
110+
echo Waiting for SQL Server to start...
111+
sleep 5s
112+
/opt/mssql-tools/bin/sqlcmd \
113+
-S localhost \
114+
-U SA \
115+
-P $SA_PASSWORD \
116+
-Q "SELECT @@VERSION" 2>/dev/null
117+
errstatus=$?
118+
((counter++))
119+
done
120+
121+
# Display error if connection failed:
122+
if [ $errstatus = 1 ]
123+
then
124+
echo Cannot connect to SQL Server, installation aborted
125+
exit $errstatus
126+
fi
127+
128+
# Optional new user creation:
129+
if [ ! -z $SQL_INSTALL_USER ] && [ ! -z $SQL_INSTALL_USER_PASSWORD ]
130+
then
131+
echo Creating user $SQL_INSTALL_USER
132+
/opt/mssql-tools/bin/sqlcmd \
133+
-S localhost \
134+
-U SA \
135+
-P $SA_PASSWORD \
136+
-Q "CREATE LOGIN [$SQL_INSTALL_USER] WITH PASSWORD=N'$SQL_INSTALL_USER_PASSWORD', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=ON, CHECK_POLICY=ON; ALTER SERVER ROLE [sysadmin] ADD MEMBER [$SQL_INSTALL_USER]"
137+
fi
138+
139+
echo Done!
140+
```
141+
142+
## Next steps
143+
144+
Simplify your unattended installs by creating a Bash script that sets the proper environment variables, instead of doing it inline.
145+
146+
```bash
147+
#!/bin/bash
148+
export SA_PASSWORD='<YourStrong!Passw0rd>'
149+
export SQL_INSTALL_AGENT='y'
150+
export SQL_INSTALL_USER='<Username>'
151+
export SQL_INSTALL_USER_PASSWORD='<YourStrong!Passw0rd>'
152+
```
153+
154+
For more information about SQL Server on Linux, see [SQL Server on Linux overview](sql-server-linux-overview.md).
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: SQL Server Unattended Install on SUSE Linux Enterprise Server | Microsoft Docs
3+
description: SQL Server Script Sample - Unattended Install on SUSE Linux Enterprise Server
4+
services: sql-database
5+
documentationcenter: sql-database
6+
author: edmacauley
7+
manager:
8+
editor:
9+
tags: azure-service-management
10+
11+
ms.assetid:
12+
ms.service: sql-database
13+
ms.custom: mvc
14+
ms.devlang: azurecli
15+
ms.topic: sample
16+
ms.tgt_pltfrm: sql-database
17+
ms.workload: database
18+
ms.date: 6/19/2017
19+
ms.author: edmacauley
20+
---
21+
22+
# Install SQL Server on SUSE Linux Enterprise Server
23+
24+
This sample Bash script installs SQL Server 2017 CTP 2.1 on SUSE Linux Enterprise Server (SLES) v12 SP2 without interactive input.
25+
26+
> [!NOTE]
27+
> SQL Server 2017 CTP 2.1 requires libsss_nss_idmap0, which is not provided by the default SLES repositories. You can install it from the SLES v12 SP2 SDK.
28+
29+
> You need at least 3.25 GB of memory to run SQL Server on Linux. Also, the file system must be **XFS** or **EXT4**. Other file systems, such as **BTRFS**, are unsupported. For other system requirements, see [System requirements for SQL Server on Linux](sql-server-linux-setup.md#system).
30+
31+
## Sample script
32+
33+
```bash
34+
#!/bin/bash
35+
36+
# Use the following variables to control your install:
37+
38+
# Password for the SA user (required)
39+
SA_PASSWORD='<YourStrong!Passw0rd>'
40+
41+
# Install SQL Server Agent (recommended)
42+
SQL_INSTALL_AGENT='y'
43+
44+
# Install SQL Server Full Text Search (optional)
45+
# SQL_INSTALL_FULLTEXT='y'
46+
47+
# Create an additional user with sysadmin privileges (optional)
48+
# SQL_INSTALL_USER='<Username>'
49+
# SQL_INSTALL_USER_PASSWORD='<YourStrong!Passw0rd>'
50+
51+
if [ -z $SA_PASSWORD ]
52+
then
53+
echo Environment variable SA_PASSWORD must be set for unattended install
54+
exit 1
55+
fi
56+
57+
echo Adding Microsoft repositories...
58+
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server.repo
59+
sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/prod.repo
60+
sudo zypper --gpg-auto-import-keys refresh
61+
62+
echo Installing SQL Server...
63+
sudo zypper install -y mssql-server
64+
65+
echo Running mssql-conf setup...
66+
sudo SA_PASSWORD=$SA_PASSWORD \
67+
/opt/mssql/bin/mssql-conf -n setup accept-eula
68+
69+
echo Installing mssql-tools and unixODBC developer...
70+
sudo ACCEPT_EULA=Y zypper install -y mssql-tools unixODBC-devel
71+
72+
# Add SQL Server tools to the path by default:
73+
echo Adding SQL Server tools to your path...
74+
echo PATH="$PATH:/opt/mssql-tools/bin" >> ~/.bash_profile
75+
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
76+
77+
# Optional SQL Server Agent installation:
78+
if [ ! -z $SQL_INSTALL_AGENT ]
79+
then
80+
echo Installing SQL Server Agent...
81+
sudo zypper install -y mssql-server-agent
82+
fi
83+
84+
# Optional SQL Server Full Text Search installation:
85+
if [ ! -z $SQL_INSTALL_FULLTEXT ]
86+
then
87+
echo Installing SQL Server Full-Text Search...
88+
sudo zypper install -y mssql-server-fts
89+
fi
90+
91+
# Configure firewall to allow TCP port 1433:
92+
echo Configuring SuSEfirewall2 to allow traffic on port 1433...
93+
sudo SuSEfirewall2 open INT TCP 1433
94+
sudo SuSEfirewall2 stop
95+
sudo SuSEfirewall2 start
96+
97+
# Example of setting post-installation configuration options
98+
# Set trace flags 1204 and 1222 for deadlock tracing:
99+
echo Setting trace flags...
100+
sudo /opt/mssql/bin/mssql-conf traceflag 1204 1222 on
101+
102+
# Restart SQL Server after making configuration changes:
103+
echo Restarting SQL Server...
104+
sudo systemctl restart mssql-server
105+
106+
# Connect to server and get the version:
107+
counter=1
108+
errstatus=1
109+
while [ $counter -le 5 ] && [ $errstatus = 1 ]
110+
do
111+
echo Waiting for SQL Server to start...
112+
sleep 5s
113+
/opt/mssql-tools/bin/sqlcmd \
114+
-S localhost \
115+
-U SA \
116+
-P $SA_PASSWORD \
117+
-Q "SELECT @@VERSION" 2>/dev/null
118+
errstatus=$?
119+
((counter++))
120+
done
121+
122+
# Display error if connection failed:
123+
if [ $errstatus = 1 ]
124+
then
125+
echo Cannot connect to SQL Server, installation aborted
126+
exit $errstatus
127+
fi
128+
129+
# Optional new user creation:
130+
if [ ! -z $SQL_INSTALL_USER ] && [ ! -z $SQL_INSTALL_USER_PASSWORD ]
131+
then
132+
echo Creating user $SQL_INSTALL_USER
133+
/opt/mssql-tools/bin/sqlcmd \
134+
-S localhost \
135+
-U SA \
136+
-P $SA_PASSWORD \
137+
-Q "CREATE LOGIN [$SQL_INSTALL_USER] WITH PASSWORD=N'$SQL_INSTALL_USER_PASSWORD', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=ON, CHECK_POLICY=ON; ALTER SERVER ROLE [sysadmin] ADD MEMBER [$SQL_INSTALL_USER]"
138+
fi
139+
140+
echo Done!
141+
```
142+
143+
## Next steps
144+
145+
Simplify your unattended installs by creating a Bash script that sets the proper environment variables, instead of doing it inline.
146+
147+
```bash
148+
#!/bin/bash
149+
export SA_PASSWORD='<YourStrong!Passw0rd>'
150+
export SQL_INSTALL_AGENT='y'
151+
export SQL_INSTALL_USER='<Username>'
152+
export SQL_INSTALL_USER_PASSWORD='<YourStrong!Passw0rd>'
153+
```
154+
155+
For more information about SQL Server on Linux, see [SQL Server on Linux overview](sql-server-linux-overview.md).

0 commit comments

Comments
 (0)