SQL Server on Red Hat Enterprise Linux--rhel (full screenshot)

Source: Internet
Author: User
Tags curl mssql free ssh management studio sql server management sql server management studio

This article starts from scratch and describes how to build SQL Server 2017 on Red Hat Enterprise Linux, including steps and methods for installing the system, installing SQL, etc. (for test learning only, basic article).

A Creating a Rhel System (create Red Hat Enterprise Linux System)

1. Prerequisite Preparation

Since this article focuses on the SQL Server 2017 build method on Linux, from install SQL Server on Linux, the current SQL Server CTP 2.1 for Red Hat Enterprise Linux only support 7 .3, so choose Rhel 7.3 for installation.

Because of the habit of building virtual machines on VMware ESXi Server, it is found in the VMware Compatibility Guide that the ESXi 5.1 U2 version above supports Rhel 7.x, so choose ESXi 6.0 to install red Hat Enterprise Linux 7.3.

2. Create a virtual machine

Create an empty virtual machine to install Rhel 7.3 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.

Reference: Https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup.

3. Install red Hat Enterprise Linux 7.3

Official Installation Guide: http://partnerweb.vmware.com/GOSIG/RHEL_7.html.

The steps are as follows:

A) Edit the virtual machine settings (edit Settings ... ), add the Rhel installation ISO file to the CD/DVD drive, tick connect at power on to confirm the boot.

b) switch to the console window and select Install Red Hat Enterprise Linux 7.3.

c) There may be a black screen does not respond to the situation, re-close the vsphere client to open the Console window (or right-click on the virtual machine Open console), the following interface click Continue.

d) in the installation Summary page from top to bottom one by one (not described please according to your own needs or choose the default option). If you set date & time Click Done.

e) Note that the software selection can be set in the default basic environment, the general minimum installation, if you need special server installation special can. We develop tests that recommend the server with GUI, which comes with a graphical interface, and automatically includes the installation of open VMware tools by default.

f) for Kdump, can be disabled.

g) NETWORK & HOST NAME. For network recommendation settings, if there is a DHCP server in the environment, turn on the network, or manually set the static IP.

Note that setting the host name here is best not to exceed 15 characters, otherwise it may be possible to truncate the machine name if it is not supported, such as configuring SQL AG https://docs.microsoft.com/en-us/sql/linux/ Sql-server-linux-availability-group-configure-ha, you can also edit the/etc/hostname file changes after the installation is complete if you have already set the extra length.

h) SECURITY Policy select Default.

i) Click Begin installation to start the installation. Set the root account password and create a new account during the installation process.

Note If the password is a weak password, you need to click Done two times to save the success.

Create a new user and set up as an administrator

j) All set to wait for installation to complete.

k) Click Reboot. The CD/DVD drive ISO file can be ejected later.

Need to accept license. Click Finish configuration.

4. Optimized Rhel system operation

· Resolve an issue where the default source cannot be used without registration

Under normal circumstances, you need to purchase a subscription to use the RHEL system. Our own study for the purpose of studying, here is a way to test the use of Yum sources without registering: Replace the default yum for Red Hat Enterprise Linux with CentOS (CentOS and Rhel are basically no different, And CentOS is open source has been acquired by Rhel, this method can only be used for testing.

A) Enter Super User mode:

sudo su

b) View the installed Yum and uninstall the Yum and related packages for the original Rhel:

grep Yum  grepyumxargs rpm-e--nodeps

c) Download the relevant CentOS software package:

wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
wget http://mirrors.163.com/centos/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

d) Install packages (some packages have dependencies, so it's best to install them together):

RPM-IVH *.rpm

e) Go to the Yum profile directory and download the CentOS config file, and finally change the $releasever to 7 (you can also manually edit the $releasever to change each of the 7):

cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
sed -i "s/\$releasever/7/g" CentOS7-Base-163.repo

f) Empty and update the Yum cache:

Yum  Clean All Yum Makecache

g) After the Yum has been replaced, you can install the Epel source by executing the following command:

sudo Yum Install Epel-release

Note: Sometimes it is possible that a source server is not available, you need to manually replace or add a source, you can query the source status through this site: http://mirror-status.centos.org/#cn.

