Install SQL Server 2022 on Ubuntu 22.04 and other Ubuntu flavours. Post executing steps after step 7 onwards .Net 6, .Net 7 and .Net 8 will not work on Ubuntu 22.04
Following steps will install SQL Server 2022
1. Download the public key, convert from ASCII to GPG format, and write it to the required location:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
2. Manually download and register the SQL Server Ubuntu repository:
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | sudo tee /etc/apt/sources.list.d/mssql-server-2022.list
3. Run the update command:
sudo apt update
4. Install SQL Server
sudo apt install -y mssql-server
5. After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition. As a reminder, the following SQL Server editions are freely licensed: Evaluation, Developer, and Express.
sudo /opt/mssql/bin/mssql-conf setup
Specify password for SA account
6. Once the configuration is done, verify that the service is running:
sudo systemctl status mssql-server
Following steps will install SQL Server command line tools:
*Note: after the following steps, .Net 6, .Net 7 and .Net 8 will not work on your system
7. Register the Microsoft Ubuntu repository:
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
8. Run the update command:
sudo apt update
9. Install SQL Server command line tools along with unixODBC developer package
sudo apt-get install mssql-tools18 unixodbc-dev
10. Optional: Add /opt/mssql-tools18/bin/ to your PATH environment variable in a bash shell
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc