You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

i.sqlexpress.centos.sh 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #echo 'export PATH=$PATH:/opt/mssql-tools/bin' >> ~/.bashrc
  2. #source ~/.bashrc
  3. # sqlcmd -S localhost -U sa -P '<your_password>'
  4. sudo rm /etc/yum.repos.d/mssql-server.repo
  5. # Add Microsoft SQL Server repository
  6. #sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/yum.repos.d/microsoft.repo
  7. #sudo curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/mssql-server.repo
  8. sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2022.repo
  9. sudo dnf clean all
  10. sudo dnf makecache
  11. # Install SQL Server Express
  12. sudo dnf install -y mssql-server
  13. # sudo yum install -y mssql-server
  14. # Run the setup to configure SQL Server
  15. sudo /opt/mssql/bin/mssql-conf setup
  16. # Check if SQL Server is running
  17. #systemctl status mssql-server
  18. # Enable SQL Server to start on boot
  19. sudo systemctl enable mssql-server
  20. # (Optional) Open SQL Server port for remote access
  21. sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
  22. sudo firewall-cmd --reload
  23. # (Optional) Install SQL Server command-line tools
  24. #sudo dnf install -y mssql-tools
  25. # curl https://packages.microsoft.com/config/rhel/9/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
  26. curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo
  27. sudo yum remove mssql-tools unixODBC-utf16 unixODBC-utf16-devel
  28. sudo yum install -y mssql-tools18 unixODBC-devel
  29. sudo yum check-update
  30. sudo yum update mssql-tools18
  31. sudo dnf install mssql-tools --assumeyes
  32. sudo dnf install -y msodbcsql18
  33. echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile
  34. source ~/.bash_profile
  35. # Connect to SQL Server using sqlcmd
  36. sqlcmd --version
  37. #sqlcmd -C -S localhost -U sa -P '<your_password>'
  38. #sqlcmd -S localhost -U sa -C