how to install postgresql on Linux - postgresql

I'm new to Linux and have been using KDE for a little while. I'm working on learning more ruby on rails. The book I'm reading uses postgresql but I cannot find a walkthrough of installing postgresql on KDE. On this page - https://yum.postgresql.org/repopackages.php#pg10 - it doesn't list an rpm for KDE so I'm not sure if there's another one I can use or not. I don't know enough about Linux/KDE yet to know. Does anyone know if I can use any of the packages on that page or if there's another way to install postgresql on KDE?

Simple solution
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
sudo -i -u postgres
psql

So KDE is your desktop. It could be used on almost any operating system, and probably doesn't determine your install. It's more about distros/OS that you're on. So, what OS are you on? Wild guess Fedora or Ubuntu. Here are the install guides for each:
Fedora: https://fedoraproject.org/wiki/PostgreSQL
Ubuntu: https://www.postgresql.org/download/linux/ubuntu/
Neither is as bad as it seems. Just take them step by step.
BTW, in the Linux world the command line is king. At first, this will seem daunting, but after a while, you'll find it faster for many things. Maybe Learn Enough Command Line to Be Dangerous would help.

Related

How I can open pgadmin4 in fedora 36?

Good evening people, I am trying to install pgadmin4 on fedora 36, I followed all the steps in the documentation and pgadmin4 and its dependencies were installed correctly but I do not know how to start it, or open it and it does not let me configure it on the web because I do not create the directory described in the final step to configure the web version.
I had the same problem. I solved it installing pgadmin4 from linux-pachages
https://linux-packages.com/fedora-36/package/pgadmin4-qtx86-64
I followed the same instructions but mistakenly changing "yum" to "dnf" out of force of habit. I found I got an install out of it which seemed OK at a glance, but it was just documentation and not an executable, and there was no shortcut added to run pgAdmin. Perhaps you might have inadvertently done something similar? After uninstalling, I tried again using "yum" exactly as documented and the latest executable installed without any issue. So the steps to install that would work for me were as follows. (Desktop version in my case.)
sudo rpm -e pgadmin4-fedora-repo
sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-fedora-repo-2-1.noarch.rpm
sudo yum install pgadmin4-desktop
The QT workaround also mentioned as an answer worked for me, but I wanted to avoid that since it is an earlier release (6.9) than the current 6.11, isn't officially supported and fires a warning about that every time on start up saying some functionality may be missing, which is not good for clients to see potentially in my case.
Same problem - couldn't open it after installing. You have to install pgadmin4-desktop not pgadmin4.

installing ipython on rhel7

