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.repo
Install SQL Server
sudo dnf install -y mssql-server
Run Initial Setup
sudo /opt/mssql/bin/mssql-conf setup
During 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-server
Install 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 ~/.bashrc
Test Connection
sqlcmd -S localhost -U sa
Configure Firewall (If Needed)
sudo firewall-cmd --permanent --add-port=1433/tcp
sudo firewall-cmd --reload
Verification 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