GNU/Linux >> Tutoriels Linux >  >> Cent OS

Comment installer Microsoft SQL Server (MS SQL) sur RHEL 7 (CentOS 7) / Ubuntu 16.04

Microsoft a publié SQL Server pour Redhat Enterprise Linux et Ubuntu , et il est temps de profiter de Microsoft SQL Server pour l'avoir en tête du système d'exploitation Linux.

Configuration requise

Assurez-vous que votre système répond aux exigences matérielles ci-dessous.

Mémoire Au moins 3,25 Go
Système de fichiers XFS ou EXT4
Espace disque Minimum 1 Go
Type de processeur Compatible x64 uniquement

Systèmes d'exploitation pris en charge

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

Configurer le référentiel

### 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

Installer Microsoft SQL Server sur Linux

### CentOS 7 / RHEL 7 ###  

yum install -y mssql-server

### Ubuntu 16.04 ###

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

Configurer le serveur MS SQL.

### CentOS 7 / RHEL 7 ###  

/opt/mssql/bin/mssql-conf setup

### Ubuntu 16.04 ###

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

Lors de l'exécution de la configuration, il vous serait demandé de choisir l'une des sept éditions de SQL Server.

1) Évaluation (gratuit, pas de droits d'utilisation en production, limite de 180 jours)
2) Développeur (gratuit, pas de droits d'utilisation en production)
3) Express (gratuit)
4) Web (PAID )
5) Standard (PAID)
6) Enterprise (PAID)
7) Enterprise Core (PAID)
8) J'ai acheté une licence via un canal de vente au détail et j'ai un clé de produit à saisir.

Sortie :

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.

Démarrez le service MS SQL (facultatif).

### 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

Installer les outils MS SQL Server sur Linux

Configurez le référentiel des outils du serveur SQL.

### 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

Installez les outils MS SQL (sqlcmd et bcp) et le package de développement 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
Lors de l'installation des outils de serveur Microsoft SQL, vous devez accepter les termes de la licence.

Pare-feu

Configurez le pare-feu pour autoriser 1433 port afin que nous puissions accéder au serveur SQL à partir de machines externes.

Pare-feuD :

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

UFW :

sudo ufw allow 8080/tcp
sudo ufw reload

Se connecter au serveur MS SQL

sqlcmd la commande est maintenant trouvée /opt/mssql-tools/bin annuaire. Pour rendre la commande d'outils disponible pour le chemin du shell, exécutez la commande suivante.

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

Une fois l'installation terminée, connectez-vous au serveur MS SQL à l'aide de la commande suivante.

sqlcmd -H 127.0.0.1 -U sa

Password: 
1>

C'est tout.


Cent OS
  1. Comment installer le serveur DNS sur RHEL 8 / CentOS 8 Linux

  2. Comment installer Puppet sur CentOS 8 / RHEL 8

  3. Comment installer Puppet 6.x sur CentOS 7 / RHEL 7

  4. Comment installer Redis sur CentOS 7 / RHEL 7 et Ubuntu 18.04 / Ubuntu 16.04

  5. CentOS / RHEL 7 :Comment installer l'interface graphique

Comment installer Zabbix Server 4.x sur CentOS 6 / RHEL 6

Comment installer Zabbix Server 5.0 / 4.0 sur CentOS 7 / RHEL 7

Comment installer Microsoft SQL Server sur Ubuntu 20.04 LTS

Comment installer Microsoft SQL Server sur CentOS 7

Comment installer Microsoft SQL Server sur CentOS 8

Comment installer Microsoft SQL Server sur Ubuntu 16.04 LTS