Muokkaa

Jaa


Install SQL Server Agent on Linux

Applies to: SQL Server - Linux

This article describes how to enable or install the SQL Server Agent on Linux.

The SQL Server Agent runs scheduled SQL Server jobs. Starting with SQL Server 2017 (14.x) CU 4, SQL Server Agent is included with the mssql-server package and is disabled by default. For information on the features supported for this release of the SQL Server Agent along with version information, see Release notes for SQL Server 2017 on Linux.

Instructions

Before using the SQL Server Agent on Linux, use the following steps to enable or install it.

  1. Add your hostname (with and without domain) in the /etc/hosts files. The following lines show an example of the format for these entries:

    "IP Address" "hostname"
    "IP Address" "hostname.domain.com"
    
  2. Follow the instructions in one of the following sections based on your version of SQL Server:

    Versions Instructions
    SQL Server 2017 (14.x) CU 4 and later versions Enable the SQL Server Agent
    SQL Server 2017 (14.x) CU 3 and earlier versions Install the SQL Server Agent

Enable the SQL Server Agent

For SQL Server 2017 (14.x) CU 4 and later versions, you only need to enable the SQL Server Agent. You don't need to install a separate package.

To enable SQL Server Agent, follow these steps.

sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
sudo systemctl restart mssql-server

If you upgrade from SQL Server 2017 (14.x) CU 3 or an earlier version with Agent installed, SQL Server Agent is enabled automatically, and previous Agent packages are uninstalled.

Note

SQL Server Management Studio Object Explorer doesn't display the contents of the SQL Server Agent node unless the Agent XPs (server configuration option) is enabled, regardless of the SQL Server Agent service state.

Install the SQL Server Agent

For SQL Server 2017 (14.x) CU 3 and earlier versions, you must install the SQL Server Agent package.

The following installation instructions apply to SQL Server 2017 (14.x) CU 3 and earlier versions only. Before you install SQL Server Agent, first install SQL Server, which configures the keys and repositories you need when you install the mssql-server-agent package.

Install the SQL Server Agent for your platform.

Use the following steps to install the mssql-server-agent on Red Hat Enterprise Linux.

sudo yum install mssql-server-agent
sudo systemctl restart mssql-server

If mssql-server-agent is installed, you can update to the latest version with the following commands:

sudo yum check-update
sudo yum update mssql-server-agent
sudo systemctl restart mssql-server

If you need an offline installation, locate the SQL Server Agent package download in the Release notes for SQL Server 2017 on Linux. Then use the same offline installation steps described in the article Install SQL Server.