Pages

Friday 25 September 2015

How To Restore the Postgresql Database Using Ubuntu Terminal

For the restoring the database if you don't know the file type then you need to follow the below command to check the database file type.

    >> file database_file_name
    For Example:
    >> file live_db.dump

Based on the file type we have different commands for restore the each database file type.

Restoring the database using psql file type:
  
1.First we need to create a  new database in our system. 
   >> createdb database_name --encoding=UNICODE
    For Example:
    >> createdb my_project_live --encoding=UNICODE
2.Now we need to import the old database to our new database 
    >>psql  new_database_name <  old_database_name
   For Example:
    >> psql my_project_live < live_db_backup.psql

Restoring the database using dump file type:

1.For the restore the dump database in our system we need to follow the below command :
    >>DB= new_database_name && createdb --cluster 9.1/main $DB &&     pg_restore --cluster 9.1/main --no-acl -O -d $DB <  backup_database_file_name    
   For Example:
    >>DB=live_project_db && createdb --cluster 9.1/main $DB && pg_restore --cluster 9.1/main --no-acl -O -d $DB <  remote_dump_file.dump                                          

Restoring the database using zip file type:

1.First we need to create a  new database in our system. 
    >> createdb new_database_name --encoding=UNICODE
   For Example:
    >> createdb my_project_live --encoding=UNICODE
2.Now we need to uncompress the zip file and import the backup database. 
    >>gunzip < backup_db_zip_file  | psql -U <postgresql user name/same name as for  system user name> new_database_name
   For Example:
    >> gunzip < backup_database.zip | psql -U maze2innovation my_project_live
  
 
 

How To Get Backup of Postgresql Database Using Ubuntu Terminal

Hear we are going to delivery the way to backup of the database using the terminal.

First we need to access the remote server from our local system terminal.

We have to require the SSH (secure shell) protocol for accessing the remote server from terminal.

ACCESS USING CUI (character user Interface) VIEW INTERECTION.

SSH (SECURE SHELL) ACCESS :

   >>  ssh remote_user_name @ your_ip_address  -p  your_port_number

For Example:

    >>  ssh root@192.168.0.1 -p 25   

SSH:

SSH is essential tool for the administrator or as master of the system user for access the remote server.

SSH is a protocol used to securely logged onto remote systems.It is the most common way to access remote Linux and Unix-like servers,
such as VPS instances.

SSH is provide the way of  connection from the client to the remote server.

p:

p is indicate that the  port for your server system 

To Get a backup of database we need to execute the below command :

syntax :
    >> pg_dump --cluster 9.1/main --format=c old_database_name >  new_database_name

old_database_name : it's live database name
new_database_name : it's database backup file name

For Example:

    >> pg_dump --cluster 9.1/main --format=c live_db > backup_live_db

Monday 21 September 2015

Install Odoo 9.0 on Ubuntu

We need to follow the bellow steps to install the ODOO in UBANTU.

1. Open Terminal and execute below commands
2. Update server packages.
     >> sudo apt-get update
     >> sudo apt-get upgrade
     >> sudo apt-get dist-upgrade 

3.Install Python Packages Which required for Odoo.
    >> sudo apt-get install git
    >> sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
python-ldap python-libxslt1 python-lxml python-mako \
python-openid python-psycopg2 python-pybabel python-pychart \
python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-imaging


    >> sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko poppler-utils \
python-pdftools antiword postgresql

    >> sudo apt-get install python-geoip
    >> sudo apt-get install python-requests
    >> sudo apt-get install python-decorator
     >> sudo apt-get install python-passlib
    >> sudo apt-get install python-pip
     >> sudo apt-get install python-requests
     >> wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz
tar zxvf gdata-2.0.17.tar.gz

         cd gdata-2.0.17/
         sudo python setup.py install


4.Install Postgresql database server(Ref link).
    >> sudo apt-get install postgresql
    >> sudo su postgres

    Create the user for postgresql:
    >> createuser username
    >> psql -l
    >> psql template1

5. Update the user role for postgresql.
    >>alter role username with password 'Your passward';

We need to additional Library For reporting tools.
    I.   sudo apt-get install wkhtmltopdf
    II. sudo pip install XlsxWriter
    III.sudo apt-get install bzr
    IV. sudo apt-get install python-pypdf
    V.  bzr branch lp:aeroolib
          cd aeroolib/
          sudo python ./setup.py install