GNU/Linux >> Linux の 問題 >  >> Cent OS

RHEL 7(CentOS 7)/Ubuntu16.04にMicrosoftSQLServer(MS SQL)をインストールする方法

MicrosoftはRedhatEnterpriseLinuxおよびUbuntu用のSQLServerをリリースしました 、そして今こそMicrosoftSQLServerを利用してLinuxオペレーティングシステムの最上位に置く時です。

システム要件

システムが以下のハードウェア要件を満たしていることを確認してください。

メモリ 少なくとも3.25GB
ファイルシステム XFS またはEXT4
ディスク容量 最小1GB
プロセッサタイプ x64互換のみ

サポートされているオペレーティングシステム

  • Redhat Enterprise Linux 7.5 / 7.4 / 7.3 / 7.2
  • Ubuntu 16.04

リポジトリのセットアップ

### CentOS 7 / RHEL 7 ###

yum -y install wget
wget https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo -O /etc/yum.repos.d/mssql-server-2017.repo

### Ubuntu 16.04 ###

sudo apt-get update
sudo apt-get install -y wget curl
wget https://packages.microsoft.com/keys/microsoft.asc
sudo apt-key add microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list  | sudo tee /etc/apt/sources.list.d/mssql-server-2017.list

LinuxにMicrosoftSQLServerをインストールする

### CentOS 7 / RHEL 7 ###  

yum install -y mssql-server

### Ubuntu 16.04 ###

sudo apt-get update
sudo apt-get install -y mssql-server

MSSQLサーバーをセットアップします。

### CentOS 7 / RHEL 7 ###  

/opt/mssql/bin/mssql-conf setup

### Ubuntu 16.04 ###

sudo /opt/mssql/bin/mssql-conf setup

セットアップの実行中に、SQLServerの7つのエディションから1つを選択するように求められます。

1)評価(無料、本番使用​​権なし、180日制限)
2)開発者(無料、本番使用​​権なし)
3)Express(無料)
4)Web(有料) )
5)標準(PAID)
6)エンタープライズ(PAID)
7)エンタープライズコア(PAID)
8)小売販売チャネルを通じてライセンスを購入し、入力するプロダクトキー。

出力:

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): 1 <-- Choose SQL Edition. I chose to install Evaluation
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=855864&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 <-- Accept License Terms

Enter the SQL Server system administrator password: <-- Set SQL Admin Password
Confirm the SQL Server system administrator password: <-- Confirm SQL Admin Password
Configuring SQL Server...

The licensing PID was successfully processed. The new edition is [Enterprise Evaluation Edition].
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.

MS SQLサービスを開始します(オプション)。

### CentOS 7 / RHEL 7 ### 

systemctl start mssql-server 
systemctl enable mssql-server

### Ubuntu 16.04 ###

sudo systemctl start mssql-server
sudo systemctl enable mssql-server

LinuxにMSSQLServerツールをインストールする

SQLServerツールリポジトリを構成します。

### CentOS 7 / RHEL 7 ###

wget https://packages.microsoft.com/config/rhel/7/prod.repo -O /etc/yum.repos.d/msprod.repo

### Ubuntu 16.04 ###

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

MS SQLツール(sqlcmdおよびbcp)とODBC開発者パッケージをインストールします。

### CentOS 7 / RHEL 7 ###

yum install -y mssql-tools unixODBC-devel

### Ubuntu 16.04 ###

sudo apt-get update 
sudo apt-get install -y mssql-tools unixodbc-dev
Microsoft SQLサーバーツールをインストールするときは、ライセンス条項に同意する必要があります。

ファイアウォール

1433を許可するようにファイアウォールを構成します 外部マシンからSQLサーバーにアクセスできるようにするためのポート。

FirewallD:

firewall-cmd --permanent --add-port=1433/tcp
firewall-cmd --reload

UFW:

sudo ufw allow 8080/tcp
sudo ufw reload

MSSQLサーバーに接続する

sqlcmd コマンドが/opt / mssql-tools / binに表示されるようになりました ディレクトリ。ツールコマンドをシェルパスで使用できるようにするには、次のコマンドを実行します。

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
source ~/.bash_profile

インストールが完了したら、次のコマンドを使用してMSSQLサーバーに接続します。

sqlcmd -H 127.0.0.1 -U sa

Password: 
1>

以上です。


Cent OS
  1. RHEL 8 / CentOS8LinuxにDNSサーバーをインストールする方法

  2. CentOS 8 /RHEL8にPuppetをインストールする方法

  3. CentOS / RHEL 7 :GUI のインストール方法

  1. RHEL 8 /CentOS8にpostfixメールサーバーをインストールする方法

  2. CentOS 7 /RHEL7にPuppet6.xをインストールする方法

  3. CentOS 7 /RHEL7およびUbuntu18.04/Ubuntu16.04にRedisをインストールする方法

  1. RHEL 8 /CentOS8にvncサーバーをインストールする方法

  2. NextcloudをRHEL8/CentOS8サーバーにインストールする方法

  3. RHEL 8 /CentOS8サーバーにOwnCloudをインストールする方法