This post explains you in detail (step by step) about how to install SQL Server and SQL CMD tools in Red Hat Enterprise Linux 7.2.
Azure Virtual Machine Template “SQL Server vNext on Red Hat Enterprise Linux 7.2” has been used for this demo.
Go to Azure Virtual Machine and click “Add”, it will open a window where you can choose the SQL Server vNext on Linux template.
Check the information on the below page as it has the command to configure and start SQL Server.
Configure the VM as usual, check the “Authentication type”. It has two options. I am going to choose Password for this demo.
Fill the other details and create a virtual machine.
It will take some time to configure the Linux machine. Once the deployment is done, then you can access the machine.
Since this is Linux machine, Azure gave us a connection IP address. I am using “PuTTY” (command line tool) to access this machine.
Download and install the PuTTY Software from here.
Once installed PuTTY, open and pass the IP address and click Open. You can save the host as new session and can load and open for next time.
Login with the username and password that you defined while creating the virtual machine.
Enter the below command to install and configure SQL Server.
It will ask password to proceed further and also need to confirm the license.
Next step is to set up the SA admin password for SQL Server. Setup will be completed after this step.
Check the status of the service.
systemctl status mssql-server
As we need to run the SQL scripts in command line, we need to install the SQL CMD tools. To install, you need to go to the root directory.
#Install SQL Cmd tools
Run the below commands to get the file and exit from root.
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
Run the below command to install
sudo yum install mssql-tools
Once the tool is successfully installed. You can see the success message.
Open command to start type the SQL commands.
Pass the SA credentials. We are going to access with SQL Server authentication mode.
sqlcmd -S localhost -U SA –P ‘SA Password’
Type the SQL Script and end with GO.