MSSQL Server: Difference between revisions
No edit summary |
No edit summary |
||
Line 98: | Line 98: | ||
100 983 100 983 0 0 2488 0 --:--:-- --:--:-- --:--:-- 2488 | 100 983 100 983 0 0 2488 0 --:--:-- --:--:-- --:--:-- 2488 | ||
OK | OK | ||
===Tambahkan daftar MSSQL release=== | |||
curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list | |||
Hasilnya : | |||
% Total % Received % Xferd Average Speed Time Time Time Current | |||
Dload Upload Total Spent Left Speed | |||
100 87 100 87 0 0 48 0 0:00:01 0:00:01 --:--:-- 48 | |||
===Update Repository=== | |||
sudo apt update | |||
sudo ACCEPT_EULA=Y apt install mssql-tools unixodbc-dev | |||
source ~/.bashrc | |||
sqlcmd -S 127.0.0.1 -U SA | |||
>create database mydb; | |||
>select name from sys.databases; | |||
>go |
Revision as of 02:36, 19 September 2023
Catatan tentang MSSQL Server ini sementara di simpan disini dulu.
Nanti akan penulis pindahkan di catatan terpisah karena MSSQL Server merupakan produk dari Microsoft yang pada dasarkan berjalan di Sistem Operasi Windows.
Namun karena banyak yang memiliki ilmu dan membagikan kreatifitas mereka akhirnya MSSQL Server dapat dijalankan di Sistem Operasi Linux khusus dengan basis OS Ubuntu yang tentukan hanya dapat dijalankan melalui Docker.
Instalasi
Setelah instalasi docker di Ubuntu, siapkan folder kerja ~/docker/mssql :
mkdir ~/docker/mssql -p
Set owner folder kerja :
chown "$USER":"$USER" ~/docker -R
Izinkan container untuk folder kerja :
chmod a+rwx -R ~/docker/mssql
Contoh berikut penulis menggunakan MSSQL 2017 :
docker run -d --name mssql -e ACCEPT_UELA=Y -e MSSSQL_SA_PASSWORD='Strong!Password' -v ~/docker/mssql:/var/opt/mssql -p 1443:1443 --restart unless-stopped -d mcr.microsoft.com/mssql/server:2017-latest
- Pre Instalasi
Sebelum penulis melakukan instalasi di PC dengan Operatong System Ubuntu, penulis mencoba menginstall MSSQL Server di dalam Docker Armbian Linux dengan basis Debian. Instalasi sepertinya berhasil membuat container namun tidak mendapatkan IP dan port, sehingga tidak bisa di akses baik melalui Azure Data Studio atau aplikasi manajemen database lainnya.
Alternatif Install SQL Server
Clone systemd image
sudo docker run -d --name linuxamination --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-ubuntu:20.04
Masuk ke dalam container
sudo docker exec -it linuxamination bash
Jalankan Command di dalam container
apt update
Install beberape paket tambahan
apt install wget curl sudo software-properties-common gnupg2
Tambahkan Key Microsoft ke dalam apt repository
sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
akan muncul
OK
kemudian jalankan command berikut :
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
Lakukan update lagi
apt update
Jalankan proses install MSSQL Server
sudo apt install mssql-server
Konfigurasi Mssql server
jalankan command berikut : sudo /opt/mssql/bin/mssql-conf setup
##############################################################....] to complete the setup of Microsoft SQL Server +--------------------------------------------------------------+ Processing triggers for libc-bin (2.31-0ubuntu9.9) ... root@6961e0d2546a:/# sudo /opt/mssql/bin/mssql-conf setup 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) - CPU Core utilization restricted to 20 physical/40 hyperthreaded 7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum 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=2109348 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): 3
(pilih 3)
The license terms for this product can be found in /usr/share/doc/mssql-server or downloaded from: https://go.microsoft.com/fwlink/?LinkId=2104294 The privacy statement can be viewed at: https://go.microsoft.com/fwlink/?LinkId=853010 Do you accept the license terms? [Yes/No]: Yes
(pilih Yes)
Enter the SQL Server system administrator password:
ulangi password yg sama
Confirm the SQL Server system administrator password:
Jika berhasil akan muncul :
Configuring SQL Server... The licensing PID was successfully processed. The new edition is [Express Edition]. ForceFlush is enabled for this instance. ForceFlush feature is enabled for log durability. Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service -> /lib/systemd/system/mssql-server.service. Setup has completed successfully. SQL Server is now starting.
Install MSSQL Tools, dan jalankan di dalam kontainer
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
hasilnya :
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 983 100 983 0 0 2488 0 --:--:-- --:--:-- --:--:-- 2488 OK
Tambahkan daftar MSSQL release
curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
Hasilnya :
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 87 100 87 0 0 48 0 0:00:01 0:00:01 --:--:-- 48
Update Repository
sudo apt update
sudo ACCEPT_EULA=Y apt install mssql-tools unixodbc-dev
source ~/.bashrc
sqlcmd -S 127.0.0.1 -U SA >create database mydb; >select name from sys.databases; >go