Linux SQLServer安装
linux下安装sqlserver数据库使用rpm安装包安装
rpm安装地址为:https://packages.microsoft.com/rhel/7/mssql-server-2017/
1、安装依赖
# yum install -y libatomic gdb libsss_nss_idmap cyrus-sasl cyrus-sasl-gssapi
2、安装
# rpm -ivh mssql-server-14.0.3430.2-1.x86_64.rpm warning: mssql-server-14.0.3430.2-1.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mssql-server-14.0.3430.2-1 ################################# [100%] +--------------------------------------------------------------+ Please run 'sudo /opt/mssql/bin/mssql-conf setup' to complete the setup of Microsoft SQL Server +--------------------------------------------------------------+ SQL Server needs to be restarted in order to apply this setting. Please run 'systemctl restart mssql-server.service'.
# sudo /opt/mssql/bin/mssql-conf setup 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) 7) Enterprise Core (PAID) 8) I bought a license through a retail sales channel and have a product key to enter. Details about editions can be found at https://go.microsoft.com/fwlink/?LinkId=852748&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. Enter your edition(1-8): 2 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 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.
3、查看进程
# ps -ef | grep mssql mssql 3730 1 0 11:53 ? 00:00:00 /opt/mssql/bin/sqlservr mssql 3754 3730 6 11:53 ? 00:00:04 /opt/mssql/bin/sqlservr root 4026 13933 0 11:55 pts/0 00:00:00 grep --color=auto mssql
# find / -name mssql /var/opt/mssql /opt/mssql
# systemctl status mssql-server ● mssql-server.service - Microsoft SQL Server Database Engine Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2022-01-20 11:53:47 CST; 4min 42s ago Docs: https://docs.microsoft.com/en-us/sql/linux Main PID: 3730 (sqlservr) CGroup: /system.slice/mssql-server.service ├─3730 /opt/mssql/bin/sqlservr └─3754 /opt/mssql/bin/sqlservr Jan 20 11:53:49 ecs sqlservr[3730]: 2022-01-20 11:53:49.80 spid5s .... Jan 20 11:53:49 ecs sqlservr[3730]: 2022-01-20 11:53:49.81 spid5s .... Jan 20 11:53:49 ecs sqlservr[3730]: 2022-01-20 11:53:49.82 spid9s .... Jan 20 11:53:49 ecs sqlservr[3730]: 2022-01-20 11:53:49.82 spid9s .... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.01 spid9s .... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.12 spid9s .... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.13 spid20s.... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.13 spid20s.... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.14 spid20s.... Jan 20 11:53:50 ecs sqlservr[3730]: 2022-01-20 11:53:50.15 spid5s .... Hint: Some lines were ellipsized, use -l to show in full.
# netstat -lntup | grep sqlservr tcp 0 0 0.0.0.0:1433 0.0.0.0:* LISTEN 3754/sqlservr tcp 0 0 127.0.0.1:1434 0.0.0.0:* LISTEN 3754/sqlservr tcp6 0 0 :::1433 :::* LISTEN 3754/sqlservr tcp6 0 0 ::1:1434 :::* LISTEN 3754/sqlservr
4、修改sqlever的权限
# chmod 755 /opt/mssql/bin/sqlservr
5、设置开机启动
# systemctl enable mssql-server
6、工具安装
# yum install -y mssql-tools unixODBC-devel
7、更改 SA 密码:
# systemctl stop mssql-server # /opt/mssql/bin/mssql-conf set-sa-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. The system administrator password has been changed. Please run 'sudo systemctl start mssql-server' to start SQL Server. # systemctl start mssql-server