Unable to create spatial database for geodjango on Mac OS X - macos

I am trying to install PostGIS for MacOS X and uptil now this is what i got
PostGIS is now configured for x86_64-apple-darwin10.8.0
-------------- Compiler Info -------------
C compiler: gcc -g -O2
C++ compiler: g++ -g -O2
-------------- Dependencies --------------
GEOS config: /usr/local/bin/geos-config
GEOS version: 3.3.3
PostgreSQL config: /usr/local/pgsql/bin/pg_config
PostgreSQL version: PostgreSQL 9.1.3
PROJ4 version: 48
Libxml2 config: /usr/bin/xml2-config
Libxml2 version: 2.7.3
JSON-C support: yes
PostGIS debug level: 0
Perl: /usr/bin/perl
--------------- Extensions ---------------
PostGIS Raster: disabled
PostGIS Topology: enabled
-------- Documentation Generation --------
xsltproc: /usr/bin/xsltproc
xsl style sheets:
dblatex:
convert:
mathml2.dtd: http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
Does this mean that PostGIS is now installed? Why is the PostGIS Raster disabled?
Also when i follow the tutorial I am getting this error
createdb -E UTF8 template_postgis
createdb: could not connect to database postgres: FATAL: role "root" does not exist
Then i checked for the command
sudo su - postgres
and it returns 1 for echo $?

This means that PostGIS is configured, as the first line says.
Typically you proceed with make and make install. After this is done you'll have PostGIS libraries ready, but you'll have to create PostGIS support functions on the database level, something like this: psql -c spatial_ref_sys.sql
I would recommend consulting also the official docs.
Your error message means that you're trying to connect to the database with the user / to the database that doesn't exists there. By default, PostgreSQL tools will try username / database that match your current unix user, which seems to be root.
And keep in mind that it is a very bad practice to work under root account.

Related

How to install Perl DBD::Oracle with Oracle Instant Client on macOS Catalina

