Skip to content

Install sql server ubuntu 18.04

gagal di ubuntu 20.04, bisa di ubuntu 18.04
-> gagal di 'sudo apt-get install mssql-tools unixodbc-dev'

(UPDATE SOLUSIII!!!) ->

sudo apt install aptitude
sudo aptitude install mssql-tools unixodbc-dev

*jika tdk punya, bisa pakai virtualbox, dengan spesifikasi virtualbox mesin min 2gb ram
dan tiap ingin menjalankan harus sambil menghidupkan mesin

sudo apt update && sudo apt upgrade
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
sudo apt-get install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup

pilih developer, yes, masukkan password

cek apakah sdh bisa, jika bisa ada tulisan active :

systemctl status mssql-server --no-pager

lanjut :

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update 
sudo apt-get install mssql-tools unixodbc-dev

opsional : (tdk jg gpp, aku jg ga)

sudo apt-get update 
sudo apt-get install mssql-tools

lanjut :

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

login sqlserver lwat terminal : (atau boleh lngs ke software spt dbeaver)

sqlcmd -S localhost -U 'usernamemu' -P 'passwordmu'

default username : SA

nyoba2 kuy :

create db

CREATE DATABASE TestDB
SELECT Name from sys.Databases
GO

insert db

USE TestDB
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
GO

select db

SELECT * FROM Inventory WHERE quantity > 152;
GO