Hướng dẫn cài bionic v3.0 wordpress

MS SQL liên quan tới hệ thống CSDL của Microsoft và bắt đầu được Open sourced từ năm 2016. Dưới đây là bài viết hướng dẫn cách cài và cấu hình MS SQL 2017 trên Ubuntu Linux x64 [Ubuntu 18.04 Bionic Beaver Linux].

Dưới đây là cấu hình hệ thống cơ bản để cài và chạy MS SQL trên Ubuntu 18.04 / 16.04 server:

  • Cấu hình bộ nhớ thấp nhất: 1 GRAM.
  • CPU tốc độ tối thiểu: 1.4 GHz. Nên có tốc độ cao hơn >= 2 GHz.
  • SQL Server yêu cầu tối thiếu dung lượng: 10 GB ổ cứng SSD trống.

Phần 1. Cài đặt MS SQL Server trên Ubuntu 18.04 hoặc Ubuntu 16.04 LTS

Bước 1: Cập nhật hệ thống Ubuntu

Trên màn lệnh terminal của Ubuntu nhập 2 lệnh sau:

sudo apt-get update

sudo apt-get -y upgrade

Nếu phần lỗi “kernel” đã được cập nhật xong, chúng ta sẽ nhập tiếp lệnh để khởi động lại Ubuntu:

sudo reboot

Bước 2: Nhập key GPG lưu trữ bộ cài MS SQL “repository GPG keys”:

Nhập lệnh để thêm key:

sudo wget -qO- //packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –

Bước 3: Thêm địa chỉ để download bộ cài Microsoft SQL Server Ubuntu repository:

Nhập lệnh sau:

sudo add-apt-repository “$[wget -qO- //packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list]”

Bước 4: Nhập lệnh cài MS SQL Server 2017 trên Ubuntu 18.04/ Ubuntu 16.04 LTS

Gõ 3 lệnh sau:

sudo apt-get update

sudo apt install libcurl3

sudo apt-get install -y mssql-server

Màn hình các thao tác thực hiện sau:

Reading package lists… 0%

Reading package lists… Done

Building dependency tree

Reading state information… Done

The following packages were automatically installed and are no longer required:

grub-pc-bin libpython-all-dev python-all python-all-dev python-asn1crypto python-cffi-backend python-crypto python-cryptography python-dbus

python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-pkg-resources python-secretstorage

python-setuptools python-six python-wheel python-xdg

Use ‘apt autoremove’ to remove them.

The following NEW packages will be installed:

mssql-server

0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.

Need to get 176 MB of archives.

After this operation, 928 MB of additional disk space will be used.

Get:1 //packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial/main amd64 mssql-server amd64 14.0.3030.27-1 [176 MB]

Fetched 176 MB in 5s [36.3 MB/s]

Preconfiguring packages …

Selecting previously unselected package mssql-server.

[Reading database … 117280 files and directories currently installed.]

Preparing to unpack …/mssql-server_14.0.3030.27-1_amd64.deb …

Unpacking mssql-server [14.0.3030.27-1] …

Processing triggers for libc-bin [2.27-3ubuntu1] …

Setting up mssql-server [14.0.3030.27-1] …

+————————————————————–+

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’.

Processing triggers for man-db [2.8.3-2] …

Processing triggers for libc-bin [2.27-3ubuntu1] …

Nếu đến đây xuất hiện lỗi: “mssql-server : Depends: openssl [> ~/.bash_profile

Để có thể tương tác với các lệnh ở trạng thái không cần "login sessions", chúng ta sẽ sửa đường dẫn "PATH" trong ~/.bashrc file, nhập lệnh sau:
curl //packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

0

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

1

Bước 6. Kết nối với MS-SQL console:

# sqlcmd -S 127.0.0.1 -U SA

Password:

Nếu bạn gặp lỗi sau:

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746.

Đây là lỗi do phiên bản SSL version 1 cần phải được cập nhật, chúng ta sẽ phải cài lại OpenSSL thư viện version 1.0 để kết nối với SQL Server. Thực hiện các lệnh sau:

  1. Dừng SQL Server: sudo systemctl stop mssql-server
  2. Mở file mssql-server để sửa cấu hình dịch vụ: sudo systemctl edit mssql-server
  3. Nội dung của file mssql-server thêm 2 dòng sau và lưu lại nội dung này: [Service] Environment=”LD_LIBRARY_PATH=/opt/mssql/lib”
  4. Tạo đường link tới 2 thư viện của OpenSSL 1.0 để kết nối SQL Server: sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
  5. Khởi động lại SQL Server: sudo systemctl start mssql-server

Tiếp theo chúng ta có thể kiểm tra tình hình vận hành của MS-SQL Server bằng 3 lệnh sau:

1> create database testDB;

Get a list database:

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

2

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

3

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

4

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

5

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

6

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

7

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

8

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

9

Tiếp theo nhập 3 lệnh sau:

0

Tiếp theo nhập 3 lệnh sau:

1

Phần 2. Lập trình, thiết kế CSDL và Administrator DBA:

Các bạn có thể dùng tool Microsoft SQL Server Management Studio:

Nhập thông tin địa chỉ tên/IPv4 của máy chủ MS-SQL server bạn vừa cài trên Ubuntu linux 18.04/16.04 LTS

Phần mềm chuyên cho thiết kế, quản trị CSDL của MS-SQL Server 2017:

Nếu cần thông tin hoặc học nâng cao về các công nghệ và phần mềm xử lý dữ liệu MS-SQL Database, Data-ware house, BI cho chuyên ngành của minh

Hay tìm hiểu các môn đó trên trang web: //robusta.vn/

Chúc các bạn thành công!

Chủ Đề