This article starts with a zero-step step through how to build SQL Server 2017 on Ubuntu, including steps and methods for installing the system, installing SQL, etc. (for test learning only, basic article).
A Creating Ubuntu Systems (create Ubuntu System)
1. Prerequisite Preparation
Because this article mainly studies the SQL Server 2017 constructs the method on the Linux, from install SQL Server on Linux to know the current SQL Server CTP 2.0 for Ubuntu system support 16.04 and 16.10, while the 16.04 version can be downloaded directly, so choose Ubuntu 16.04 for installation.
Because of the habit of building virtual machines on VMware ESXi Server, the VMware Compatibility Guide found that ESXi 16.04 was supported in the 5.5 or more versions of the release, so choose ESXi 6.0 to install Ubuntu 16.04.
2. Create a virtual machine
Create an empty virtual machine to install Ubuntu 16.04 just as you would normally install virtual machines on VMware. Here are some things to note:
- If you want to use SQL Server, memory at least 3.25GB or more;
- If you want to use SQL Server, the file system must be XFS or EXT4, and others such as Btrfs are not supported.
3. Install Ubuntu 16.04
Official Installation Guide: http://partnerweb.vmware.com/GOSIG/Ubuntu_16_04_LTS.html.
The specific steps are as follows:
A) Edit the virtual machine settings (edit Settings ... ), add the Ubuntu installation ISO file to the CD/DVD drive, tick connect at power on, and confirm the boot.
b) switch to the console window, the following interface appears:
c) Set up the network first to install the update directly, etc.:
d) Select Install updates and related drivers:
e) Choose the type of installation, without special requirements, the default is:
f) Set the time zone:
g) Set the keyboard, where the window may be too large, with the mouse to drag back and forth to select continue can:
h) Set the user:
i) wait for the installation:
j) Click Restart Now to complete the installation:
K) after disconnecting the CD/DVD drive ISO file, click Enter:
L) Just wait a little while and enter the password to get in the system:
4. Optimize operation of Ubuntu system
A) Install open VM tools to make it easier to use Ubuntu
Based on the recommendation of the VMware Official installation documentation, open VM Tools is installed here to harden the use of Ubuntu (sometimes just after Ubuntu is installed, the system resolution cannot be adjusted and the open-vm-tools-desktop can be resolved):
sudo install open-vm-toolssudoinstall
b) How to remotely operate Ubuntu system from windows
Because the host working environment is windows, the Ubuntu system may often be operated remotely from Windows.
I have now found two more convenient ways to connect Ubuntu systems from Windows remote operations. One is the use of the Xshell tool (free SSH client), and the second is the use of VNC client.
- Leveraging the Xshell SSH client
Because the default Ubuntu does not have SSH server installed, using the following command to install the SSH server, the normal use of the Xshell tool via SSH connection operation Ubuntu, while you can directly use the SZ and RZ commands between Windows and Linux system files transfer.
sudo apt-get updatesudoinstall openssh-serversudo Install Lrzsz
Download and upload files using RZ and sz:
- Use the VNC server client so that you can use VNC Client for remote connection operations on Windows, similar to Remote Desktop Connection in Windows. The steps to set up VNC server on Ubuntu are as follows:
Ubuntu Desktop automatically has a tool called Desktop Sharing:
After starting the tool, you can set the relevant options according to your own needs, set the shutdown can be:
If you encounter this error during the use of the VNC client connection "Server did not have offer supported security type", you need to disable encryption: first install dconf Editor (sudo apt install dconf-ed Itor), and then start dconf Editor, org, GNOME, desktop---remote-access, deselect require-encryption.
c) vi editor up and down around the problem of ABCD to solve
Install Vim by executing the following command in turn:
sudo apt-get remove vim-commonsudoinstall vim
Two Installing SQL Server (Install SQL Server)
1. Installing SQL Server
Official website Installation Guide: Https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ubuntu.
The installation steps are as follows:
A) Install the Curl package:
sudo Install Curl
b) Import the Repository gpg key and the SQL Server Ubuntu installation Library:
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
c) Install SQL Server:
sudo apt-get updatesudoinstall -y mssql-server
d) Initialize the SQL Server configuration:
sudo /opt/mssql/bin/mssql-conf setup
e) Confirm the status of the SQL Server service:
Systemctl Status Mssql-server
f) Install the FIREWALLD Toolkit and set up the firewall to open the SQL Server service port:
sudo Install firewalldfirewall-cmd--zone=public--add-port=1433/tcp--permanentfirewall-cmd-- Reload
You can then use SQL Server Management Studio in Windows to connect to the database.
The default authentication method is SQL Server authentication, the default administrator user is the SA, and the password is the password that is set in the D step. From the view that the default path to the database is/var/opt/mssql/data/, this is the Linux path.
2. Installing SQL Server Tools
See the official installation documentation at: Https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#ubuntu.
The steps are as follows:
A) Import the Microsoft public GPG key and register the Microsoft Ubuntu installation Library:
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
b) Update the software source and install the SQL Server Kit:
sudo apt-get updatesudoinstall mssql-tools Unixodbc-dev
c) To add the installation directory to the Bash Shell environment variable in order to facilitate the use of sqlcmd in the future:
Echo ' export path= "$PATH:/opt/mssql-tools/bin" ' >> ~/bash_profileecho'export path= ' $PATH:/opt/mssql-tools/bin ' ' >> ~/~/.BASHRC
Note: Environment variables are user-level, and if the above command is executed under root, only the root user can use sqlcmd directly, and it is recommended that you execute it once and then exit after root.
D) The SQLCMD tool can be used when the installation is complete.
For the use of SQLCMD, refer to: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility.
SQL Server on Ubuntu--ubuntu (full)