I uninstalled json-c library on Ubuntu 16.04 LTS using # make uninstall
and removed all rest json-c with:
# find / -name "*json-c*" -exec rm -rf {} /;
after reboot, can not log into system - Log In loop
# cat ~/.xsession-error
openConnection: connect: No such file or directory
cannot connect to brltty at :0
/sbin/upstart: error while loading shared libraries: libjson-c.so.2: cannot open shared object file: No such file or directory
Tried to reinstall json-c, it gives me a library named libjson-c.so.3 but not 2.
And system is under systemd, right?
# ps -e | grep systemd
1 ? 00:00:02 systemd
UPDATE:
here is how i fixed broken package
# apt-get download libjson-c2
# dpkg -i libjson-c2ww
Your find command removed more than just what was installed from the source install.
# apt -y install libjson-c2
I tried using the following commands. However when I reach the last step to install pdftk the console is giving me the error below. I am using a hostgator VPS server. any possible suggestions would be great.
NB: I tried installing libgcj.so.7rh()(64bit) but it already exists. maybe I am doing something wrong.
**Error:** Package: pdftk-1.44-2.el5.rf.x86_64 (rpmforge)
Requires: libgcj.so.7rh()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6')
These are the steps that I followed.
# Log in as root
cd /usr/local/src
# Type
uname -i
#To see which package you need
#Pick one of the below vdepending on the output of uname -i
i386<br>
wegt packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64 <br>
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
#Then type
rpm --import apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the downloaded package
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Install RPM
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Then
yum install pdftk
Note: I had to remove the http:// from the links in the commands above before posting.
It seems like you might have a 32-bit OS installed? If you ran through each of those commands in order, you would be trying to use the 64-bit rpmforge repository, which is incorrect for a 32-bit OS.
If that is an accurate supposition, do this..
cd /etc/yum.repos.d/
ls -al
rm <each-rpmforge-file>
Then...
cd /usr/local/src
yum clean
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum update
yum install pdftk
I'm in a corporate environment (running Debian Linux) and didn't install it myself. I access the databases using Navicat or phpPgAdmin (if that helps). I also don't have shell access to the server running the database.
Run this query from PostgreSQL:
SELECT version();
I believe this is what you are looking for,
Server version:
pg_config --version
Client version:
psql --version
Using CLI:
Server version:
$ postgres -V # Or --version. Use "locate bin/postgres" if not found.
postgres (PostgreSQL) 9.6.1
$ postgres -V | awk '{print $NF}' # Last column is version.
9.6.1
$ postgres -V | egrep -o '[0-9]{1,}\.[0-9]{1,}' # Major.Minor version
9.6
If having more than one installation of PostgreSQL, or if getting the "postgres: command not found" error:
$ locate bin/postgres | xargs -i xargs -t '{}' -V # xargs is intentionally twice.
/usr/pgsql-9.3/bin/postgres -V
postgres (PostgreSQL) 9.3.5
/usr/pgsql-9.6/bin/postgres -V
postgres (PostgreSQL) 9.6.1
If locate doesn't help, try find:
$ sudo find / -wholename '*/bin/postgres' 2>&- | xargs -i xargs -t '{}' -V # xargs is intentionally twice.
/usr/pgsql-9.6/bin/postgres -V
postgres (PostgreSQL) 9.6.1
Although postmaster can also be used instead of postgres, using postgres is preferable because postmaster is a deprecated alias of postgres.
Client version:
As relevant, login as postgres.
$ psql -V # Or --version
psql (PostgreSQL) 9.6.1
If having more than one installation of PostgreSQL:
$ locate bin/psql | xargs -i xargs -t '{}' -V # xargs is intentionally twice.
/usr/bin/psql -V
psql (PostgreSQL) 9.3.5
/usr/pgsql-9.2/bin/psql -V
psql (PostgreSQL) 9.2.9
/usr/pgsql-9.3/bin/psql -V
psql (PostgreSQL) 9.3.5
Using SQL:
Server version:
=> SELECT version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.9 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
=> SHOW server_version;
server_version
----------------
9.2.9
=> SHOW server_version_num;
server_version_num
--------------------
90209
If more curious, try => SHOW all;.
Client version:
For what it's worth, a shell command can be executed within psql to show the client version of the psql executable in the path. Note that the running psql can potentially be different from the one in the path.
=> \! psql -V
psql (PostgreSQL) 9.2.9
If you're using CLI and you're a postgres user, then you can do this:
psql -c "SELECT version();"
Possible output:
version
-------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.1 (Debian 11.1-3.pgdg80+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10+deb8u2) 4.9.2, 64-bit
(1 row)
The accepted answer is great, but if you need to interact programmatically with PostgreSQL version maybe it's better to do:
SELECT current_setting('server_version_num'); -- Returns 90603 (9.6.3)
-- Or using SHOW command:
SHOW server_version_num; -- Returns 90603 too
It will return server version as an integer. This is how server version is tested in PostgreSQL source, e.g.:
/*
* This is a C code from pg_dump source.
* It will do something if PostgreSQL remote version (server) is lower than 9.1.0
*/
if (fout->remoteVersion < 90100)
/*
* Do something...
*/
More info here and here.
Execute command
psql -V
Where
V must be in capital.
in shell psql.exe , execute
\! psql -V
Using pgadmin4 it can be seen by double clicking Servers > server_name_here > Properties tab > Version:
Version 3.5:
Version 4.1, 4.5:
A simple way is to check the version by typing psql --version in terminal
In my case
$psql
postgres=# \g
postgres=# SELECT version();
version
---------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.4.21 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.6.real (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
(1 row)
Hope it will help someone
The pg_config command will report the directory where the PostgreSQL programs are installed (--bindir), the location of C include files (--includedir) and object code libraries (--libdir), and the version of PostgreSQL (--version):
$ pg_config --version
PostgreSQL 9.3.6
use VERSION special variable
$psql -c "\echo :VERSION"
Using command line
Server:
postgres -V
Client:
psql -V
Login to postgres then:
postgres=# select version();
Or from cli:
psql -c "SELECT version();"
Use VERSION special variable
Login as postgres user:
sudo su - postgres
Then:
psql -c "\echo :VERSION"
Check out this guide here for full explaination
If you are already using for tool(used DBeaver) to connect PostgreSQL, it will look like this :
Useful Queries to Chck PostgreSQL Database Version
bash-4.1$ psql
postgres=# SELECT version();
postgres=# SHOW server_version;
To Check PostgreSQL Client Version.
bash-4.1$ psql --version
psql (PostgreSQL) 12.1
Run this query from PostgreSQL:
SELECT version();
If you have shell access to the server (the question mentions op does not have, but in case you have,) on a debian/ubuntu system
sudo apt-cache policy postgresql
which will output the installed version,
postgresql:
Installed: 9.6+184ubuntu1.1
Candidate: 9.6+184ubuntu1.1
Version table:
*** 9.6+184ubuntu1.1 500
500 http://in.archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages
500 http://in.archive.ubuntu.com/ubuntu artful-updates/main i386 Packages
500 http://security.ubuntu.com/ubuntu artful-security/main amd64 Packages
500 http://security.ubuntu.com/ubuntu artful-security/main i386 Packages
100 /var/lib/dpkg/status
9.6+184ubuntu1 500
500 http://in.archive.ubuntu.com/ubuntu artful/main amd64 Packages
500 http://in.archive.ubuntu.com/ubuntu artful/main i386 Packages
where the Installed: <version> is the installed postgres package version.
Don’t know how reliable this is, but you can get two tokens of version fully automatically:
psql --version 2>&1 | tail -1 | awk '{print $3}' | sed 's/\./ /g' | awk '{print $1 "." $2}'
So you can build paths to binaries:
/usr/lib/postgresql/9.2/bin/postgres
Just replace 9.2 with this command.
For the current version of PgAdmin: 4.16 at the time of writing.
Select the DB server whose version you need.
Click on the properties tab in
the right pane.
See screenshot below:
This is quite an old question with many good answers. I found that from version 12 onwards, simply invoking the client tells me what I need to know, but I ran them on the server's shell. Examples below with output.
When I was on version 12:
$ sudo su postgres -c "psql"
psql (12.8 (Ubuntu 12.8-0ubuntu0.20.04.1))
I read this as both the client and the server are at version 12.
After I upgraded Ubuntu from 20.04 to 21.04:
$ sudo su postgres -c "psql"
psql (13.4 (Ubuntu 13.4-0ubuntu0.21.04.1), server 12.8 (Ubuntu 12.8-0ubuntu0.20.04.1))
It's telling me clearly that the client is on version 13 but the server is still on 12, as I confirmed:
$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
12 main 5432 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
Notice, by the way, this misleading result, at this stage:
$ pg_config --version
PostgreSQL 13.4 (Ubuntu 13.4-0ubuntu0.21.04.1)
After I upgraded to version 14:
$ sudo su postgres -c "psql"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.
postgres=#
Again, I interpret it as both the client and the server being on version 14, confirmed once more:
$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
12 main 5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14 main 5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
This version is, by the way, the same obtained by running the SELECT version(); query.
If Select version() returns with Memo try using the command this way:
Select version::char(100)
or
Select version::varchar(100)
Many months ago, I installed postgres 8.4 using the following command:
$ sudo aptitude install postgresql-8.4 postgresql-client postgresql-contrib
Now I am trying to upgrade to 9.1.
$ sudo aptitude install postgresql-9.1
There apparently is no package that matches 9.1 But it does appear to exist for apt-get. Do I have to go with apt-get?
This may help you out:
http://www.postgresql.org/docs/9.1/static/upgrading.html
or else you can follow these steps:
As root:
su - postgres
pg_dumpall > dump.sql
exit
cp ~postgres/dump.sql /root/
Now you can safely remove the postgresql-8.4 and install postgresql-9.1:
aptitude purge postgresql-8.4
aptitude install postgresql-9.1
Next check the postgresql configuration in /etc/postgresql/9.1/main. If you make any changes, make sure to restart postgres with /etc/init.d/postgresql restart.
Postgresql 9.1 is now up and running, let's import our data back into it.
su - postgres
psql < dump.sql
That's all. You're now fully upgraded to PostgreSQL 9.1
edit:
similar question was asked here:
https://askubuntu.com/questions/66194/how-do-i-migrate-my-postgres-data-from-8-4-to-9-1
I am currently using Red Hat linux. I just want to find out whether MySQL is installed in that system. If yes where is it located? can anyone help please...
Type mysql --version to see if it is installed.
To find location use find -name mysql.
If you're looking for the RPM.
rpm -qa | grep MySQL
Most of it's data is stored in /var/lib/mysql so that's another good place to look.
If it is installed
which mysql
will give you the location of the binary.
You could also do an
updatedb
and a
locate mysql
to find any mysql files.
yum list installed | grep mysql
Then if it's not installed you can do (as root)
yum install mysql -y
to ckeck the status use the below command, which worked on debian....
/etc/init.d/mysql status
to start my sql server use the below command
/etc/init.d/mysql start
to stop the server use the below command
/etc/init.d/mysql stop
Usually you can find a program under a subdirectory "../bin".
System programs are under /usr/bin or /bin. To check where files of mysql package are placed, on RHEL 6 type like this :
rpm -ql mysql (which is the main part of the package)
and the result is a list of "exe" files such as "mysqladmin" tool. About to know the version of the server, run the command:
mysqladmin -u "valid-user" version
rpmquery <package Name> By this command you can check which package is installed.
For Example: rpmquery mysql