In this article, I will show you how to install Microsoft SQL Server 2022 on Ubuntu 22.10. SQL Server is a powerful database that can be used to store spatial data. Microsoft SQL Server 2022 does not support Ubuntu 22.10 natively. So, we need to install it via Docker. Docker is an easy way to deploy applications such as SQL Server. The following step-by-step guide will involve some basic Terminal commands. In this example, I am using Ubuntu 22.10 Server edition installed on VMware ESXi 8.0.
Steps to Install SQL Server 2022 on Ubuntu 22.10
Step 1. Install Docker on Ubuntu 22.10
To install Docker on Ubuntu 22.10, we need to add the Docker repository first. Use this command on Terminal. This command will install some dependency files required by Docker to run properly.
sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
During the installation, you may get the following warning. Just press OK and then reboot the Ubuntu server.
Upon reboot, you may start, restart and enable Docker upon startup with the following command
sudo service docker start sudo service docker restart sudo service docker enable sudo service docker status
Make sure the Docker service is up and running
At this point, we have successfully installed Docker on Ubuntu 22.10. Now we can continue to the next step.
Step 2. Run Microsoft SQL Server 2022 Container
To run the MS SQL Server 2022 Docker container, first, we need to download the SQL Server Docker image
sudo docker pull mcr.microsoft.com/mssql/server:2022-latest
Now we have the SQL Server images. Check with this command to make sure
sudo docker images
Now run this command to start a new SQL Server docker container
sudo docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssword1234" \ -p 1433:1433 --name sqlserver1 --hostname sqlserver1 \ -d \ mcr.microsoft.com/mssql/server:2022-latest
MSSQL_SA_PASSWORD: Change the value to your own “sa” password. You need a complex password combination for the “sa” user.
–name: This is the name of our new container. Change this to something that is easy to differentiate from other containers.
–hostname: The hostname of our new SQL Server container
Once you run the command, now check if the SQL Server container is up and running.
sudo docker ps
Done. At this point, we have successfully installed the Microsoft SQL Server 2022 on Ubuntu 22.10 using Docker. Below are some important Docker commands that you might need.
Start/stop the SQL Server docker container (sqlserver1)
sudo docker stop sqlserver1 sudo docker start sqlserver1
Thanks for reading this how to install SQL Server 2022 on Ubuntu 22.10 using Docker. See you in the next tutorials.