1. disable selinux
2. enable repo
curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/$(rpm -E %{rhel})/mssql-server-2022.repo
curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
curl https://packages.microsoft.com/config/rhel/9/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
[root@teguhth data]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/$(rpm -E %{rhel})/mssql-server-2022.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 444 100 444 0 0 199 0 0:00:02 0:00:02 --:--:-- 199
[root@teguhth data]#
[root@teguhth data]#
[root@teguhth data]# cat /etc/yum.repos.d/mssql-server.repo
[packages-microsoft-com-mssql-server-2022]
name=Microsoft SQL Server 2022
baseurl=https://packages.microsoft.com/rhel/9/mssql-server-2022/
enabled=1
gpgcheck=1
repo_gpgcheck=1
# If installing the bare repo file consider installing the gpg key once and then updating
# this to point to the on-disk location. For example:
# gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Microsoft
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
sslverify=1
[root@teguhth data]#
3. install mssql in RHEL
yum install mssql-server -y
4. configure mssql
/opt/mssql/bin/mssql-conf setup
[root@teguhth mssql]# /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.
9) Standard (Billed through Azure) - Use pay-as-you-go billing through Azure.
10) Enterprise Core (Billed through Azure) - Use pay-as-you-go billing through Azure.
Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&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.
By choosing an edition billed Pay-As-You-Go through Azure, you are verifying
that the server and SQL Server will be connected to Azure by installing the
management agent and Azure extension for SQL Server.
Enter your edition(1-10): 6
Is the product selected covered by Software Assurance? [Yes/No]:Yes
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from: https://aka.ms/useterms
The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409
Enter the SQL Server system administrator password:
Confirm the SQL Server system administrator password:
Configuring SQL Server...
The licensing PID was successfully processed. The new edition is [Enterprise Edition].
ForceFlush is enabled for this instance.
ForceFlush feature is enabled for log durability.
Setup has completed successfully. SQL Server is now starting.
[root@teguhth mssql]#
5. start mssql
systemctl start mssql-server
systemctl enable mssql-server
6. enable sql agent
/opt/mssql/bin/mssql-conf set sqlagent.enabled true
systemctl restart mssql-server
[root@teguhth mssql]# /opt/mssql/bin/mssql-conf set sqlagent.enabled true
SQL Server needs to be restarted in order to apply this setting. Please run
'systemctl restart mssql-server.service'.
[root@teguhth mssql]#
[root@teguhth mssql]# systemctl restart mssql-server
[root@teguhth mssql]#
7. enable repo sql tool
curl https://packages.microsoft.com/config/rhel/9/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
[root@teguhth data]# curl https://packages.microsoft.com/config/rhel/9/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 413 100 413 0 0 2647 0 --:--:-- --:--:-- --:--:-- 2647
[packages-microsoft-com-prod]
name=Microsoft Production
baseurl=https://packages.microsoft.com/rhel/9/prod/
enabled=1
gpgcheck=1
repo_gpgcheck=1
# If installing the bare repo file consider installing the gpg key once and then updating
# this to point to the on-disk location. For example:
# gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Microsoft
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
sslverify=1
[root@teguhth data]#
[root@teguhth data]# cat /etc/yum.repos.d/mssql-release.repo
[packages-microsoft-com-prod]
name=Microsoft Production
baseurl=https://packages.microsoft.com/rhel/9/prod/
enabled=1
gpgcheck=1
repo_gpgcheck=1
# If installing the bare repo file consider installing the gpg key once and then updating
# this to point to the on-disk location. For example:
# gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Microsoft
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
sslverify=1
[root@teguhth data]#
8. Install SQL Server Command-Line Tools
yum install mssql-tools18 unixODBC-devel -y
9. Enable bash profile
[root@teguhth data]# echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile
[root@teguhth data]#
[root@teguhth data]# source ~/.bash_profile
[root@teguhth data]#
[root@teguhth data]# echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
[root@teguhth data]#
[root@teguhth data]# source ~/.bashrc
[root@teguhth data]#
10. connect sql cmd
sqlcmd -S localhost -U sa -P '<password>' -N -C
sqlcmd -S localhost -U sa -P 'P@ssw0rd' -C -N
[root@teguhth mssql]# sqlcmd -S localhost -U sa -C -N
Password:
1>
[root@teguhth mssql]# sqlcmd -S localhost -U sa -P 'P@ssw0rd' -C -N
1>
11. create database
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query.html
create database teguhth;
go
6> create database teguhth;
7> go
Name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
(4 rows affected)
1>
2> SELECT Name FROM sys.databases;
3> go
Name
--------------------------------------------------------------------------------------------------------------------------------
master
tempdb
model
msdb
teguhth
(5 rows affected)
1>
2> use teguhth;
3> go
Changed database context to 'teguhth'.
1>
No comments:
Post a Comment