MS-SQL Server 2017 on Linux Install
Platform |
Supported Version(s) |
Red Hat Enterprise Linux |
7.3 |
SUSE Linux Enterprise Server |
v12 SP2 |
Ubuntu |
16.04 and 16.10 |
Docker Engine |
1.8+ |
저는 CentOS에서 설치합니다
Ubuntu쓰시는 분들은
요기 클릭하여 이동 후 보고 설치하심 됩니닷
시작~
SQL Server 실행 패키지 설치
[heni@localhost ~]$ sudo su
[root@localhost ~]# sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 232 100 232 0 0 453 0 --:--:-- --:--:-- --:--:-- 454
[root@localhost ~]# sudo yum install -y mssql-server
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
packages-microsoft-com-mssql-server-2017 | 2.9 kB 00:00
updates | 3.4 kB 00:00
(1/2): packages-microsoft-com-mssql-server-2017/primary_db | 5.2 kB 00:00
(2/2): updates/7/x86_64/primary_db | 3.6 MB 00:02
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* updates: centos.mirror.cdnetworks.com
Resolving Dependencies
--> Running transaction check
---> Package mssql-server.x86_64 0:14.0.3006.16-3 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================
Package Arch Version Repository Size
========================================================================
Installing:
mssql-server
x86_64 14.0.3006.16-3 packages-microsoft-com-mssql-server-2017 165 M
Transaction Summary
=======================================================================
Install 1 Package
Total download size: 165 M
Installed size: 165 M
Downloading packages:
경고: /var/cache/yum/x86_64/7/packages-microsoft-com-mssql-server-2017/packages/mssql-server-14.0.3006.16-3.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for mssql-server-14.0.3006.16-3.x86_64.rpm is not installed
mssql-server-14.0.3006.16-3.x86_64.rpm | 165 MB 01:31
Retrieving key from https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
Userid : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mssql-server-14.0.3006.16-3.x86_64 1/1
+--------------------------------------------------------------+
'sudo /opt/mssql/bin/mssql-conf setup'을 실행하여
Microsoft SQL Server의 설정을 완료하세요.
+--------------------------------------------------------------+
Verifying : mssql-server-14.0.3006.16-3.x86_64 1/1
Installed:
mssql-server.x86_64 0:14.0.3006.16-3
Complete!
SQL Server 설치
[root@localhost ~]# sudo /opt/mssql/bin/mssql-conf setup
SQL Server의 버전을 선택합니다.
1) Evaluation (무료, 프로덕션 사용권 없음, 180일 제한)
2) Developer (무료, 프로덕션 사용권 없음)
3) Express (무료)
4) Web (유료)
5) Standard (유료)
6) Enterprise (유료)
7) Enterprise Core (유료)
8) 소매 채널을 통해 라이선스를 구했으며 입력할 제품 키가 있습니다.
버전 세부 정보는 다음 위치에서 확인할 수 있음
https://go.microsoft.com/fwlink/?LinkId=852748&clcid=0x412
이 소프트웨어의 유료 버전을 사용하려면
Microsoft Volume Licensing 프로그램을 통해 라이선스를 받아야 합니다.
유료 버전을 선택하는 경우 이 소프트웨어를 설치 및 실행하는 데 필요한
적절한 라이선스 번호가 있음을 확인하는 것입니다.
버전 입력(1-8): 3
이 제품의 사용 조건은 다음 위치에서 확인하거나
/usr/share/doc/mssql-server 다운로드할 수 있습니다.
https://go.microsoft.com/fwlink/?LinkId=855862&clcid=0x412
개인정보처리방침은 다음 위치에서 확인할 수 있습니다.
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x412
사용 조건에 동의하시겠습니까? [Yes/No]:yes
SQL Server의 언어를 선택합니다.
(1) English
(2) Deutsch
(3) Español
(4) Français
(5) Italiano
(6) 日本語
(7) 한국어
(8) Português
(9) Русский
(10) 中文 – 简体
(11) 中文 (繁体)
옵션 1-11을 입력합니다. 7
SQL Server 시스템 관리자 암호 입력:
지정한 암호는 복잡하지 않기 때문에 SQL Server 암호 정책 요구 사항을 충족하지 않습니다. 암호는 길이가 8자 이상이어야 하며 4가지 문자 집합인 영문 대문자, 영문 소문자, 숫자 및 기호 중 3가지를 포함해야 합니다.
SQL Server 시스템 관리자 암호 입력:
SQL Server 시스템 관리자 암호 확인:
SQL Server 구성 중...
Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service.
설치가 완료되었습니다. 이제 SQL Server를 시작하는 중입니다.
서비스 실행 확인
[root@localhost ~]# 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 화 2017-11-28 15:45:51 KST; 5min ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 6224 (sqlservr)
CGroup: /system.slice/mssql-server.service
├─6224 /opt/mssql/bin/sqlservr
└─6263 /opt/mssql/bin/sqlservr
11월 28 15:45:54 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:54.9...
11월 28 15:45:54 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:54.9...
11월 28 15:45:55 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:55.2...
11월 28 15:45:55 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:55.5...
11월 28 15:45:55 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:55.9...
11월 28 15:45:55 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:55.9...
11월 28 15:45:55 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:55.9...
11월 28 15:45:56 localhost.localdomain sqlservr[6224]: 2017-11-28 15:45:56.0...
11월 28 15:51:00 localhost.localdomain sqlservr[6224]: 2017-11-28 15:51:00.5...
11월 28 15:51:00 localhost.localdomain sqlservr[6224]: 2017-11-28 15:51:00.6...
Hint: Some lines were ellipsized, use -l to show in full.
SQL Server Command-line Tools 설치
[root@localhost ~]# sqlcmd
bash: sqlcmd: 명령을 찾을 수 없습니다...
[root@localhost ~]# sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 193 100 193 0 0 462 0 --:--:-- --:--:-- --:--:-- 462
[root@localhost ~]# sudo yum install -y mssql-tools unixODBC-devel
Loaded plugins: fastestmirror, langpacks
packages-microsoft-com-prod | 2.9 kB 00:00:00
packages-microsoft-com-prod/primary_db | 43 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* updates: centos.mirror.cdnetworks.com
Resolving Dependencies
--> Running transaction check
---> Package mssql-tools.x86_64 0:14.0.6.0-1 will be installed
--> Processing Dependency: msodbcsql < 13.2.0.0 for package: mssql-tools-14.0.6.0-1.x86_64
--> Processing Dependency: msodbcsql >= 13.1.0.0 for package: mssql-tools-14.0.6.0-1.x86_64
---> Package unixODBC-devel.x86_64 0:2.3.1-11.el7 will be installed
--> Processing Dependency: unixODBC(x86-64) = 2.3.1-11.el7 for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libtemplate.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libtdsS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libsapdbS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: liboraodbcS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: liboplodbcS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbctxtS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbcnnS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbcminiS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbcdrvcfg2S.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbcdrvcfg1S.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libodbccr.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libnn.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libmimerS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Processing Dependency: libesoobS.so.2()(64bit) for package: unixODBC-devel-2.3.1-11.el7.x86_64
--> Running transaction check
---> Package msodbcsql.x86_64 0:13.1.9.1-1 will be installed
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================
Package Arch Version Repository Size
========================================================================
Installing:
mssql-tools x86_64 14.0.6.0-1 packages-microsoft-com-prod 249 k
unixODBC-devel x86_64 2.3.1-11.el7 base 55 k
Installing for dependencies:
msodbcsql x86_64 13.1.9.1-1 packages-microsoft-com-prod 4.0 M
unixODBC x86_64 2.3.1-11.el7 base 413 k
Transaction Summary
========================================================================
Install 2 Packages (+2 Dependent packages)
Total download size: 4.7 M
Installed size: 5.6 M
Downloading packages:
(1/4): unixODBC-devel-2.3.1-11.el7.x86_64.rpm | 55 kB 00:00:00
(2/4): unixODBC-2.3.1-11.el7.x86_64.rpm | 413 kB 00:00:00
(3/4): mssql-tools-14.0.6.0-1.x86_64.rpm | 249 kB 00:00:00
(4/4): msodbcsql-13.1.9.1-1.x86_64.rpm | 4.0 MB 00:00:01
----------------------------------------------------------------------------------------------------------------
Total 2.6 MB/s | 4.7 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : unixODBC-2.3.1-11.el7.x86_64 1/4
The license terms for this product can be downloaded from
https://aka.ms/odbc131eula and found in
/usr/share/doc/msodbcsql/LICENSE.TXT . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
yes
Please enter YES or NO
Do you accept the license terms? (Enter YES or NO)
YES
Installing : msodbcsql-13.1.9.1-1.x86_64 2/4
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.
Do you accept the license terms? (Enter YES or NO)
YES
Installing : mssql-tools-14.0.6.0-1.x86_64 3/4
Installing : unixODBC-devel-2.3.1-11.el7.x86_64 4/4
Verifying : msodbcsql-13.1.9.1-1.x86_64 1/4
Verifying : unixODBC-devel-2.3.1-11.el7.x86_64 2/4
Verifying : unixODBC-2.3.1-11.el7.x86_64 3/4
Verifying : mssql-tools-14.0.6.0-1.x86_64 4/4
Installed:
mssql-tools.x86_64 0:14.0.6.0-1 unixODBC-devel.x86_64 0:2.3.1-11.el7
Dependency Installed:
msodbcsql.x86_64 0:13.1.9.1-1 unixODBC.x86_64 0:2.3.1-11.el7
Complete!
환경변수 설정
[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
SQL Server 접속 (로컬)
[root@localhost ~]# sqlcmd -U SA
Password:
1>
DB 생성
1> create database TESTDB
2> go
테이블 생성 및 데이터 삽입, 확인
1> use TESTDB;
2> create table TEST (ID int, NAME varchar(10))
3> insert into TEST values (1, 'heni')
4> go
데이터베이스 컨텍스트가 'TESTDB'(으)로 변경되었습니다.
(1 rows affected)
1> select * from TEST
2> go
ID NAME
----------- ----------
1 heni
(1 rows affected)
sqlcmd 명령 프롬프트 종료
1> quit
2> go
Msg 2812, Level 16, State 62, Server localhost, Line 1
저장 프로시저 'quit'을(를) 찾을 수 없습니다.
1> QUIT
[root@localhost ~]#
끝.
'IT Engineer > Database' 카테고리의 다른 글
[Database] 오라클에서 제공하는 between_months 함수를 만들어보자 (0) | 2018.01.18 |
---|---|
[Database] character length units. CHARACTERS/CHAR vs OCTETS/BYTE (0) | 2018.01.18 |
[Database] 데이터베이스에서의 Segment란? Segment 종류. 객체와 세그먼트의 차이 (0) | 2018.01.18 |
[Database] XA 개념 정리. XA? Non-XA? 분산트랜잭션 (0) | 2018.01.18 |
[Database] Split Brain이란? cluster partition시 발생하는 split brain (0) | 2018.01.18 |