ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Installing MS SQL Server Express on CentOS

    IT Discussion
    linux centos centos 7 rhel database ms sql server ms sql server 2017 linux ms sql server 2017 guide how to
    6
    13
    5.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch
      last edited by JaredBusch

      Microsoft makes this super easy, and @scottalanmiller has posted about this once back in 2017.

      First, as always when I write something, start with the minimal install. In this case, of CentOS 7, as Microsoft only supports the LTS model of operating systems. Their listed Ubuntu version is old. Also, you all know how much I love Ubuntu.

      Second, make sure your system is fully up to date.

      yum update -y
      

      Note: You do not need the EPEL.

      Now you are ready to go.

      Go get the SQL Server repository from Microsoft.

      sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
      

      09a75873-054e-4bcc-8dac-4dbb0e30a1e2-image.png

      Install SQL Server with yum

      sudo yum install -y mssql-server
      

      71021738-5f72-480e-911d-5e8aa0b2bf9c-image.png
      ef789857-6b2b-450a-a69c-5e411021945e-image.png
      799dd414-9b57-4a65-b0c3-7e74bc31d91f-image.png

      Then as instructed run the setup wizard.

      sudo /opt/mssql/bin/mssql-conf setup
      

      You will be prompted to choose your version.

      Choose the version you want. For this guide we are selecting 3) Express.
      9c576fe9-8688-41e9-9c10-5ebc1fe295c7-image.png

      You will then have to agree to the license terms.

      7f359111-3e30-4614-91a7-ca28376942d1-image.png

      Now enter the sa user password you want for SQL Server

      The sa account is equivalent to the root account in MariaDB/MySQL
      7287f8f7-f5b7-4665-9dc3-89c155f64313-image.png

      You should see it was successfully completed.

      That's it, you are up and running.
      cc42f5df-8c10-4e89-83f8-0bf98c904bbe-image.png

      While you may be up and running now, you will also need to do a few more things to make it useful.

      Allow inbound connections through the firewall to the server if needed.

      In my case, I will have a remote server talking to this and I use Azure Data Studio form a Linux Desktop to access this.

      sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
      sudo firewall-cmd --reload
      

      a0c10123-0fc7-4d23-8502-071c5b16a9de-image.png

      Add the Microsoft command line tools so you can locally manage the instance.

      This is a separate repository file from SQL Server itself.

      sudo curl -o /etc/yum.repos.d/msprod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
      

      381b6250-c38f-4679-9aa9-b597105fcaea-image.png

      Install the tools.

      sudo yum install -y mssql-tools unixODBC-devel
      

      55feba92-5281-449a-8476-d26b4f81f187-image.png

      There are again license agreements to be agreed to.
      883222a1-3acc-460b-83e1-5480fcd5d68d-image.png

      If you want to use the tools without typing the full bath, add them to your path.

      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
      source ~/.bashrc
      

      You now have access to sqlcmd
      46f52682-b31d-4e03-8599-387a6391785c-image.png

      You can connect to the local instance like this. You will be prompted for your password.

      sqlcmd -U sa
      

      dc8ea2bc-2efc-4b90-86e3-45c9c944645f-image.png

      You can pass the password with the -P parameter.

      sqlcmd -U sa -P 'YourSuperSecretPassword'
      

      Note the single quotes. I always use them to ensure even if you have a special character, that the password is accepted when passed this way.
      314852b3-fbaf-4a60-a757-16c9ff967fb0-image.png

      Emad RE 1 Reply Last reply Reply Quote 5
      • JaredBuschJ
        JaredBusch
        last edited by JaredBusch

        If anyone is curious, you do not have to tell it to start on boot as the setup step does that. You can see it linking the service in the screenshot.

        1 Reply Last reply Reply Quote 0
        • JaredBuschJ
          JaredBusch
          last edited by

          And screw you Microsoft...

          I had to manually type yes twice during a yum update -y

          943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

          scottalanmillerS travisdh1T black3dynamiteB 3 Replies Last reply Reply Quote 2
          • scottalanmillerS
            scottalanmiller @JaredBusch
            last edited by

            @JaredBusch that's ridiculous

            1 Reply Last reply Reply Quote 0
            • travisdh1T
              travisdh1 @JaredBusch
              last edited by

              @JaredBusch said in Installing MS SQL Server Express on CentOS:

              And screw you Microsoft...

              I had to manually type yes twice during a yum update -y

              943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

              They've screwed up the update process on Fedora? Guess I probably shouldn't be surprised.

              JaredBuschJ 1 Reply Last reply Reply Quote 0
              • JaredBuschJ
                JaredBusch @travisdh1
                last edited by

                @travisdh1 said in Installing MS SQL Server Express on CentOS:

                @JaredBusch said in Installing MS SQL Server Express on CentOS:

                And screw you Microsoft...

                I had to manually type yes twice during a yum update -y

                943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

                They've screwed up the update process on Fedora? Guess I probably shouldn't be surprised.

                SQL Server only works on CentOS 7 at the moment. Almost work on Fedora, but not quite.

                1 Reply Last reply Reply Quote 1
                • CloudKnightC
                  CloudKnight
                  last edited by

                  excellent guide. :thumbs_up:

                  1 Reply Last reply Reply Quote 0
                  • black3dynamiteB
                    black3dynamite @JaredBusch
                    last edited by

                    @JaredBusch said in Installing MS SQL Server Express on CentOS:

                    And screw you Microsoft...

                    I had to manually type yes twice during a yum update -y

                    943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

                    I wonder if that affects yum-cron auto update schedule?

                    JaredBuschJ 1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch @black3dynamite
                      last edited by

                      @black3dynamite said in Installing MS SQL Server Express on CentOS:

                      @JaredBusch said in Installing MS SQL Server Express on CentOS:

                      And screw you Microsoft...

                      I had to manually type yes twice during a yum update -y

                      943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

                      I wonder if that affects yum-cron auto update schedule?

                      How could it not?

                      scottalanmillerS 1 Reply Last reply Reply Quote 1
                      • scottalanmillerS
                        scottalanmiller @JaredBusch
                        last edited by

                        @JaredBusch said in Installing MS SQL Server Express on CentOS:

                        @black3dynamite said in Installing MS SQL Server Express on CentOS:

                        @JaredBusch said in Installing MS SQL Server Express on CentOS:

                        And screw you Microsoft...

                        I had to manually type yes twice during a yum update -y

                        943590c1-c40b-4262-bbae-de87f1e7b4fd-image.png

                        I wonder if that affects yum-cron auto update schedule?

                        How could it not?

                        Yeah, has to break basic systems management and management practices. It would break Windows updates, too.

                        1 Reply Last reply Reply Quote 1
                        • Emad RE
                          Emad R @JaredBusch
                          last edited by

                          @JaredBusch

                          LEt me guess it is much faster on Linux than on Windows server, can you manage it using SQL server manager on Windows machine >?

                          JaredBuschJ 2 Replies Last reply Reply Quote 0
                          • JaredBuschJ
                            JaredBusch @Emad R
                            last edited by

                            @Emad-R said in Installing MS SQL Server Express on CentOS:

                            can you manage it using SQL server manager on Windows machine >?

                            Of course you can SSMS doens't care where the instance is. It doens't even know WHAT the instance is running on. It only connects to SQL.

                            I use Azure Data Studio on Linux and Windows instead of SSMS unless I need to do core management tasks that I don't know the SQL for (which most of those tasks I don't 😉 )

                            1 Reply Last reply Reply Quote 0
                            • JaredBuschJ
                              JaredBusch @Emad R
                              last edited by

                              @Emad-R said in Installing MS SQL Server Express on CentOS:

                              Et me guess it is much faster on Linux than on Windows server

                              No idea, but it is one less Windows Server license needed.

                              Also MS SQL Server Express works well for many tasks.

                              1 Reply Last reply Reply Quote 2
                              • 1 / 1
                              • First post
                                Last post