Introduction

This document provides detailed instructions for installing Microsoft SQL Server. We cover installation for Windows, Linux, and Docker containers, offering flexibility for diverse development and production environments.

Before proceeding, ensure you have reviewed the Planning SQL Server Installation guide to understand system requirements, edition features, and licensing.

Supported Platforms

  • Windows: The traditional and most feature-rich installation experience.
  • Linux: Install SQL Server on popular Linux distributions like Ubuntu, Red Hat Enterprise Linux, and SUSE Enterprise Linux.
  • Docker Containers: Deploy SQL Server in lightweight, portable containers for consistent environments.

Installation Steps

1. Before You Begin

Essential pre-installation checks:

  • Review hardware and software requirements.
  • Download the appropriate SQL Server installation media (ISO, CAB, or container image).
  • Ensure you have the necessary administrative privileges.
  • Back up any existing databases if performing an upgrade or alongside an existing installation.

2. Installing on Windows

The Windows installation typically involves running the setup wizard. You can choose between a basic or custom installation.

  1. Run the setup.exe file from the installation media.
  2. Select "Installation" from the left-hand menu.
  3. Choose "New SQL Server stand-alone installation or add features to an existing installation."
  4. Follow the on-screen prompts, selecting your desired features, instance name, service accounts, and authentication modes.
Note: For silent installations on Windows, use the command-line options with setup.exe. Refer to the Command-Line Installation Guide for details.

3. Installing on Linux

Installation on Linux involves using package managers. The specific commands vary slightly by distribution.

For Ubuntu:


# Import the public repository GPG keys
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft SQL Server Ubuntu repository
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/mssql-server-2022.list)"

# Install SQL Server
sudo apt-get update
sudo apt-get install -y mssql-server

# Run the post-installation configuration script
sudo /opt/mssql/bin/mssql-conf setup
                

For Red Hat Enterprise Linux (RHEL):


# Register the Microsoft SQL Server RHEL repository
sudo curl -o /etc/yum.repos.d/mssql-server.repo 'https://packages.microsoft.com/config/rhel/$(rpm -E %{rhel})/mssql-server-2022.repo'

# Install SQL Server
sudo yum install -y mssql-server

# Run the post-installation configuration script
sudo /opt/mssql/bin/mssql-conf setup
                
Tip: After installation, verify the SQL Server service status with systemctl status mssql-server.

4. Installing using Docker

Docker provides a quick and isolated way to deploy SQL Server.


# Pull the latest SQL Server 2022 image
docker pull mcr.microsoft.com/mssql/server:2022-latest

# Run the SQL Server container
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=" \
   -p 1433:1433 --name sql_server_demo -d mcr.microsoft.com/mssql/server:2022-latest
                

Replace <YourStrongPassword!> with a strong password for the sa user.

Warning: For production deployments, consider using volume mapping for data persistence and more robust security configurations.

Post-Installation Tasks

After a successful installation, consider the following:

  • Connecting to the SQL Server instance using SQL Server Management Studio (SSMS) or Azure Data Studio.
  • Configuring firewall rules to allow remote connections if necessary.
  • Applying the latest cumulative updates and service packs.
  • Setting up SQL Server Agent for job scheduling.
  • Implementing security best practices, including creating specific user accounts and roles.

Troubleshooting Common Issues

If you encounter issues during installation:

  • Check the SQL Server error logs for detailed information. These are typically located in C:\Program Files\Microsoft SQL Server\NNN\Setup Bootstrap\Log on Windows or /var/opt/mssql/log on Linux.
  • Verify that all prerequisites and system requirements are met.
  • Ensure network connectivity and firewall configurations are correct.
  • Consult the official SQL Server documentation and community forums for solutions to known issues.

Next Steps

Once installed, you can proceed to: