Partager via


Unattended install and configuration for SQL Server 2017 on Linux

SQL 2017 bits are generally available to customers today. One of the most notable milestones in the 2017 release is SQL Server on Linux. Setup has been relatively simple for SQL Server on Linux, but often there are questions around unattended install. For SQL Server on Linux, there are several capabilities that are useful in unattended install scenarios:

  • You can specify environment variables prior to the install that are picked up by the install process, to enable customization of SQL Server settings such as TCP port, Data/Log directories, etc.
  • You can pass command line options to Setup.
  • You can create a script that installs SQL Server and then customizes parameters post-install with the mssql-conf

In SQL Server documentation, we have a sample of what an unattended install process would look like for specific distributions here.

Given multiple installs SQLCAT had to do as a part of working with early versions of SQL Server on Linux, multiple supported platforms, and some common post-install tasks, we created a sample script that would further ease the unattended install process, and would allow you to:

  • Have one script across multiple distributions
  • Choose the components installed (SQL Server, SQL Agent, SQL FTS, SQL HA)
  • Configure common install parameters via a config file
  • Set up some SQL Server on Linux best practices we have documented such as tempdb configuration and processor affinity, which are not part of the core install
  • Enable you to specify a custom post-install .sql file to run once SQL Server is installed

Note: If you choose to install HA components, for RHEL  have to enable subscription manager and add the right HA repository and for SLES you need to add the HA add-on. The configuration file has links to the documentation in both cases.

Here is how to use the unattended install script:

a. Download the script:

[code lang="bash"]
git clone https://github.com/denzilribeiro/sqlunattended.git
cd sqlunattended

b. To prevent sudo password prompts during unattended install:

[code lang="bash"]sudo chown root:root sqlunattended.sh
sudo chmod 4755 sqlunattended.sh

c. Modify the conf file to specify the configuration options required, including what components to install, data/log directories, etc. Here is a snippet from the sqlunattended.conf:

[code lang="bash"]
#Components to install
INSTALL_SQL_AGENT=YES
INSTALL_FULLTEXT=NO
INSTALL_HA=NO

# This will set SQL processor affinity for all CPUs, we have seen perf improvements doing that on Linux
SQL_CPU_AFFINITY=YES

# This creates 8 tempdb files if NumCPUS >=8, or as many tempdb files as there are CPUs if NumCPUS < 8
SQL_CONFIGURE_TEMPDB_FILES=YES
SQL_TEMPDB_DATA_FOLDER=/mnt/data
SQL_TEMPDB_LOG_FOLDER=/mnt/log
SQL_TEMPDB_DATA_FILE_SIZE_MB=500
SQL_TEMPDB_LOG_FILE_SIZE_MB=100

d. Run the unattended install

[code lang="bash"]
/bin/bash sqlunattended.sh

We hope that this will help to further simplify the customization of the install process. Your feedback is appreciated!

Comments

  • Anonymous
    October 03, 2017
    I have to update this old articlehttp://www.sqlservercentral.com/articles/The+Lighter+Side/sqlserveronlinux/1814/