By: Manvendra Singh | Last Updated: 2017-07-17 | Comments | SQL Server on Linux
In a previous tip, I explained how to install SQL Server vNext on Red Hat Linux. In this tip, I will explain how to install SQL Server Agent on a Linux server, so we can create SQL Server jobs to schedule repetitive work.
Follow the steps below to setup SQL Server Agent.
SQL Server Agent Installation on Red Hat Linux
Before going ahead, you need to have SQL Server vNext running on Linux where we will install SQL Server Agent. Check out this tip for more information: Installing SQL Server vNext CTP1 on Red Hat Linux 7.2.
Step 1: First, connect to the Linux Server either using PUTTY or directly login to the server using valid credentials. I used PuTTY to connect to the server.
You can see we have connected to our target machine where we are going to install SQL Server Agent.
Step 2: As per Microsoft, we need to have SQL Server CTP 1.4 or later installed for SQL Server Agent. On this machine we are still on CTP1.1, so first we need to upgrade which will configure the keys and repositories that we will use to install the mssql-server-agent package. Let's check the existing version of SQL Server installed on this Linux server.
Step 3: Above we can see the version installed on this server is CTP 1.1, so now we will start the upgrade process to bring this SQL Server to CTP1.4 in order to install SQL Server Agent.
Next we will run "sudo yum update mssql-server" command to upgrade the SQL Server package to a newer version. If you want to understand the SQL Server upgrade process, you can follow this tip to upgrade your SQL Server to the latest version.
Run the below command to update the source list.
#upgrade SQL Server sudo yum update mssql-server
Execution will start to update the SQL Server vNext version as shown in the below image. You can see the latest package along with details.
Execution will ask you to enter y to proceed with the upgrade. Enter y to go ahead with the installation. You can see SQL Server upgrade has completed successfully as shown in the below image.
Now check the SQL Server version on this machine and we can see the version is now CTP 1.4.
Step 4: Now we will check the details about SQL Server Agent package mssql-server-agent.
Run "yum info mssql-server-agent" to see the package details.
#Check package details yum info mssql-server-agent
You can see this package is showing as "available package" in below image.
Step 5: Now we will install SQL Server Agent with the help of the above package.
Run the below command to start the SQL Server Agent package installation.
#Install SQL Server Agent sudo yum install mssql-server-agent
Once you execute the above command, installation will kick off. You can see the package details in the below image.
Once you get prompted to enter y/d/N to proceed with the installation, type y and press enter and the install will begin and should complete successfully.
Step 6: We need to restart the SQL Server service to complete the SQL Server Agent installation as suggested by the above execution.
Run the below command to restart the SQL Server service, once the service restarts we can check the SQL Server service status.
#Restart SQL Server service systemctl restart mssql-server #check the status of mssql-server service. systemctl status mssql-server
The SQL Server service status has been restarted as shown below. You are done with your SQL Server Agent installation on Linux. Now you can go ahead and configure SQL Server Agent Job on your Linux based SQL Server vNext installation.
Step 7: To validate the install, you can connect to the SQL Server instance using SSMS on a Windows machine and expand the SQL Server Agent folder. You should see all subfolders and you right click on "Jobs" and create a new job.
- Next step is to start configuring SQL Server Agent jobs as per your need.
- Follow my tip where I explained the steps to create SQL Server Jobs on Linux based SQL Server instances.
- Explore more knowledge with these SQL Server Database Administration Tips.
Last Updated: 2017-07-17
About the author
View all my tips