SQL Server Installation - Rocky Linux
Add Microsoft Repository
sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/9/mssql-server-2022.repoInstall SQL Server
sudo dnf install -y mssql-serverRun Initial Setup
sudo /opt/mssql/bin/mssql-conf setupDuring setup, you'll be prompted to:
- Choose edition (Developer/Express for free options)
- Accept license terms
- Set SA password
- Confirm settings
Start and Enable Service
# the service is automatically started and enabled. For manual cases, use the following command
sudo systemctl enable mssql-server
sudo systemctl start mssql-server
sudo systemctl status mssql-serverInstall SQL Server Tools (Optional)
# Add tools repository
sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/9/prod.repo
# Install tools
sudo dnf install -y mssql-tools unixODBC-devel
# Add tools to PATH
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrcTest Connection
sqlcmd -S localhost -U saConfigure Firewall (If Needed)
sudo firewall-cmd --permanent --add-port=1433/tcp
sudo firewall-cmd --reloadVerification Commands
# Check what ports SQL Server is listening on
sudo netstat -tulpn | grep sqlservr
# Check SQL Server configuration
sudo /opt/mssql/bin/mssql-conf list