Microsoft SQL Server 2022 is the latest stable release of SQL Server database management system developed by Microsoft. The company announced SQL Server 2022 general availability on November 16, 2022. The software is available for download to customers with SQL on Enterprise Agreement (EA), Enterprise Agreement Subscription (EAS), and Server and Cloud Enrollment (SCE) programs.
This release is the most Azure-enabled SQL Server yet, with continued innovation across performance, security, and availability. Microsoft SQL Server 2022 is considered the core element of the Microsoft Intelligent Data Platform which enables customers to adapt in real-time, add layers of intelligence to their dynamic applications while unlocking fast and predictive insights.
In this article we shall perform installation of SQL Server 2022, and configure free editions (Developer, Express) which are available to download. These editions of SQL server can be run on Windows or Linux operating system. If you’re interested in installation on Ubuntu Linux check out the article in the link below:
Install Microsoft SQL Server 2022 on Rocky Linux 8 / AlmaLinux 8
For this setup you’ll need RHEL 8 based Linux system such as Rocky Linux 8 / AlmaLinux 8 or CentOS Stream 8 machine with at least 2 GB of memory.
Step 1 – Update System
As a rule of thumb, we update our system before installing SQL server or any other package on the system. This can be achieved by executing the commands given below.
sudo dnf -y update
If you have kernel related updates it’s a prudent idea to reboot the system.
sudo systemctl reboot
Step 2 – Add Microsoft SQL Server YUM Repository
At the time of updating this article, SQL Server 2022 is supported on Red Hat Enterprise Linux (RHEL) 8 based systems. We need to configure the repository before installation.
Create a new file under /etc/yum.repos.d
directory
sudo vi /etc/yum.repos.d/mssql-server-2022.repo
Paste the contents below into the file.
[mssql-server]
name=Microsoft SQL Server Repo
baseurl=https://packages.microsoft.com/rhel/8/mssql-server-2022/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
Clean your RPM repos cache.
sudo dnf clean all
Update cache to confirm it works.
$ sudo dnf makecache
Rocky Linux 8 - AppStream 13 MB/s | 9.9 MB 00:00
Rocky Linux 8 - BaseOS 9.6 MB/s | 4.9 MB 00:00
Rocky Linux 8 - Extras 32 kB/s | 12 kB 00:00
Microsoft SQL Server Repo 20 kB/s | 6.9 kB 00:00
Metadata cache created.
Step 3 – Install SQL Server 2022 on Rocky / AlmaLinux 8
Having configured the repository, run the following command to install SQL Server 2022 on Rocky Linux 8 / AlmaLinux 8.
sudo dnf install mssql-server
The dependencies are automatically installed.
.....
Transaction Summary
======================================================================================================================================================================================================
Install 27 Packages
Total download size: 312 M
Installed size: 1.4 G
Is this ok [y/N]: y
Step 4 – Configure Microsoft SQL Server
After the package is installed, run mssql-conf setup
to set the SA password and choose your SQL server edition. As a reminder, the following SQL Server editions are freely licensed: Evaluation, Developer, and Express.
Choose an edition of SQL Server:
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.
9) Standard (Billed through Azure) - Use pay-as-you-go billing through Azure.
10) Enterprise Core (Billed through Azure) - Use pay-as-you-go billing through Azure.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409
Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.
By choosing an edition billed Pay-As-You-Go through Azure, you are verifying
that the server and SQL Server will be connected to Azure by installing the
management agent and Azure extension for SQL Server.
Enter your edition(1-10): 3
Agree to License Terms:
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Do you accept the license terms? [Yes/No]: Yes
Configure strong password for SQL Server system administrative (SA) account. For this you need a minimum length 8 characters, including uppercase and lowercase letters, base-10 digits and/or non-alphanumeric symbols.
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
If configuration is successful you should get output similar to one below.
The licensing PID was successfully processed. The new edition is [Express Edition].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
If remote connections to SQL server is a requirement in your environment you should allow SQL Server TCP port 1433 in your firewall.
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload
Step 5 – Install SQL server command-line tools
The main SQL Server command-line tools are sqlcmd and bcp. Setup repository which contains the packages required.
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
Install mssql-tools with the unixODBC developer package using the following commands:
sudo dnf install -y mssql-tools unixODBC-devel
Next we add /opt/mssql-tools/bin/
to our PATH
environment variable
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
Step 6 – Connecting to SQL server using sqlcmd
To connect to the database server from command line use sqlcmd command. Parameters to be used are:
- -S : Specify SQL Server name
- -U : Specify username
- -P : Providing user password
In our example we’re connecting locally, so the server name is localhost. The user name is sa and the password is the one you provided for the SA account during setup.
sqlcmd -S localhost -U sa -P '<YourPassword>'
If you omit the password on the command line you’ll be prompted to enter it.
sqlcmd -S localhost -U sa
If the connection is successful you’ll get to a sqlcmd command prompt: 1>
. From here you can create databases, database users, and begin to insert data.
Conclusion
Microsoft SQL Server is a powerful database management system that offers a range of new features and enhancements designed to improve performance, scalability, security, and availability. By taking advantage of these features you can achieve better overall database performance and better meet your business database demands. If you encounter any issues during the setup feel free to reach out to us.