SQL Server 2017 2019 Linux(Centos、Unbuntu16.04、Unbuntu18.04、Unbuntu20.04)安装过程详解
SQL Server 2017 2019 Linux安裝手冊
1簡介
SQL Server是微軟的數(shù)據(jù)庫平臺,而SQL Server 2017 linux是運(yùn)行在linux服務(wù)器上的版本.本文的安裝采用在線安裝的方式,所以需要服務(wù)器或者虛擬機(jī)能訪問外網(wǎng).當(dāng)然也可以采用先下載離線包的方式安裝。本文是CentOS環(huán)境,Ubuntu安裝步驟類似,詳見鏈接:Ubuntu上安裝SQL Server
2準(zhǔn)備
2.1安裝準(zhǔn)備
a) linux版本確認(rèn)(操作系統(tǒng)是64位),查看方法見下:
cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" getconf LONG_BIT #結(jié)果 64
3 安裝
3.1在線安裝
a)配置SQL Server的安裝源,這里直接通過curl的方式下載到/etc/yum.repos.d下.
curl https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo -o/etc/yum.repos.d/mssql-server-2017.repo curl https://packages.microsoft.com/config/rhel/7/prod.repo -o/etc/yum.repos.d/msprod.repob)安裝SQL Server服務(wù)、SQLServer客戶端工具、ODBC開發(fā)包.
yum?-y install mssql-server mssql-tools unixODBC-develc)初始化SQL Server配置,主要是選擇SQL Server版本和設(shè)置SA的密碼.
/opt/mssql/bin/mssql-conf setupd)查看SQL Server的狀態(tài).
systemctl?status mssql-server # 關(guān)閉SQL Server服務(wù) #sudo systemctl stop mssql-server
?e)將SQL Server的工具包目錄加入環(huán)境變量.
echo?'export PATH=$PATH:/opt/mssql-tools/bin' >/etc/profile.d/mssql.sh? source /etc/profile.d/mssql.sh?注: 當(dāng)然可以在/etc/profile里追加也可以在用戶環(huán)境變量里追加,變更內(nèi)容加下:
exportPATH=$PATH:/opt/mssql-tools/bin source /etc/profile延展:
相對而言/etc/profile.d/比/etc/profile好維護(hù),如果不需要某個環(huán)境變量,僅需要刪除相應(yīng)的sh即可.
f)如果防火墻開啟而且SQL Server允許被遠(yuǎn)程訪問,需要開放1433端口.
firewall-cmd --add-port=1433/tcp --permanent? firewall-cmd –reloadlsof -i:1433
3.3安裝驗(yàn)證
a) 測試sqlcmd是否能訪問本地的SQL Server數(shù)據(jù)庫
sqlcmd -S localhost -U SA輸入Password:
select name,database_id from sys.databases; gob) 通過SSMS(SQL Server Management Studio)訪問遠(yuǎn)程的SQLServer數(shù)據(jù)庫
首先進(jìn)入文件菜單然后點(diǎn)擊連接對象資源管理器,然后在彈出的對話框里輸入數(shù)據(jù)庫服務(wù)器的基本信息,如
1)?? 服務(wù)器名稱,這里輸入linux服務(wù)器的IP地址;
2)?? 登錄名輸入sa,
3)?? 密碼是linux版本的SQLServer安裝時設(shè)置的SA密碼.
?
驗(yàn)證遠(yuǎn)程Linux SQL Server的版本信息:
SELECT @@VERSIONAS SQL_SERVER_VERSION
3.4安裝問題總結(jié)
4?反饋
歡迎有任何疑問反饋給我們,以便完善該文檔.
5?跟蹤
其它驗(yàn)證仍在繼續(xù).
總結(jié)
以上是生活随笔為你收集整理的SQL Server 2017 2019 Linux(Centos、Unbuntu16.04、Unbuntu18.04、Unbuntu20.04)安装过程详解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 337调查和反倾销调查有哪些区别?对外国
- 下一篇: MySQL 8.0 CentOS 7安装