How can I install SQL Server 2012 on ubuntu?
You can't install MSSQL Server 2012 on Ubuntu. It's not on supported OS list.
But you can install MSSQL Server 2017. This doc page has instructions:
Import the public repository GPG keys:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register the Microsoft SQL Server Ubuntu
repository:
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
Note
This is the Cumulative Update (CU) repository. For more information
about your repository options and their differences, see Change source
repositories.
Run the following commands to install SQL Server:
sudo apt-get update
sudo apt-get install -y mssql-server
After
the package installation finishes, run mssql-conf setup and follow the
prompts to set the SA password and choose your edition.
sudo /opt/mssql/bin/mssql-conf setup
Tip
If you are trying SQL Server 2017 in this tutorial, the following
editions are freely licensed: Evaluation, Developer, and Express.
Note
Make sure to specify a strong password for the SA account (Minimum
length 8 characters, including uppercase and lowercase letters, base
10 digits and/or non-alphanumeric symbols).
Once the configuration is done, verify that the service is running:
systemctl status mssql-server
If you plan to connect remotely,
you might also need to open the SQL Server TCP port (default 1433) on
your firewall.
To install the mssql-server Package on Ubuntu, follow these steps:
Enter superuser mode. ...
Exit superuser mode. ...
Run the following commands to install SQL Server: sudo apt-get update sudo apt-get install -y mssql-server.
After the package installation finishes, run the configuration script and follow the prompts.
for more details look Installing SQL on Ubuntu
Related
I am trying to install MSSQL-Server on my Ubuntu 22.04. I know that it does not currently support Ubuntu 22.04. I need to find a workaround to install the software as I don't want to downgrade.
I tried installing but it keeps giving me dependency errors. How do I solve it? Any help would be appreciated.
Unfortunately, at this time, SQL Server 2019 only works on Ubuntu 20/21. 22.04 is not supported at this time.
So either you will have to use Ubuntu 20 or, as others have stated, use Docker Containers.
You can install Docker into Ubuntu 22.04. It's a multi-step process, but it isn't that difficult.
Install Docker Engine on Ubuntu (follow the Install using the repository section)
https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository
Install SQL Server Container
https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash
That should do it.
Also, in link #2, read further below on how to connect to your docker image to run SQLCMD from within the container.
Like SQL Server 2019, you cannot install the SQLCMD tools directly into your Ubuntu 22.04 installation. But the Docker container image contains the sqlcmd tool for you to be able to connect to the database.
Or, you can use Visual Studio Code with the SQL Server (mssql) extension and it can connect to your SQL Server instance in your running Docker container.
The connection string would be:
"Server=localhost;Database=your database name;User Id=user id;Password=password"
You can leave out the Database setting if you just want to connect to the default database.
If you create any databases, you can then connect to them directly by specifying the name.
I also have same problem like this. I also tried downgrading Openssl to 1.1.1k and 1.1.1s but still not works. And finally I found this explanation
https://github.com/microsoft/msphpsql/issues/1419#issuecomment-1303626500
So, keep use OpenSSL 3.0.2 and you just need to change the SECLEVEL to 0 instead of 1 in /etc/ssl/openssl.conf
[system_default_sect]
CipherString = DEFAULT:#SECLEVEL=0
And it works, now I can connect to SQL Server using Ubuntu 22.04.
Looked at this
and it has worked for me!
So worth giving it a shot
cd /opt/mssql/lib
ls -la
sudo rm libcrypto.so libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 libcrypto.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.1 libssl.1.1
If libssl is not installed, try:
sudo apt install libssl1.1
Update: I had issues connecting using libssl1.1, so I switched to 1.0 after performing the previous steps, so I also did the following:
sudo systemctl stop mssql-server
sudo systemctl edit mssql-server
Added:
[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
Then:
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
Then started mysql-server and things just worked fine!
I'm going to configure Airflow within Azure and we have a SQL Database available in the cloud, can I configure it within the airflow? Or does it need to be postgres?
If possible, could you put an example of his using the sql_alchemy_conn variable?
I found a document Setting up Airflow on Azure & connecting to MS SQL Server may could help you.
Summary:
MSSQL:
Azure offers scalable managed SQL Server instances, which proves to be a good choice for a data repository. The base image of airflow from puckels’ however doesn’t interact with this database. In this specific case we are not looking at setting up a database to host airflow metadata (although possible), but rather as a target destination from some of the dags.
In order to take advantage of a connection to MsSQL, the MsSQL driver needs to be installed. The documentation on how to setup this driver for Linux is provided on Microsoft’s website. Since the latest puckel/docker-airflow image is based on “python:3.6-slim”, itself based on debian 9 “stretch”, we can add these dependencies to the image, by following the Debian 9 documentation on Microsoft’s website:
RUN apt-get install --reinstall build-essential -y
RUN apt-get update
RUN apt-get install gcc unixodbc-dev gnupg2 apt-transport-https curl -y \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install msodbcsql17 -y
RUN ACCEPT_EULA=Y apt-get install mssql-tools -y
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
Once this is done a few packages will need to be installed through pip:
RUN pip install 'apache-airflow[mssql]' \
'pyodbc' \
'pymssql'
The airflow[mssql] package adds the operator and hooks to interact with MsSQL while pyodbc and pymsqsl, provides a database interface to MsSQL. After having installed the driver and the python packages, we can now connect to the specified MsSQL server, using a SQL Alchemy connection string in the following format:
connectionString = \
"mssql+pyodbc://{user}:{pwd}#{host}:{port}/{db}?driver=ODBC+Driver+17+for+SQL+Server"
Hope this helps.
I am planning moving on to the Centos 8 but it seems that I cannot get a working PDO connection with SQL server using just plain Centos 8 packages.
I have installed the unixODBC packages and after that from PECL sqlsrv and sqlsrv_pdo but I can't figure out how to make the actual connection or odbc configuration.
As most of my code to be transferred to the new environments is written using PDO, I wouldn't want to change it to sql server native.
Are there any step-by-step instructions how to build PDO ODBC connection to sql server without using freetds, which isn't available through the centos repositories (or RHEL either).
I faced the same issue and I solved it as follow:
sudo dnf install php-pear
sudo dnf install php-devel
sudo dnf install make
sudo pecl install sqlsrv
sudo dnf install unixODBC-devel
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
then:
sudo nano /etc/php.d/30-pdo_sqlsrv.ini
Add in the file 30-pdo_sqlsrv.ini:
extension=pdo_sqlsrv.so
then:
sudo nano /etc/php.d/20-sqlsrv.ini
Add in the file 20-sqlsrv.ini:
extension=sqlsrv.so
Download and install msodbcsql17-17.4.2.1-1.x86_64.rpm from https://packages.microsoft.com/rhel/8/prod/
sudo yum install msodbcsql17-17.4.2.1-1.x86_64.rpm
Then just need to restart php-fpm
sudo systemctl restart php-fpm.service
Good luck!
I have information about the connection like username, password, host, port, SID and i know that is an oracle database but i don't know how to connect. I am on lubuntu 18.04.
You can use sqlplus to connect to remote Oracle db server and execute queries.
For this purpose, firstly install sqlplus by the information written in https://help.ubuntu.com/community/Oracle%20Instant%20Client page. You will basically execute below commands.
First of all download the .rpm files from here: https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html
For x64 version
https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
For x86 version
https://www.oracle.com/technetwork/topics/linuxsoft-082809.html
Then install alien to convert .rpm files into .deb package and install the package automatically.
sudo apt update
sudo apt install alien
After downloading into a directory, execute below commands;
Currently last version that is available for Linux is 18.3. So for example, rpm files can be as below.
Assuming that you are in your home directory and downloaded files into that location.
sudo alien -i /home/yourusername/oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
(Mostly 3 of them are installed)
Then test your connection as below
sqlplus username/password#//dbhostname:port/SID
sqlplus64 username/password#//dbhostname:port/SID (If you installed sqlplus x64 version)
Also the given above Ubuntu documentation page tells about solutions of problems if you encounter any of them like below part.
If you execute sqlplus and get "sqlplus: command not found", see the
section below about adding the ORACLE_HOME variable.
If sqlplus complains of a missing libsqlplus.so file, follow the steps
in the section "Integrate Oracle Libraries" below.
If sqlplus complains of a missing libaio.so.1 file, run
sudo apt install libaio1
or, if you're installing the 32 bit
instant client on 64 bit,
sudo apt install libaio1:i386
After all these operations, you can also install "rlwrap" and integrate with sqlplus to bring the auto-completion and decent input history.
sudo apt install rlwrap
rlwrap sqlplus username/password#//dbhostname:port/SID
Or you can define an alias.
alias sqlpl='rlwrap sqlplus username/password#//dbhostname:port/SID'
sqlpl
Lastly, don't forget to replace sqlplus with sqlplus64 if you have installed x64 version.
What does the yum and -y means
yum install httpd -y
new to fedora. please guide me.
the above code will install Apache server in fedora
yum is a software package manager that installs, updates, and removes packages on RPM-based systems. It automatically computes dependencies and figures out what things should occur to install packages. yum makes it easier to maintain groups of machines without having to manually update each one using rpm.
-y means that we did't want to gave yes to install any package (here httpd)
httpd installs apache web server
Thanks for Support and advice