As a sysadmin and content creator in the world of IT, it’s crucial to have the right tools and knowledge at your disposal. SQL Server is a powerful relational database management system, and SQLCMD is a command-line tool that allows you to interact with SQL Server. In this blog post, we’ll walk through the process of installing SQL Server and SQLCMD on Debian, a popular Linux distribution.
Before we begin, ensure you have the following prerequisites in place:
- A Debian-based system (Debian 12 is used in this guide).
- Superuser or sudo privileges to install and configure software.
Step 1: Adding the Microsoft SQL Server Repository
The first step is to add the Microsoft SQL Server repository to your Debian 12 system. This repository contains the necessary packages for SQL Server. Open your terminal and run the following commands:
sudo wget https://packages.microsoft.com/config/debian/12/mssql-server-2019.list -O /etc/apt/sources.list.d/mssql-server.list
Step 2: Updating the Package List
After adding the repository, you need to update the package list to include the SQL Server packages. Run the following command:
sudo apt-get update
Step 3: Installing SQL Server
Now, you’re ready to install SQL Server. Use the following command to install it:
sudo apt-get install -y mssql-server
Step 4: Configuring SQL Server
After installation, you’ll be prompted to configure SQL Server. Follow the prompts and set the SA (System Administrator) password. Be sure to choose a strong and secure password.
Step 5: Enabling and Starting SQL Server
To ensure that SQL Server starts automatically when your system boots up, enable and start the SQL Server service with these commands:
sudo systemctl enable mssql-server sudo systemctl start mssql-server
Step 6: Installing SQLCMD (Optional)
SQLCMD is a command-line tool that simplifies interactions with SQL Server. You can install it with the following command:
sudo apt-get install -y mssql-tools
Step 7: Connecting to SQL Server
Now that SQL Server is up and running, you can connect to it using SQLCMD or other SQL clients. For example, to connect with SQLCMD, use this command:
sqlcmd -S localhost -U SA -P YourPassword
Replace “YourPassword” with the password you set during the configuration.
You’ve successfully installed SQL Server and SQLCMD on your Debian system. This is a powerful setup for database management and SQL-related tasks. Whether you’re a sysadmin, developer, or database enthusiast, having SQL Server and SQLCMD at your disposal is a valuable asset.
With SQL Server in place, you can explore various database management tasks, and as a content creator, you can produce engaging videos and blog posts about SQL Server installations, configurations, and usage on your YouTube channel and blog. This not only helps you share knowledge but also build your audience and potentially earn extra income through your tech-related content.