After several days trying (and I must say learning a lot) I finally got to the commands necessary to install MADlib.
1st) My first attempt was done using the pgxn client (postgre extensible network client).
First you need to make sure that Ubuntu is updated. To do so, open a terminal (CTRL+T) and type the following command: sudo apt-get update.
Next you need to install PostgreSQL itself. If it has not been installed yet, you can do so, by typing the command: sudo apt-get install postgresql. After that install cmake, which is (I think) a compiling program, and plpython, which will provide python support for postgresql, postgresql development server, libkrb5, a development library and pgxn client, a client for postgre extensible network. All of that can be acomplished with the following sequence of commands:
sudo apt-get install -y cmake
sudo apt-get install -y postgresql-server-dev-9.3
sudo apt-get postgresql-plpython-9.3sudo apt-get install -y libkrb5-dev
sudo apt-get pgxnclient
Having finished all of that, install madlib using pgxn. Pgxn handles the
configuration, compilation and installation parts. All of that can be done by
just typing sudo pgxn install madlib.
After that, start the PgadminIII interface, conect to your DB (in my case it was mydb), start the PSQL Console and type the commands: create extension plpythonu; Create a new user (besides the superuser which is created by default) and try issuing the command (on PSQL console): create extension madlib;
In case the last command (create extension plpythonu) doesn´t work (on the PSQL Console), go to a terminal and type: bash /usr/local/madlib/bin/madpack ‐p postgres ‐c postgres@localhost/mydb install. This is the madpack command. It is needed to register madlib with your Postgre databse. Finally to confirm that everything is ok, test your installation with the command: bash /usr/local/madlib/bin/madpack ‐p postgres ‐c postgres@localhost/mydb install-check.
Using this approach I got to the create extension madlib part. This command didn´t run because I was not aware of the need to link externally the madlib library with my database, using the madpack application. Since I was left with no install I decided to install MADlib from source.
2nd) This time we´re going to download, get the dependencies, compile and install MADlib from source. To do so, proceed as follows:
Set up the environment: sudo apt‐get install build‐essential checkinstall
sudo apt‐get install cvs subversion git‐core mercurial
sudo apt‐get ‐y install m4 gcc‐4.6 g++‐4.6 g++
OBS: what is git clone git@github.com:madlib/madlib.git
wget Page on Github
Make a personal directory to receive the sources, and make sure you have proper rights in it:
sudo chown $USER /usr/local/rc
sudo chmod u+rwx /usr/local/src
Download MADlib 1.7.0 source from www.madlib.net in /home/gustavo/downloads and copy the .tar.gz or .tar.gz2 to /usr/local/src
Unpack the .tar.gz or .tar.gz2 file: tar ‐xzvf file.tar.gz OR tar ‐xjvf file.tar.bz2 and change to the new subdirectory: cd madlib-1.7.0
Now comes the first programming part: test the dependencies with ./configure until there are no more missing libraries. For each error that is found, download and install the correspondent library. For instance if ./configure detects that the library named namelibtool is missing, you can install it with: sudo apt-get install namelibtool. You can also try sudo apt-get build dep command to try downloading all dependencies at once that are needed by command.
When there is no more errors reported by ./configure change to the ./build directory (cd build) and start compiling the source by typing: make.
Having compiled the source, you need to install it. Some sites tell you to install with sudo make install but this way of installing is being abandoned in favor of sudo checkinstall or sudo checkinstall ‐‐fstrans=0 in case the first command fails. Using checkinstall is preferred, because this way the package can be managed by Synaptics Package Manager.
The plpython extension can than be created in the terminal itself by: createlang plpythonu db. Finally type: bash /usr/local/madlib/bin/madpack ‐p postgres ‐c postgres@localhost/mydb install to created the madlib extension in your postgre database and check if everything went well by typing: bash /usr/local/madlib/bin/madpack ‐p postgres ‐c postgres@localhost/mydb install-check.
As a final note, keep in mind that you can connect to a Postgre db and start the PSQL Command Line in the terminal itself by typing:
sudo su ‐ postgres - connect to a database
psql - starts the PSQL command prompt
postgres=# alter role postgres with password 'postgres'; - adds a password to a role (db user)
postgres=# alter role postgres with password null; - removes a password from a role (db user)
Other tips:
To unlock a database:
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
To remove an installation made with make install:
sudo aptitude install checkinstall
sudo make; sudo checkinstall - this will create a .deb package
Uninstall the .deb and you're done.
To initialize Postgre from command line and get to the PSQL command prompt, without starting PGAdminIII:
sudo su ‐ postgres - connect to a database
psql - starts the PSQL command prompt
postgres=# alter role postgres with password 'postgres';
- adds a password to a role (db user) postgres=# alter role postgres with password null;
- removes a password from a role (db user)
Best regards,
Gustavo
- adds a password to a role (db user) postgres=# alter role postgres with password null;
- removes a password from a role (db user)
Best regards,
Gustavo
No comments:
Post a Comment