Install Microsoft SQL Server 2019 on Rocky Linux 8
2022/7/7 2:20:20
本文主要是介绍Install Microsoft SQL Server 2019 on Rocky Linux 8,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Install Microsoft SQL Server 2019 on Rocky Linux 8
Step 1: Install Microsoft SQL Server 2019
$ sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2019.repo
This will download SQL Server 2019 repository to /etc/yum.repos.d/mssql-server.repo
Update your system cache:
$ sudo yum makecache
Then install SQL server 2019
$ sudo yum install -y mssql-server
$ rpm -qi mssql-server
Name : mssql-server
Version : 15.0.4223.1
Release : 2
Architecture: x86_64
Install Date: Tue May 17 08:22:16 2022
Group : Unspecified
Size : 1297034956
License : Commercial
Signature : RSA/SHA256, Mon Apr 18 20:46:17 2022, Key ID eb3e94adbe1229cf
Source RPM : mssql-server-15.0.4223.1-2.src.rpm
Build Date : Mon Apr 18 20:05:17 2022
Build Host : 17a94b24c000000.qzwxqe3wa2kubparrevzc0ivhc.xx.internal.cloudapp.net
...
Step 2: Initialize MS SQL Database Engine
After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.
$ sudo /opt/mssql/bin/mssql-conf setup
- Select an edition you’d like to use
Choose an edition of SQL Server:
- Evaluation (free, no production use rights, 180-day limit)
- Developer (free, no production use rights)
- Express (free)
- Web (PAID)
- Standard (PAID)
- Enterprise (PAID)
- Enterprise Core (PAID)
- I bought a license through a retail sales channel and have a product key to enter.
For me. I’ll go with 2 – Developer (free, no production use rights).
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348
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.
Enter your edition(1-8): 2
2. Accept the 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=855862&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
3. Set SQL Server system administrator password
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.
Step 3: Install SQL Server command-line tools
Then install mssql-tools with the unixODBC developer package. Add the repository containing required packages using the next command:
$ sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
With the repository added, we can proceed to install the tools
$ sudo yum -y install mssql-tools unixODBC-devel
Accept license terms as directed during installation:
The license terms for this product can be downloaded from
https://aka.ms/odbc17eula and found in
/usr/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
Installing : msodbcsql17-17.9.1.1-1.x86_64 2/4
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
Step 4: Start and enable mssql-server service
Start mssql-server service
$ sudo systemctl start mssql-server
Enable it to start on system boot:
$ sudo systemctl enable mssql-server
Add /opt/mssql/bin/ to your $PATH variable:
$ echo 'export PATH=$PATH:/opt/mssql/bin:/opt/mssql-tools/bin' | sudo tee /etc/profile.d/mssql.sh
Source the file to start using MS SQL executable binaries in your current shell session:
$ source /etc/profile.d/mssql.sh
If you have an active Firewalld service, allow SQL Server ports for remote hosts to connect:
$ sudo firewall-cmd --add-port=1433/tcp --permanent
$ sudo firewall-cmd --reload
Step 4: Test SQL Server
Connect to the SQL Server and verify it is working.
$ sqlcmd -S localhost -U SA
Password:
Authenticate with the password set in Step 2.
Show Database users:
1> select name from sysusers;
2> go
name
MS_AgentSigningCertificate##
MS_PolicyEventProcessingLogin##
db_accessadmin
db_backupoperator
db_datareader
db_datawriter
db_ddladmin
db_denydatareader
db_denydatawriter
db_owner
db_securityadmin
dbo
guest
INFORMATION_SCHEMA
public
sys
(16 rows affected)
Create a test database:
Create new
CREATE DATABASE mytestDB
SELECT Name from sys.Databases
GO
USE mytestDB
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
GO
SELECT * FROM Inventory LIMIT 1;
Show databases on the SQL Server.
1> select name,database_id from sys.databases;
2> go
Drop a database:
1> drop database mytestDB;
2> go
这篇关于Install Microsoft SQL Server 2019 on Rocky Linux 8的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-01-08Docker下的SqlServer发布订阅启用
- 2023-06-05Docker安装MS SQL Server并使用Navicat远程连接
- 2023-05-25深入浅出 SQL Server CDC 数据同步
- 2023-05-12通过空间占用和执行计划了解SQL Server的行存储索引
- 2023-04-24以SQLserver为例的Dapper详细讲解
- 2022-11-30SQL server高级函数查询
- 2022-11-26SQL SERVER数据库服务器CPU不能全部利用原因分析
- 2022-11-21SQL Server 时间算差值/常用函数
- 2022-11-20调试Archery连接SQL Server提示驱动错误
- 2022-10-22SQL Server 完整、差异备份+完整、差异还原(详细讲解,规避错误)