Galaxy Kirin Server Operating System V10SP2 offline installation and uninstallation of SQL Server database

System environment

OS version: Galaxy Kirin Server Operating System V10SP2 (x86_64)
SQL Server version: SQL Server 2022

SQL Server installation package download

  1. Add the SQL Server database engine official Repo repository in a networked environment;
[root@localhost ~]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2022.repo
[root@localhost ~]# curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/8/prod.repo
  1. Download the SQL Server installation package, mssql-tools tool package, Microsoft ODBC driver and their dependencies;
[root@localhost ~]# mkdir mssql-server-packages
[root@localhost ~]# yum install mssql-server --downloadonly --downloaddir=/root/mssql-server-packages
[root@localhost ~]# yum install mssql-tools unixODBC-devel --downloadonly --downloaddir=/root/mssql-server-packages/

SQL Server offline installation

  1. Import the offline installation package downloaded above into the intranet server system and execute the installation;
[root@localhost ~]# cd mssql-server-packages/
[root@localhost mssql-server-packages]# ls
libatomic-7.3.0-20190804.35.p06.ky10.x86_64.rpm  mssql-server-16.0.1000.6-26.x86_64.rpm  unixODBC-devel-2.3.7-2.ky10.x86_64.rpm
msodbcsql17-17.10.2.1-1.x86_64.rpm               mssql-tools-17.10.1.1-1.x86_64.rpm
[root@localhost mssql-server-packages]# yum localinstall *.rpm

Insert image description here
Insert image description here
Insert image description here
2. Use "mssql-conf" to complete the SQL Server installation;

[root@localhost ~]# /opt/mssql/bin/mssql-conf setup

Insert image description here
Insert image description here
Insert image description here
Insert image description here
3. Verify the SQL Server service status;

[root@localhost ~]# systemctl status mssql-server.service

Insert image description here
4. Add /opt/mssql-tools/bin/ to the PATH environment variable in the bash shell so that we can directly use the sqlcmd and bcp tools; Note: The
mssql-tools package contains sqlcmd (command line query utility) and bcp (batch Import-Export Utility).

[root@localhost ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
[root@localhost ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
[root@localhost ~]# source ~/.bashrc
  1. Use the sqlcmd command to connect to the SQL Server database;
[root@localhost ~]# sqlcmd -S localhost -U SA

Insert image description here
6. Configure the system firewall to allow the remote end to connect to the current SQL Server database (the default port is TCP 1433);

[root@localhost ~]# firewall-cmd --zone=public --add-port=1433/tcp --permanent
[root@localhost ~]# firewall-cmd --reload

Insert image description here

SQL Server uninstall

  1. Delete component packages such as mssql-server and mssql-tools in the system;
[root@localhost ~]# yum remove mssql-server mssql-tools unixODBC-devel msodbcsql17

Insert image description here
2. Delete the generated database file;

[root@localhost ~]# rm -rf /var/opt/mssql/

Guess you like

Origin blog.csdn.net/ShenSeKyun/article/details/128347799