Installing MSSQL Server
In this guide, we will walk you through the step-by-step process of installing Microsoft SQL Server (MSSQL Server) on both Windows and Linux operating systems. With a friendly approach, we'll ensure you have a smooth installation experience while covering all the essential aspects you need to get started with MSSQL Server.
Prerequisites
Before you dive into the installation, there are a few prerequisites that you should be aware of:
- Hardware Resources: Ensure your system meets the minimum hardware requirements. For a basic installation, consider the following:
- CPU: At least 1.4 GHz (minimum)
- RAM: 2 GB (4 GB or more recommended)
- Disk Space: At least 6 GB for the server installation
- Operating System:
- For Windows: Windows 10 or Windows Server 2016 and later.
- For Linux: Red Hat Enterprise Linux 7 or later, SUSE Linux Enterprise Server 12 or later, or Ubuntu 18.04 or later.
- Administrator Privileges: You'll need admin rights to install MSSQL Server on both Windows and Linux.
Installing MSSQL Server on Windows
Step 1: Download MS SQL Server Installer
- Visit the official Microsoft SQL Server download page.
- Select the appropriate version you want to install (either Developer, Express, or Standard) and click on the download link.
Step 2: Run the Installer
- Locate the downloaded installation file, typically named
SQLServer2019-SSEI-Dev.exefor the Developer edition. - Double-click the executable to launch the SQL Server Installation Center.
Step 3: Choose Installation Type
- In the Installation Center, choose the "New SQL Server stand-alone installation or add features to an existing installation" option.
- The setup might check for updates; allow it to do so.
Step 4: Accept License Terms
- Review and accept the license terms to proceed with the installation.
Step 5: Feature Selection
- Choose the features you want to install. Common choices include:
- Database Engine Services
- SQL Server Management Studio (SSMS)
- Full-Text and Semantic Extractions for Search
- Click "Next" once you’ve made your selections.
Step 6: Instance Configuration
- You can choose between a Default or Named instance. If you're unsure, default instances are typically easier to manage.
- Click "Next" after making your selection.
Step 7: Server Configuration
- Set the SQL Server service account and collation configuration.
- Use the default accounts unless you have specific requirements. Click "Next" to continue.
Step 8: Database Engine Configuration
- Configure the authentication mode. You can select:
- Windows Authentication mode
- Mixed Mode (SQL Server authentication and Windows authentication)
- If you choose Mixed Mode, you will need to create a strong password for the
sa(system administrator) account. - Add SQL Server administrators by clicking "Add Current User."
Step 9: Ready to Install
- Review your installation settings. If everything looks good, click on the "Install" button.
- The installation process will take some time, so sit back and relax.
Step 10: Complete Installation
- Once the installation is complete, click "Close" to exit the installer.
- You can now launch the SQL Server Management Studio (SSMS) to start managing your databases.
Installing MSSQL Server on Linux
Step 1: Configure the Repository
For Ubuntu or Debian-based systems, you will need to install the required packages and add Microsoft's repository. Run the following commands in your terminal:
sudo apt-get update
sudo apt-get install -y wget gnupg2
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
wget -qO /etc/apt/sources.list.d/mssql-release.list https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list
sudo apt-get update
For RHEL-based systems, use the following commands:
sudo yum install -y curl
sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo curl -o /etc/yum.repos.d/mssql-release.repo https://packages.microsoft.com/config/rhel/7/prod.repo
Step 2: Install SQL Server
After configuring the repository, install SQL Server using the command:
For Ubuntu:
sudo apt-get install -y mssql-server
For RHEL:
sudo yum install -y mssql-server
Step 3: Run SQL Server Setup
Once the installation is complete, run the setup command to perform the initial configuration:
sudo /opt/mssql/bin/mssql-conf setup
During setup, you will be prompted to select the edition of SQL Server and to configure the administrator password. Follow the prompts to complete the setup.
Step 4: Verify Installation
You can verify that the SQL Server service is running with this command:
systemctl status mssql-server
Ensure it says "active (running)"
Step 5: Install SQL Server Command-Line Tools
To connect to and manage your SQL Server instance, you may want to install SQL Server command-line tools. Use the following commands:
For Ubuntu:
sudo apt-get install -y mssql-tools unixodbc-dev
Make sure to add the tools to your path by appending the following line to your .bash_profile or .bashrc:
export PATH="$PATH:/opt/mssql-tools/bin"
For RHEL:
sudo yum install -y mssql-tools unixODBC-devel
Step 6: Connect to SQL Server
You can connect to your SQL Server instance using the SQL Command Line tools with the following command:
sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd'
Substitute 'YourStrong!Passw0rd' with the password you set during installation.
Conclusion
You've successfully installed MSSQL Server on both Windows and Linux platforms! Now that you have a functioning database server, you can start creating databases, tables, and running queries.
As you begin your journey with MSSQL Server, remember that ongoing learning and practice will help you unlock the full potential of this powerful database management system. If you encounter any issues during installation, consulting the official MSSQL Server documentation is a great way to find solutions. Happy coding!