· Reminder of the removal of unregistered information (remove the information of registered to Red Hat Subscription Management)

If you do not have a system registered, you will often get the reminder "This system isn't registered to Red Hat Subscription Management. You can use the Subscription-manager to register ".

Execute the following command to remove the registration prompt:

A) View the subscription related packages that are already in the environment:

Yum grep Subscription

b) Remove the Subscription-manager package:

sudo Yum Remove Subscription-manager

· Troubleshooting issues with the RHEL system from Windows remote connection

Due to the frequent use of Windows, I now find two more convenient ways to connect the RHEL system from Windows remote operation. One is the use of the Xshell tool (free SSH client), you can directly use the SZ and RZ commands for the transfer between Windows and Linux system files. In addition, a VNC Server is built so that you can use VNC Client for remote connection operations on Windows, similar to Remote Desktop connections in Windows. The steps to build a VNC server on Rhel 7 are as follows:

A) Enter Super User mode:

sudo su

b) Install Gnome Desktop:

Yum " GNOME Desktop " " Graphical administration Tools "

c) Install Tigervnc server and X11 fonts:

Yum Install tigervnc-server xorg-x11-fonts-type1

d) Copy the configuration file and change the <USER> field to True USER Name:

cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:5.service
vi /etc/systemd/system/[email protected]:5.service

Before the change:

After the change:

e) Open firewall port:


f) Exit Super User mode, turn on VNC server and set the password:


g) Enter super User mode and reload daemon

sudo su systemctl Daemon-reload

h) Turn on the service and set it to boot

Systemctl start [email protected]:5. servicesystemctl enable [email protected]:5. Service

i) Connect using VNC Client, note that you need to add the port number or that you set earlier.


    • The VNC client can be downloaded from here.
    • Reference Document: Https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide /ch-tigervnc.html#sec-vnc-installation.

Two Installing SQL Server (Install SQL Server)

1. Installing SQL Server

Official Installation Guide: Https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-red-hat.

The installation steps are as follows:

A) go to Super User mode:

sudo su

b) Download the Microsoft SQL Server Red Hat repository configuration file:

Curl https://Packages.microsoft.com/config/rhel/7/mssql-server.repo >/etc/yum.repos.d/ Mssql-server.repo

c) Install SQL Server:

Yum Install -y mssql-server

d) Initialize the SQL Server configuration:

/opt/mssql/bin/mssql-conf Setup

e) Confirm the status of the SQL Server service:

Systemctl Status Mssql-server

f) Set up the firewall to open the SQL Server service port:


g) exit the Super Admin mode:


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#RHEL.

The specific installation mssql-tools steps are as follows:

A) go to Super User mode:

sudo su

b) Download the Microsoft SQL Server Red Hat repository configuration file:

Curl https://Packages.microsoft.com/config/rhel/7/prod.repo >/etc/yum.repos.d/msprod.repo

c) If Mssql-tools is installed, first uninstall the original UNIXODBC package:

Yum Update Yum Remove Unixodbc-utf16 unixodbc-utf16-devel

d) Install Mssql-tools

Yum Update Yum Install mssql-tools unixodbc-devel

If you experience a situation that is not installed, it may be because the latest update package is incompatible with the current system or the latest update package is unstable, you can install the specified version (only for Rhel 7) by executing the following command:

Yum Install msodbcsql-13.0. 1.0-1 mssql-tools-14.0. 2.0-1yuminstall unixodbc-utf16-devel

Other System version Resolution command reference: https://blogs.msdn.microsoft.com/sqlnativeclient/2016/10/20/odbc-driver-13-0-for-linux-released/ comment-page-2/.

e) 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_profile
echo ‘export PATH="$PATH:/opt/mssql-tools/bin"‘ >> ~/.bashrc
source ~/.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.

f) The SQLCMD tool can be used after the installation is complete.

For the use of SQLCMD, refer to: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility.

[Original articles, reproduced please indicate the source, for study purposes only, if there are errors please leave a message, thank you for your support]

SQL Server on Red Hat Enterprise Linux--rhel (full)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.