Upgrading SQL Server running on Ubuntu to latest update

By:   |   Comments (1)   |   Related: > SQL Server on Linux


Problem

In a previous tip we described the installation steps to install SQL Server vNext CTP 1 on Ubuntu. In this tip we cover how to update an existing installation of SQL Server vNext running on Ubuntu.

Solution

In this tip we will walk through the steps to do an update.

Upgrading SQL Server vNext on Ubuntu

Before going ahead, you need to have SQL Server vNext CTP 1 running on Ubuntu and we will upgrade to CTP 1.1. I followed the step by step method Microsoft outlined in their documentation for this upgrade. Let's start the upgrade from SQL Server vNext CTP 1 to CTP 1.1 on Ubuntu.

Step 1:

I would recommend creating a full backup of all your user and system databases to keep a copy in case anything goes wrong with upgrade and we need to restore the databases. Since SQL Server vNext is still in the CTP phase, I assume you don't have anything critical running on this version so you can skip this step if you wish.

Step 2:

Now connect to Ubuntu server using PuTTY or by logging into the server locally. I connected to the Ubuntu server through PuTTY as shown in the below picture.

connect to ubuntu Server

Step 3:

Now we will check the existing version of the SQL Server vNext running on Ubuntu. Connect using the sqlcmd utility and execute the below command to get the version details.

#connect to SQL Server. Enter the sa password once you get the password prompt.
sqlcmd -S192.168.209.129 -Usa

#check installed version of SQL Server once connected to SQL Server.
SELECT @@VERSION
GO

We can see that the installed version of SQL Server vNext is 14.0.1.246 which is SQL Server vNext CTP 1.

check version

We can also check the details of the installed package mssql-server with the help of the "apt-get" command. The apt-get utility is a powerful and free package management command line program that is used to work with Ubuntu APT (Advanced Packaging Tool) library to perform installation of new software packages, removing existing software packages, upgrading of existing software packages and even used to upgrading the entire operating system. If you would like to check the information of the package along with a short description like version number, check sums, size, installed size, category, etc., use the show subcommand as shown below.

#check sql server package details
apt-cache show mssql-server

apt-get show mssql-server

Once we run "apt-get update" to resynchronize the package index files from their sources specified in /etc/apt/sources.list file, then the output of the above command will show all available updates. We can compare the above image with the one we will run post updating the source list of packages.

Step 4:

Now we will check the available updates of SQL Server through which we will upgrade the SQL Server. Although this is not a necessary step to perform, this will give you better a picture and help you understand the process of the upgrade. Run the below command to check updates.

#check available updates for SQL Server
apt-get --just-print upgrade

check updates of sql server

The above command will display all the available updates for all installed packages. We can see there are 72 upgrades to apply, mssql-server is one of them.

check updates of sql server

Step 5:

As we can see, our SQL Server has one pending update from the above step, so now we will run apt-get update to resynchronize the package index files from the their sources specified in /etc/apt/sources.list file. The update command fetched the packages from their locations and updates the packages to the newer version. Run the below command to update the source list.

#Run apt-get update to update the source list of package.
apt-get update mssql-server

update

Execution will start with a series of package updates. You can also see there are some updates from the Microsoft website for mssql-server package in the below image.

updates

Now we have updated the source list of packages, so we will check again all available updates by running the same command which we have executed in Step 4. We can see there are two packages shown in the below screenshot, one is the older version and the other is the new update which we have to apply to upgrade mssql-server.

check updates

Step 6:

Next we will apply the available update to upgrade SQL Server to bring it to the latest version. Run the below command to start the upgrade. The below command will download the newest package and replace the binaries located under /opt/mssql/. The user generated databases and system databases will not be affected by this operation, but make sure to keep a backup of everything hosted on your SQL Server to be safe.

#Upgrade SQL Server.
sudo apt-get install mssql-server

install updates

The package download process will start as shown in the above image. Once the download process is done, the upgrade will start. You can see the latest version of SQL Server once the upgrade completes.

install updates

Now your SQL Server has been upgraded from build version 14.0.1.246 (SQL Server VNext CTP 1) to 14.0.100.187 (SQL Server vNext CTP 1.1). We can verify it by executing the same command we used in Step 3. We can now see the SQL Server version has been updated to SQL Server vNext 14.0.100.187 (CTP1.1) in the below picture.

check SQL Server version
Next Steps
  • Go ahead and check the databases hosted on this instance to make sure everything is accessible post upgrade.
  • Continue to learn more about SQL Server vNext and stay tuned for more tips on this topic.
  • Read more tips about SQL Server on Linux.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Manvendra Singh Manvendra Singh has over 5 years of experience with SQL Server and has focused on Database Mirroring, Replication, Log Shipping, etc.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article




Sunday, July 5, 2020 - 12:29:41 PM - ELIAS ELIAS Back To Top (86087)

Manv, issuing sudo apt update mssql-server gives the following error

The update command takes no arguments















get free sql tips
agree to terms