SQL Server on Linux
上QQ阅读APP看书,第一时间看更新

SQL Server installation on Kubuntu

The installation procedure on Kubuntu is identical to that in Ubuntu 16.04 and 16.10, which are officially supported by Microsoft. Kubuntu and Ubuntu share the same version numbering. My installation example is based on Kubuntu 16.10.

The whole installation procedure is command line-based. It means that you will be required to use bash.

If you want to start installation, you will need minimum 3.25GB of memory to run SQL Server on Linux.

The following are the steps to install SQL Server on Linux on Kubuntu:

  1. The first step is to add GPG keys and register SQL Server Ubuntu repository:
        # curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee
/etc/apt/sources.list.d/mssql-server.list
  1. Run the following two commands to install SQL Server. The first one is to refresh the packages list and the second one to start setting up:
        # sudo apt-get update
# sudo apt-get install -y mssql-server
  1. After the installation is over, you can run the mssql-conf setup and follow the procedure. For the sake of security, you need to specify a strong password for the sa account. The minimum length is eight characters, a combination of uppercase and lowercase letters, 10 digits, and/or non-alphanumeric symbols:
        # sudo /opt/mssql/bin/mssql-conf setup  
  1. Now is the time to check the status of the SQL Server service:
        # systemctl status mssql-server  
  1. In case you need to upgrade the already installed binaries to the new version, you should write two commands. The first one is to refresh the packages list and the second one to start the upgrade procedure:
        # sudo apt-get update
# sudo apt-get install mssql-server
  1. If you wish to remove the SQL Server from your Linux distribution, write the next bash command:
        # sudo apt-get remove mssql-server  
The upgrade process will not affect user and system databases that are located in /opt/mssql/. On the other hand, step 6 will not delete user and system database located in: /var/opt/mssql; you should delete them manually.
  1. Before installing the tool components, we need to import public GPG keys and register the Microsoft Ubuntu repository with the following commands:
        # curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee
/etc/apt/sources.list.d/msprod.list
  1. To install mssql-tools with the necessary unixODBC developer package, type the following command:
        # sudo apt-get update 
# sudo apt-get install mssql-tools unixodbc-dev
  1. In case you want to update only tools for the new version, run these two commands:
        # sudo apt-get update 
# sudo apt-get install mssql-tools
  1. Now you will need to modify your PATH environment variable. The following two commands are referenced for running the sqlcmd and bpc command-line tools:
        # echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# source ~/.bashrc
  1. As in the openSUSE scenario, you need to test the client tools. You can type the same command:
        # sqlcmd