I'm running macOS Catalina 10.15.7 and I need to install Oracle Instant Client to run run a Perl script that connects to a DB.
1. Installing Oracle Instant Client
I downloaded the packages I needed:
Basic Light Package (DMG)
SDK Package (DMG)
ODBC Package (DMG)
From Instant Client 19.8 and followed the installation instructions without any issues (just copying and pasting)
The files are extracted in /Users/username/Downloads/instantclient_19_8
2. Setting ORACLE_HOME
Next, I did set ORACLE_HOME to /Users/username/Downloads/instantclient_19_8
export ORACLE_HOME=/Users/username/Downloads/instantclient_19_8
3. Installing DBD::Oracle
When I tried to install DBD::Oracle I got the following error:
$ cpanm DBD::Oracle
--> Working on DBD::Oracle
Fetching http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz ... OK
Configuring DBD-Oracle-1.80 ... N/A
! Configure failed for DBD-Oracle-1.80. See /Users/username/.cpanm/work/1608142485.48272/build.log for details.
The log file's content:
$ cat /Users/username/.cpanm/work/1608142485.48272/build.log
cpanm (App::cpanminus) 1.7044 on perl 5.032000 built for darwin-thread-multi-2level
Work directory is /Users/username/.cpanm/work/1608142485.48272
You have make /usr/bin/make
You have LWP 6.47
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Searching DBD::Oracle () on cpanmetadb ...
--> Working on DBD::Oracle
Fetching http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz
-> OK
Unpacking DBD-Oracle-1.80.tar.gz
Entering DBD-Oracle-1.80
Checking configure dependencies from META.json
Checking if you have Config 0 ... Yes (5.032000)
Checking if you have Encode 0 ... Yes (3.06)
Checking if you have Math::BigInt 0 ... Yes (1.999818)
Checking if you have Devel::Peek 0 ... Yes (1.28)
Checking if you have Test::More 0 ... Yes (1.302177)
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.44)
Checking if you have Data::Dumper 0 ... Yes (2.174)
Checking if you have DBI 1.623 ... Yes (1.643)
Checking if you have Test::NoWarnings 0 ... Yes (1.04)
Configuring DBD-Oracle-1.80
Running Makefile.PL
Using DBI 1.643 (for perl 5.032000 on darwin-thread-multi-2level) installed in /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.0/darwin-thread-multi-2level/auto/DBI/
Configuring DBD::Oracle for perl 5.032000 on darwin (darwin-thread-multi-2level)
If you encounter any problem, a collection of troubleshooting
guides are available under lib/DBD/Oracle/Troubleshooting.
'DBD::Oracle::Troubleshooting' is the general troubleshooting
guide, while platform-specific troubleshooting hints
live in their labelled sub-document (e.g., Win32
hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod').
Trying to find an ORACLE_HOME
Your DYLD_LIBRARY_PATH env var is set to ''
The ORACLE_HOME environment variable is not set and I couldn't guess it.
It must be set to hold the path to an Oracle installation directory
on this machine (or a machine with a compatible architecture).
See the appropriate troubleshooting guide for your OS for more information.
ABORTED!
-> N/A
-> FAIL Configure failed for DBD-Oracle-1.80. See /Users/username/.cpanm/work/1608142485.48272/build.log for details.
I've read here that ORACLE_HOME should be set to the value of the directory that contains the /bin directory but I can't find any /bin.
macOS is always changing, but on Mojave I installed Instant Client from the DMGs and then did:
brew install perl
ln -s $HOME/Downloads/instantclient_19_8 $HOME/instantclient
export DYLD_LIBRARY_PATH=$HOME/instantclient
cpan -i -T DBI
cpan -i -T DBD::Oracle
In general, never set ORACLE_HOME for Instant Client. (It can cause the wrong config files to be read). ORACLE_HOME is used for a 'full' database or full client installation, not for Instant Client. However some installers still reference the variable to find build files, so you will need it - at least at build time. DBD::Oracle will internally search for Instant Client and use $HOME/instantclient if $ORACLE_HOME isn't set.
macOS has gradually removed the usefulness of DYLD_LIBRARY_PATH, since it isn't propagated to subshells. This means it can't reliably be used. On Mojave I found I could alternatively copy the Instant Client libraries to $HOME/lib/ and didn't need to set DYLD_LIBRARY_PATH.
Side note: if you're using DBD::Oracle you don't need the Instant Client ODBC package.
Christopher Jones answer was not enough for me (macOS Monterey 12.2, Apple M1 Pro). The installation stopped with
./Oracle.h:37:10: fatal error: 'oci.h' file not found
To fix this, installation of Oracle SDK Package was required https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst
Second comment:
export DYLD_LIBRARY_PATH=$HOME/instantclient
does not work (see Bash variable of name starting with 'DYLD' is not loaded into environment: bug or feature? )
==================================================
But this is not the end-of-the-problem. The installed DBD::Oracle can not be used. It fails:
Can't load '/Users/myname/.perlbrew/libs/perl-5.34.1#eien6/lib/perl5/darwin-2level/auto/DBD/Oracle/Oracle.bundle'
for module DBD::Oracle: dlopen(/Users/myname/.perlbrew/libs/perl-5.34.1#eien6/lib/perl5/darwin-2level/auto/DBD/Oracle/Oracle.bundle, 0x0001):
symbol not found in flat namespace '_OCIAttrGet' at
/Users/myname/perl5/perlbrew/perls/perl-5.34.1/lib/5.34.1/darwin-2level/DynaLoader.pm line 197.
Is this related to the MacOS SIP mechanism ? How to use DBD::Oracle ?

Oracle Instant Client still not working on Mac OS Catalina 10.15.4

I installed the Oracle Instant Client version 19.3 on my Mac Os Catalina version 10.15.4
But i still have the same error on python3.7 and python3.8:
Origin: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): no suitable image found. Did find:
file system relative paths not allowed in hardened programs". See https://oracle.github.io/odpi/doc/installation.html#macos for help
(Background on this error at: http://sqlalche.me/e/4xp6)
here is my installation:
$: ls-l ~/lib
ls -l ~/lib
total 0
lrwxr-xr-x 1 giacomocallegaro staff 58 22 Apr 09:13 libclntsh.dylib -> /Users/giacomocallegaro/instantclient_19_3/libclntsh.dylib
$: cat .zprofile
Setting PATH for Python 3.8
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
Setting PATH for Python 3.7
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH=$PATH:~/instantclient_19_3
export PATH
$: echo $PATH
/Users/giacomocallegaro/.nvm/versions/node/v12.14.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/giacomocallegaro/.nvm/versions/node/v12.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/opt/openssl/bin:/Users/giacomocallegaro/instantclient_19_3:/Users/giacomocallegaro/instantclient_19_3
$: which python:
/usr/bin/python
when I run sqlplus:
$: sqlplus -v
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Can some one help me please?
Go to https://www.oracle.com/technical-resources/
Downloads --> Oracle Instant Client --> macOS(Intel x86) --> Basic Package
In your download folder you will find a folder named instantclient_19_3
Add the following to your python script
import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir=r'/Users/<username>/Downloads/instantclient_19_3')
Some windows will pop up, so go to System preferences --> Security & Privacy --> General and there you will see a notification. Click on open anyway. You will have to repeat this last step 3-4 times.
After you download instant client from here, create a symbolic link into /usr/local/lib folder (that's where all .dylib files keep their symbolic links).
In my case, I extracted instant client into /opt/oracle/instantclient_19_3. So the command is:
$ ln -s /opt/oracle/instantclient_19_3/libclntsh.dylib /usr/local/lib/
However, there is another problem when I try to create the connection from python:
Error while trying to retrieve text for error ORA-01804
Oracle says: "Instant Client 19.3 and 18.1 support macOS Mojave and High Sierra", and I have macOS Catalina 10.15, don't know if this has anything to do with that, error 01804 says that timezone information is invalid.
More info on this: http://www.dba-oracle.com/t_ora_01804_start_oracle.htm
EDIT: issue resolved.
After downloading the SQL*Plus Package I managed to connect and verify the instant client works. My python issue was also resolved when I restarted IntelliJ (I was running the server from within so the PATH might have not been updated).
Maybe the error is misleading and it is related to general issue with Oracle Instant Client on MacOS Catalina? Have a look at this blog post:
Gary's Oracle On Tap
Hope this helps!

DB2 db2prereqcheck how to make it work?

I'm newbie in DB2 database administration and I couldn't think that I'd be stuck with the installation process. I read some documents before installation and found an interesting "db2prereqcheck" thing.
So I tried to run it before installation and got an error:
DBT3505E The db2prereqcheck utility was unable to determine the Linux distribution level.
About this error from ibm:
IBM Knowledge Center: DBT3505E
IBM Support: db2prereqcheck fails checking Linux distribution
I found some other answers where suggest to delete the files "/etc/issue" and "/etc/issue.net".
I checked my "/etc/issue*" files according to the tips. I filled that files with the example from the article in IBM Support, but nothing has changed. I tried running this script on other servers with CentOS, Debian operating systems, but got another error:
./db2prereqcheck
DBI1189E There has been an attempt to use db2prereqcheck
on an image for a platform that does not match the current platform
'Linux/x86-64' on which it is being run.
Explanation:
Possible causes include:
- This DB2 install image is not valid for the current
platform.
- The current platform is not supported by DB2.
User Response:
Install DB2 using the DB2 install image that corresponds
with the current platform 'Linux/x86-64'.
I've already installed db2, but my self-esteem is down. So the question is: my hands are a problem or is the problem in another? And how to make db2 work
Technical details:
cat /etc/issue
Amazon Linux AMI release 2018.03
Kernel \r on an \m
cat /etc/*-rel*
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2018.03
cpe:/o:amazon:linux:2018.03:ga
uname -a
Linux hostname.host 4.14.47-56.37.amzn1.x86_64 #1 SMP Wed Jun 6 18:49:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
As you may have noticed, this is an EC2 instance.
DB2 versions:
IBM® Db2 11.1 Developer-C Edition for Linux® on AMD64 and Intel® EM64T systems (x64)
IBM® DB2 Express-C Version 11.1
I would appreciate your help in this matter. Thank you for your time.
If db2prereqcheck reports :
DBT3505E The db2prereqcheck utility was unable to determine the Linux
distribution level. Aborting the current installation ... Run
installation with the option "-f sysreq" parameter to force the
installation.
and if other IBM suggestions do not apply, then you may be able to avoid this symptom with the following workaround:
(as root)
cp /etc/os-release /etc/lsb-release
The reason it works is that some versions of db2prereqcheck look only for the following files in turn:
/etc/centos-release
/etc/redhat-release
/etc/SuSE-release
/etc/lsb-release
If none of those files are present, the DBT3505E symptom can result.
If your distro (or container) has an equivalent file (for example, Debian may have /etc/os-release) then simply copying it to /etc/lsb-release will allow db2prereqcheck to complete.
db2prereqcheck checks and understands only /etc/SuSE-release with the following content:
SUSE Linux Enterprise Server 15 (x86_64)
VERSION = 15
PATCHLEVEL= 1
This works also with OpenSuse Leap 15.1. This file is deprecated since SLES 12. So you must create it your self. Then run db2prereqcheck and install all missing libraries and kernel sources mentioned. Having all requirements fulfilled you may finally see the segmentation fault message:
Validating "Intel TCO WatchDog Timer Driver modules" ...
DBT3546E The db2prereqcheck utility failed to determine whether the
following file or package exists: "".
Segmentation fault (core dumped)
Don't worry!
Simply retest with db2prereqcheck -i. The -i parameter checks for prerequisites that are not Db2 pureScale related. If we don't install pureScale and all requirement are fulfilled, we can ignore this ugly segmentation fault.
Otherwise you must blacklist by adding:
blacklist iTCO_wdt
blacklist iTCO_vendor_support
Into the file /etc/modprobe.d/blacklist.conf
A further issue is related to:
export DISPLAY=your.machine.ip:0.0
running ./db2setup as root doesn't work.
./db2_install is deprecated, but it works.
First create the db2 users and groups as described by the IBM Knowledge Center.
Then run ./db2_install as root, followed by creating an instance using db2icrt.
Login as db2inst1 and test as described by the IBM Knowledge Center eventually creating the SAMPLE Database, etc. Normally "first steps" would do the job, but it crashes with javascript error. Hence you must do it manually!
Additional manual configuration may be required as opening the firewall for port 50001 and setting this port within /etc/services and within dbm cfg with:
db2 update dbm cfg using SVCENAME 50001
or
db2 update dbm cfg using SVCENAME db2c_db2inst1
If you use the latter you must update /etc/services with the line:
db2c_db2inst1 50001/tcp #and a comment like db2 tcp/ip
connection port.

Installing PHP7 with Homebrew on Mac

When I try to install PHP7 on Homebrew I get this error
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /usr/sbin/apxs follows:
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
configure: error: Aborting
Does any one have a solution for this, knowing that I've searching the web for a solution without any luck

error while installing snmp package in SUSE 11

I am trying to install SNMP package in SUSE Linux enterprise server 11. I downloaded net-snmp-5.6.1-3.3.x86_64.rpm and installed with the below command
UKGBDCESRPL048:/opt/packages # rpm -ivh --nodeps net-snmp-5.6.1-3.3.x86_64.rpm
warning: net-snmp-5.6.1-3.3.x86_64.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID 3dbdc284
Preparing...
##################################### [100%]
1:net-snmp
##################################### [100%]
Updating /etc/sysconfig/net-snmp...
But when I try to start snmpd service, I am getting an error below:
UKGBDCESRPL048:/opt/packages # /etc/init.d/snmpd start
Starting snmpd/usr/sbin/snmpd: error while loading shared libraries: libnetsnmpagent.so.25: cannot open shared object file: No such file or directory
startproc: exit status of parent of /usr/sbin/snmpd: 127
Please help me to properly install SNMP package.
Why are you trying to install the RPM with --nodeps? This breaks your RPM dependencies! Please remove the package again and try to install it without that option. This should fail with a list of additionally required RPM's.
You'll have to install them, too. BTW, I'm sure that at least the RPM libsnmp15 is missing, because libnetsnmpagent.so.25 is in there.
You could also configure SLES to use one or more (online) repositories after registering your machine with a license key. After that, a simple
zypper in net-snmp
should solve all dependencies automatically.
One more thing: net-snmp-5.6.1-3.3.x86_64.rpm doesn't seem to be a valid SLES 11 package. Latest version (even SP4) is 5.4.2.1-8.12.24.1. Where did you get the RPM from? Just wondering...

Resources