Install unixODBC >= 2.3.1 on Linux Redhat/CentOS for msodbcsql17

前端 未结 2 543
醉梦人生
醉梦人生 2021-01-13 21:41

I try to install msodbcsql17 on AWS EC2 with CentOS/RedHat (Linux).

These are the steps, I have followed, from Microsoft (LINK):

sudo su

#Download          


        
相关标签:
2条回答
  • 2021-01-13 22:24

    After a long time of research, I have figured out a solution:

    1. Download the unixODBC >= 2.3.1 from any source, as rpm (Example source)
    2. Download the msodbcsql17 and mssql-tool as rpm from Microsoft (Link to Repo) (msodbcsql17-17.1.0.1-1.x86_64.rpm and mssql-tools-17.1.0.1-1.x86_64.rpm in my case)
    3. Transfer the files via ftp (like FileZilla) to the EC2 instance
    4. Use EC2 terminal and go to the directory of the uploaded files
    5. Enter sudo rpm -i unixODBC-2.3.1-11.el7.x86_64.rpm to install the necessary version (Perhaps, you have to change the version number to the version number of the uploaded file)
    6. Enter sudo rpm -i msodbcsql17-17.1.0.1-1.x86_64.rpm
    7. Enter sudo rpm -i mssql-tools-17.1.0.1-1.x86_64.rpm

    8. Follow the rest of the Microsoft instruction, like in your question.

    9. Now you should be able to use ODBC for example with pyodbc in python.

    Instead of rpm -i, you can use yum install as well


    UPDATE: Please take a look at the comment from @KnudLarsen!

    0 讨论(0)
  • 2021-01-13 22:25

    heres a snippet from my docker file that shows how to install on amazon linux:

    RUN curl http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-2.3.1-14.el7.x86_64.rpm > /tmp/unixODBC-2.3.1-14.el7.x86_64.rpm
    RUN yum -y install /tmp/unixODBC-2.3.1-14.el7.x86_64.rpm 
    RUN curl http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-devel-2.3.1-14.el7.x86_64.rpm > /tmp/unixODBC-devel-2.3.1-14.el7.x86_64.rpm 
    RUN yum -y install /tmp/unixODBC-devel-2.3.1-14.el7.x86_64.rpm 
    
    RUN curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
    RUN ACCEPT_EULA=Y yum -y install msodbcsql17
    

    bonus if you want pyodbc:

    RUN yum -y install gcc72-c++ \
        && yum -y install python36-devel \
        && yum -y install zip \
        && yum clean all
    RUN python3.6 -m pip install --upgrade pip 
    RUN python3.6 -m pip install pyodbc
    

    https://github.com/Microsoft/msphpsql/issues/496#issuecomment-569938591

    0 讨论(0)
提交回复
热议问题