I'm a RHEL newbie. I'm used to a non-Linux Unix, which has a fundamentally different way of dealing with packages.
I want to install ipython for a user on a vanilla RHEL7 system with yum as the package manager.
"yum install python" was fairly straightforward, but given that I'm new to the OS and I don't completely understand what ipython is, I am stumped as to how to proceed.
"yum install ipython" obviously doesn't work and every possible solution seems to require the installation of something else that I don't know how to install in a reasonable manner.
I am trying to keep things as generic as possible so it will be obvious how to update/remove software in the future, so anything that can be done with yum, would be probably preferable.
Installation instructions refer to pip, which I don't have. I possibly need setuptools to run pip, but I can't figure out the appropriate way to get that either. Maybe I can get one or either by installation the EPEL bundle of packages, but I can't find those for RHEL7, at least not in a way that doesn't seem like a "download and install this random file, trust us" method, which seems irresponsible.
Another option is anaconda. Again, there doesn't seem to be a yum-related way to install this, and anaconda itself is only a means to an end to download ipython, so that'd be two levels of abstraction away from the goal.
Additionally, do I even want "ipython" these days, or do I want "jupyter"?
All I care about is that the user should be able to type in "ipython" at the prompt and get the thing he is expecting.
Also, the python installed by yum is 2.7.5-48.el7, which does not seem to be current. I don't care about using the current version unless that prevents me from successfully installing ipython in some other manner, but I thought it might be relevant.
Any suggestions for how to install this thing is the most easily maintainable way? Do I not want the yum version of python?
Thanks for your patience.
Install python-pip from EPEL repository first ( https://fedoraproject.org/wiki/EPEL - it's compatible with all Red Hat entrprise Linux distros - be it CentOS, RHEL, Oracl, ScientificLinux or whatever), (or if you don't trust EPEL repo providers you can use get-pip.py ( https://bootstrap.pypa.io/get-pip.py ) script, but then you have to trust its providers instead) then install via
pip install ipython

Installing Text::Fuzzy in cygwin 64 bit version

I am currently working to develop a code which helps me to find a closest string match for a given string from a list of strings. I came across a Perl module Text::Fuzzy which helps me to do that. But i am working on cygwin and a having hard time installing it properly by using cpan commands. So how do i properly install it?
Can't exec "make": No such file or directory at /usr/lib/perl5/5.22/CPAN/Distribution.pm
This means that make is missing. You will have to install make to be able to install a Perl module.
Just do
apt-get install build-essential
Edit: Since you are using cygwin, please refer the link which xxfelixxx has suggested.

How do I install older version of postgresql and postgis?

I am new to Linux and I found it really difficult to install older version of postgresql (along with postgis). I have uninstalled everything I could find connected to postgresql in aptidude. As only the newest version is available through apt-get install, I have went through several tutorials how to get 9.1 installed.
Example: https://wiki.postgresql.org/wiki/Apt (with 9.1 at the end, not 9.3)
After I was done with this tutorial, pgAdmin III is still showing 9.3 as version.
What's the correct way to dump 9.3 and install 9.1 as well as postgis 1.5?
I am using Mint 17
Okay. First off it is perfectly fine to run multiple versions of postgresql alongside one another. You can have more than one cluster on a box, and each cluster can run different versions. The debian pacakges are very well designed to make this easy to do.
However since you've indicated you're a newby to linux/postgresql it's probably best to get 9.3 completely cleaned from your system to avoid frustrating hiccups which will take you a long time to figure out.
To do this you need to:
Purge all postgresql 9.3 packages from dpkg
Manually delete any 9.3 data and configuration for 9.3 cluster
Make sure you've created a 9.1 cluster
Step 1 – purge DPKG
DPKG manages the packages on your system. APT acts as a mechanism for getting packages to install. A lot of DPKG functionality is available through apt, but some things are just easier on dpkg. In your comments you've shown that DPKG is still showing remnants of 9.3. When you uninstall a package some parts of it may hang around (such as configuration files). You can remove multiple packages in one command. To get rid of these completely you can tell dpkg to purge them dpkg --purge <package name>. You can remove multiple packages in one command and it's best to do so.
dpkg --list will list everything on your system. dpkg --list | grep postgresql searches this list for postgresql.
Step 2 – Manually delete data and configuration from the old 9.3 cluster.
When you first install postgresql it creates a cluster for you; no questions asked. This trips up a lot of new users because they neither knew that it happened nor how to replace it. Now that 9.3 is uninstalled you can go ahead and simply delete the configuration and data:
If there was anything you wanted to keep in the installed 9.3 database DO NOT run the following commands
sudo rm -rf /etc/postgresql/9.3 Removes the configuration.
sudo rm -rf /var/lib/postgresql/9.3 Removes the data.
Step 3 – Create a new cluster
You've indicated in comments that postgresql 9.1 is installed. Before you run this command it's worth reading the manual. man pg_createcluster.
sudo pg_createcluster 9.1 <think up a name>
Now you should be able to start up postgresql sudo service postgresql start
Edit
If pg_config is still listing the incorrect version then... this can be a result of remnants of 9.3 still left on your system. This may not be a problem. To allow multiple versions to run along side one another pg_config is a wrapper script which searches for the latest (highest version) of /usr/lib/postgresql/*/bin/pg_config. So what you're seeing is the result of running /usr/lib/postgresql/9.3/bin/pg_config. If 9.3 is completely cleaned from your system then /usr/lib/postgresql/9.3 should have gone.
If you want to see the configuration of 9.1 then try running:
/usr/lib/postgresql/9.1/bin/pg_config.
The wrapper scripts which starts the server will use the file structure of /etc/postgresql and use the apropriate version. So /etc/postgresql/9.1/main will startup version as 9.1.

Installing PDO-drivers for PostgreSQL on Mac (using Zend for eclipse)

How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.
I had to install the PDO_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I've found can help others (like myself) who will undoubtedly run into similar problems.
The first thing you'll need to do is install PEAR, if you haven't done so already, since it doesn't come installed on Leopard by default.
Once you do that, use the PECL installer to download the PDO_PGSQL package:
$ pecl download pdo_pgsql
$ tar xzf PDO_PGSQL-1.0.2.tgz
(Note: you may have to run pecl as the superuser, i.e. sudo pecl.)
After that, since the PECL installer can't install the extension directly, you'll need to build and install it yourself:
$ cd PDO_PGSQL-1.0.2
$ phpize
$ ./configure --with-pdo-pgsql=/path/to/your/PostgreSQL/installation
$ make && sudo make install
If all goes well, you should have a file called "pdo_pgsql.so" sitting in a directory that should look something like "/usr/lib/php/extensions/no-debug-non-zts-20060613/" (the PECL installation should have outputted the directory it installed the extension to).
To finalize the installation, you'll need to edit your php.ini file. Find the section labeled "Dynamic Extensions", and underneath the list of (probably commented out) extensions, add this line:
extension=pdo_pgsql.so
Now, assuming this is the first time you've installed PHP extensions, there are two additional steps you need to take in order to get this working. First, in php.ini, find the extension_dir directive (under "Paths and Directories"), and change it to the directory that the pdo_pgsql.so file was installed in. For example, my extension_dir directive looks like:
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
The second step, if you're on a 64-bit Intel Mac, involves making Apache run in 32-bit mode. (If there's a better strategy, I'd like to know, but for now, this is the best I could find.) In order to do this, edit the property list file located at /System/Library/LaunchDaemons/org.apache.httpd.plist. Find these two lines:
<key>ProgramArguments</key>
<array>
Under them, add these three lines:
<string>arch</string>
<string>-arch</string>
<string>i386</string>
Now, just restart Apache, and PDO_PGSQL will be up and running.
Take a look at this PECL package: PDO_PGSQL
I haven't tried it myself, but I've been interested in playing with Postgres as an alternative to MySQL. If I have a chance to try it soon, I'll throw my results up here in case it helps.
I'm not sure this will help with the PDO drivers specifically, but you might look into BitNami's MAPPStack.
I had a ton of trouble with Postgres, PHP, and Apache on my Mac, some of it having to do with 64- vs 32-bit versions of some or all of them. So far, the BitNami MAPPStack install is working nicely in general. Maybe it will help with your PDO issues as well.
Install new php version via brew and restart server, and php -v, all issues are removed.
This is what worked for me
brew install php55-pdo-pgsql
This installs PHP 5.5.32 and PostgreSQL 9.5. I already had PostgreSQL 9.4 installed so I uninstalled the homebrew version with:
brew uninstall postgres
You then have to update /etc/apache2/httpd.conf to point to the correct PHP version and restart Apache:
LoadModule php5_module /usr/local/Cellar/php55/5.5.32/libexec/apache2/libphp5.so
My OSX version is Yosemite.