SQL Server on Linux Mint - linux-mint

I'm trying to install SQL Server vNext on Linux Mint.
when i run setup, I get the following error. any help would be highly appreciated.
Failed to issue method call: No such interface 'org.freedesktop.DBus.Properties'
on object at path /org/freedesktop/systemd1/unit/mssql_2dserver_2eservice

Installing SQL Server on Linux Ubuntu or Linux mint
You should install Microsoft odbc driver on your Linux, when you want to remote to a SQL server on any other operation system or work with sqlcmd (that it's support SQL server instructions).
First of all, you need to be super user:
sudo su
Then, add Microsoft packages repository to your own Linux.
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
Download appropriate package for the OS version
Choose only ONE of the following, corresponding to your OS version
lsb_release -a
Ubuntu 16.04
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
Ubuntu 18.04
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
Ubuntu 19.10, 20.04
curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
After that, exit from super user login.
exit
Update your aptitude package list cache.
sudo apt-get update
Install msodbcsql package. This is your Microsoft odbc driver.
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
sudo apt-get install unixodbc-dev
If you want to remotely connect to a SQL server on any other operating system (like windows), you can use only odbc driver. But, if you want to install sql server on your own Linux and using it, you should type this following commands:
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
ref:
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15
Removing:
https://dba.stackexchange.com/a/174176

Related

Error while adding dependencies in order to install apache age

In order to install Apache age from source,
i am installing development files for PostgreSQL server-side programming. For this i am using following command on my Ubuntu OS.
sudo apt install postgresql-server-dev-11
But i am getting this error "Unable to locate package postgresql-server-dev-11"
image of the error
i am searching online but did not find yet.It would be great if someone help.
This is because you do not have the correct Ubuntu version and the package does not exist.
To determine the major PostgreSQL version in a given release of Ubuntu find it here in Ubuntu Packages
18.04 has PostgreSQL 10 (postgresql-server-dev-10)
19.04 has PostgreSQL 11 (postgresql-server-dev-11)
20.04 has PostgreSQL 12 (postgresql-server-dev-12)
If you have ubuntu 19.04 you can follow this guide
In the case there is no maintainer for the Version of PostgreSQL you are trying to install you have to build from source.
Download your PostgreSQL version source code. Then run these commands.
tar xf postgresql-version.tar.bz2
cd postgresql-version
Install dependencies. Then run the following.
./configure
make
su
make install
adduser postgres
mkdir -p /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Reference from Official Docs
Seems the package is not available from your package manager. But, since you want development files, it's best to get the source code directly from GitHub.
In your home directory do:
git clone https://github.com/postgres/postgres.git
cd postgres
git checkout "REL_11_STABLE"
then follow this guide https://www.thegeekstuff.com/2009/04/linux-postgresql-install-and-configure-from-source/
Official documentation for installing from source is here https://www.postgresql.org/docs/current/installation.html
You should follow these steps:
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12
sudo systemctl status postgresql
I was also facing the same problem and i just updated my Ubunutu and the error got resolved when i run the command again
I faced the same issue on Ubuntu jammy(22.04 LTS).
If you are on the same version of Ubuntu as me, try using
sudo apt install postgresql-server-dev-all
Because neither
sudo apt install postgresql-server-dev-12
nor
sudo apt install postgresql-server-dev-11
worked for me.

Installing PostgreSQL Client v10 on AWS Amazon Linux (EC2) AMI

I have successfully launched new AWS RDS PostgreSQL v10 instance and need to install PostgreSQL v10 client on Amazon Linux EC2 instance.
I have tried to install it with yum, but it cant find the package for v10:
[ec2-user#ip-X-X-X-X ~]$ sudo yum install -y postgresql10
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
No package postgresql110 available.
Error: Nothing to do
Previously I managed to install PostgreSQL client v9.5 with:
[ec2-user#ip-X-X-X-X ~]$ sudo yum install -y postgresql95
I guess I need to add Postgres yum repository, as mentioned in https://www.postgresql.org/download/linux/redhat/. But what Platform should I choose for Amazon Linux? Red Hat?
You can try to run the following command on your Linux server:
sudo amazon-linux-extras install postgresql10
Packages/Repos which is designed to work of RedHat will work on Amazon Linux also, Amazon Linux is a minimal-install version of RHEL. You may run into compatibility issues if you select old version of Amazon Linux (Amazon linux 1) for the below steps, otherwise it should work fine in the latest version Amazon Linux 2.
Check Amazon Linux version
[ec2-user ~]$ cat /etc/system-release
Amazon Linux release 2.0 (2017.12) LTS Release Candidate
Install RHEL 7 yum repo for PostgreSQL
[ec2-user ~]$ sudo yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-latest-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"
Install PostgreSQL Client v10
[ec2-user ~]$ sudo yum install -y postgresql10
[ec2-user ~]$ psql --version
psql (PostgreSQL) 10.3
Read more about Amazon Linux 2
Note! Amazon Linux 2 provides additional package installation through Amazon Linux Extras Repository (amazon-linux-extras) ((client only)). Since postgresql10 is not yet available, adding extra yum repo is the only solution per today.
UDATE 2019May
those who see
Error: Package: pgdg-redhat-repo-42.0-4.noarch
(/pgdg-redhat-repo-latest.noarch)
Requires: /etc/redhat-release
may still install step by step all dependencies and the server with:
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-libs-10.7-2PGDG.rhel7.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-10.7-2PGDG.rhel7.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-server-10.7-2PGDG.rhel7.x86_64.rpm
Since none of the previous answers worked for me, I'm adding a solution that let me install the postgresql10 client. We're using VERSION="2018.03" of Amazon Linux AMI in our pipelines.
Building from source:
Note: The link below points to postgresql 10.4, you may want to check for newer subversions
sudo yum install -y gcc readline-devel zlib-devel
wget https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.gz
tar -xf postgresql-10.4.tar.gz
cd postgresql-10.4
./configure
make -C src/bin
sudo make -C src/bin install
make -C src/include
sudo make -C src/include install
make -C src/interfaces
sudo make -C src/interfaces install
make -C doc
sudo make -C doc install
The new package should be installed with all its executables in here: /usr/local/pgsql/bin
Now, keep in mind that commands psql, pg_dump etc. still point to the old version of the psql client. You can run with the full executable paths (/usr/local/pgsql/bin/psql) or prepend the new directory at the beginning of your $PATH so that the system will look it up first:
Edit ~/.bash_profile adding this at the end:
export PATH="/usr/local/pgsql/bin:$PATH"
Then run:
source ~/.bash_profile
Now everything should be ready:
[ec2-user#ip-xx-x-x-xxx ~]$ psql --version
psql (PostgreSQL) 10.4
Adapting Haneef Mohammed's answer for Amazon Linux 1 (tested on 2018.03):
Go to the Postgres repositories page and grab the URL for 'Red Hat Enterprise Linux 6 - x86_64'. Install the PG repos and amend the entries, replacing '$releasever' with '6.9' (or newer?):
[ec2-user ~]$ sudo yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm
[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-6.9-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"
Second part is the same:
[ec2-user ~]$ sudo yum install -y postgresql10
[ec2-user ~]$ psql --version
psql (PostgreSQL) 10.3
PGDG repo is no longer available for Amazon Linux. So you can use amazon repo.
amazon-linux-extras install postgresql10 vim epel -y
Or follow this article
https://installvirtual.com/install-postgresql-10-on-amazon-ec2/
As of May 25th, 2019, the following direct RPM installation worked for me on Amazon Linux 1 2018.03 (latest Beanstalk platform version) to install PostgreSQL Client 10.7:
sudo rpm -ivh --force https://yum.postgresql.org/testing/10/redhat/rhel-6-x86_64/postgresql10-libs-10.7-2PGDG.rhel6.x86_64.rpm
sudo rpm -ivh --force https://yum.postgresql.org/testing/10/redhat/rhel-6-x86_64/postgresql10-10.7-2PGDG.rhel6.x86_64.rpm
PSql10.7 installation (08/20/2019)
Remove all of the older version Psql client and perform the below steps:
wget https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
wget https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
This my 2019 solution:
Just do
sudo amazon-linux-extras install postgresql9.6
You should not have to download it from any outside source, since it is already given to you by default from Amazon, all you have to do is install it.
The other solutions didnt work for me and I spent a good amount time banging my head against the wall trying to figure out why.
And surprisingly even though you install psql9.6 you get version 10.
The following works for psql v11 on Amazon Linux (v1)
wget https://yum.postgresql.org/11/redhat/rhel-6.9-x86_64/postgresql11-libs-11.8-1PGDG.rhel6.x86_64.rpm
wget https://yum.postgresql.org/11/redhat/rhel-6.9-x86_64/postgresql11-11.8-1PGDG.rhel6.x86_64.rpm
sudo yum clean all
sudo rpm -ivh postgresql11-libs-11.8-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql11-11.8-1PGDG.rhel6.x86_64.rpm
The way I resolved the issue was by running
yum clean all
before
yum install -y postgresql10
on Amazon Linux
for v11 on Amazon Linux 2 I had to do
yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
sed -i "s/rhel-\$releasever-\$basearch/rhel-7-x86_64/g" "/etc/yum.repos.d/pgdg-11-centos.repo"

Uninstall older unixODBC completely and install 2.3.2 unixODBC in redhat 6.3

I am trying to install msodbcsql v13 in redhat 6.3. It shows dependency error for unixODBC(64 bit) >= 2.3.1 needs to be installed before installing msodbcsql.
I tried running below command,
odbcinst -j
It shows unixODBC 2.3.2 is installed.
Also i tried to some other way,
yum provides /usr/lib64/odbcinst.so.2.0.0
The above command shows, ODBC version 2.2 is installed.
Also if i run yum local install, it shows unixODBC 32 bit version available in machine.
To remove unixODBC, i tried the below commands. But not works out.
yum remove unixODBC
yum erase unixODBC
rpm -e unixODBC*
rpm rpm -qa | grep unixODBC
I want to remove all unixODBC available in the machine. And reinstall the actual version which we required.
Manual Installation
Remove any older installed version of unixODBC (for example, unixODBC 2.2.11). On Red Hat Enterprise Linux 5 or 6, execute the following command: yum remove unixODBC. On SUSE Linux Enterprise, zypper remove unixODBC.
Go to http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. Then click the appropriate link to save the file unixODBC-2.3.0.tar.gz to your computer. UnixODBC-2.3.1 is not supported with this release of the Microsoft ODBC Driver 11 for SQL Server.
On your Linux computer, execute the command: tar xvzf unixODBC-2.3.0.tar.gz.
Change to the unixODBC-2.3.0 directory.
At a command prompt, execute the command: CPPFLAGS="-DSIZEOF_LONG_INT=8".
At a command prompt, execute the command: export CPPFLAGS.
At a command prompt, execute the command: "./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE".
At a command prompt (logged in as root), execute the command: make.
At a command prompt (logged in as root), execute the command: make install.
For additional info - visit the site
To remove all unixODBC related packages, run:
sudo yum remove unixODBC*
To install newer version of unixODBC, try to install unixODBC-utf16 package.
Here are the suggested commands:
curl -s https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/msprod.repo
sudo yum update
sudo yum info unixODBC*
sudo yum install unixODBC-utf16
See also: Install the SQL Server command-line tools on Linux.
If above won't help, check: How to install Microsoft Drivers for PHP for SQL Server on Amazon Linux AMI.

How to start IDLE that comes with Python 3.6

I am using Linux Mint 18. I installed Python 3.5 and 3.6 using apt-get in the terminal. I can open IDLE of Python 2.7 and 3.5 using commands idle and idle3 respectively. How can I access IDLE that comes with Python 3.6?
Try the command idle3.6. python3 and idle3 are still associated with your system Python, which is 3.5.
Simply typing in idle3.6 should work just like carusot42 mentioned. If it doesn't work, perhaps you might want to see if everything else is installed correctly. Here are the steps I followed which worked perfectly fine for me. I am also running Linux Mint 18. The steps that I followed were:
Installed the prerequisites of Python. Do that by typing in the following commands -
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Download Python using the following command and extract it (use your desired location) -
cd /usr/src
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
sudo tar xzf Python-3.6.0.tgz
The next step is to compile Python source. To do that type in the commands below-
cd Python-3.6.1
./configure
sudo make altinstall
make altinstall is used to prevent replacing the default Python binary
file /usr/bin/python
You should be good to go. You check your Python version by typing python3.6 -V in the terminal.
Once you do that, type in idle3.6 and then Python 3.6.1 shell should open for you.
The Software Manager in Linux Mint lists the Python Packages and IDLE Packages
separately. After you install Python, go look up the associated IDLE package in the Software Manager and install it. Reboot and it should work fine. It worked for me.

How to upgrade OpenSSH on Centos

I'm using Centos 6 and openssh 5.3 and I want to upgrade to openssh 7 but I don't know how.
I have tried using google but have not found out how.
To update OpenSSH to the latest version that the CentOS repository has, run the following command:
su -c 'yum update'
This will perform a full system update. At the prompt (from the su part), enter your root password
For future reference, you may find the Unix & Linux Stack Exchange site to also be of use.
yum groupinstall "Development Tools"
yum install zlib-devel openssl-devel
cp /etc/ssh/sshd_config /etc/ssh/sshd_config
wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
tar -xzf openssh-9.0p1.tar.gz
cd openssh-9.0p1/
yum install pam-devel libselinux-devel
./configure --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh
make
make install
ssh -V