Saturday, January 22, 2011

Ubuntu 11.04 with Unity working in VirtualBox 4.0

Get Ubuntu 11.04 with Unity working in VirtualBox 4.0


1. Firstly, install VirtualBox 4.0. For installation instructions, see our previous article: Install VirtualBox 4.0 (Stable) In Ubuntu, Via Repository

2. Download the latest Ubuntu 11.04 Natty Narwhal daily live ISO from HERE.

3. In VirtualBox, create a new virtual machine, go to its settings and on the Display tab, check the "Enable 3D Acceleration" box.

4. Now you'll need to install Natty in VirtualBox. When done, start it and on top of the window you should see a menu - here, click Devices > Install Guest Additions.

5. Install VirtualBox Guest Additions:

Saturday, January 15, 2011

OpenERP Server / Client start up 2

sudo /etc/init.d/postgresql-8.4 restart
sudo vi /etc/postgresql/8.4/main/pg_hba.conf
ps uaxww | grep -i openerp

sudo lsof -i :8069

sudo lsof -i :8070

sudo -i -u postgres openerp-server

OpenERP Server / Client start up

  1. The PostgreSQL database starts automatically and listens locally on port 5432 as standard: check this by entering sudo netstat -anpt at a terminal to see if port 5432 is visible there.


  2. The database system has a default role of postgres accessible by running under the Linux postgres user: check this by entering
     
    sudo su postgres -c psql 

    at a terminal to see the psql startup message – then type \q to quit the program.


  3. Start the Open ERP server from the postgres user (which enables it to access the PostgreSQL database) by typing  

    sudo su postgres -c openerp-server

  4. If you try to start the Open ERP server from a terminal but get the message 

    socket.error: (98, 'Address already in use') 

    then you might be trying to start Open ERP while an instance of Open ERP is already running and using the sockets that you’ve defined (by default 8069 and 8070).

    If that’s a surprise to you then you may be coming up against a previous installation of Open ERP or Tiny ERP, or something else using one or both of those ports.

    # Type 

    sudo netstat -anpt

    to discover what is running there, and record the PID

    # You can check that the PID orresponds to a program you can dispense with by typing
     
    ps aux | grep 1377

    # and you can then stop the program from running by typing
     
    sudo kill 1377

     You need additional measures to stop it from restarting when you restart the server.

  5. The Open ERP server has a large number of configuration options. You can see what they are by starting the server with the argument –help By efault the server configuration is stored in the file .terp_serverrc in the user’s home directory (and for the postgres user that directory is /var/lib/postgresql .


  6. You can delete the configuration file to be quite sure that the Open ERP server is starting with just the default options. It is quite common for an upgraded system to behave badly because a new version server cannot work with options from a previous version. When the server starts without a configuration file it will write a new one once there is something non-default to write to it – it will operate using defaults until then.

  7. To verify that the system works, without becoming entangled in firewall problems, you can start the Open ERP client from a second terminal window on the server computer (which doesn’t pass through the firewall). Connect using the XML-RPC protocol on port 8069 or NET-RPC on port 8070. The server can use both ports simultaneously. The window displays the log file when the client is started this way.

  8. The client setup is stored in the file .terprc in the user’s home directory. Since a GTK client can be started by any user, each user would have their setup defined in a configuration file in their own home directory.

  9. You can delete the configuration file to be quite sure that the Open ERP client is starting with just the default options. When the client starts without a configuration file it will write a new one for itself.

  10. The web server uses the NET-RPC protocol. If a GTK client works but the web server doesn’t then the problem is either with the NET-RPC port or with the web server itself, and not with the Open ERP server.

Hint
One server for several companies
You can start several Open ERP application servers on one physical computer server by using different ports. If you have defined multiple database roles in PostgreSQL, each connected through an Open ERP instance to a different port, you can simultaneously serve many companies from one physical server at one time.

PostgreSQL Commands



Reference : http://www.linuxweblog.com/blogs/sandip/20101203/listing-directories-tree-format


Create db user and grant permission to create databases.
# adduser <dbuser>
# su - postgres
$ createuser -d -S -R <dbuser>



simple commands for administering the database. Hopefully these notes will help as reference when working with PostgreSQL:
  1. Login as "postgres" (SuperUser) to start using database:
    # su - postgres
  2. Create a new database:
    $ createdb mydb
  3. Drop database:
    $ dropdb mydb
  4. Access database:
    $ psql mydb
  5. Get help:
    mydb=# \h
  6. Quit:
    mydb=# \q
  7. Read command from file:
    mydb=# \i input.sql
  8. To dump a database:
    $ pg_dump mydb > db.out
  9. To reload the database:
    $ psql -d database -f db.out
  10. Dump all database:
    # su - postgres
    # pg_dumpall > /var/lib/pgsql/backups/dumpall.sql
  11. Restore database:
    # su - postgres
    # psql -f /var/lib/pgsql/backups/dumpall.sql mydb
  12. Show databases:
    #psql -l
    or
    mydb=# \l;
  13. Show users:
    mydb=# SELECT * FROM "pg_user";
  14. Show tables:
    mydb=# SELECT * FROM "pg_tables";
  15. Set password:
    mydb=# UPDATE pg_shadow SET passwd = 'new_password' where usename = 'username';
  16. Clean all databases (Should be done via a daily cron):
    $ vacuumdb --quiet --all
    DROP TABLE name [, ...] [ CASCADE ]
    DROP TABLE removes tables from the database. Only its owner may destroy a table. To empty a table of rows, without destroying the table, use DELETE.
    DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a view or a foreign-key constraint of another table, CASCADE must be specified. CASCADE will remove a dependent view entirely, but in the foreign-key case it will only remove the foreign-key constraint, not the other table entirely.




    Add the below line to /var/lib/pgsql/data/postgresql.conf to make postgresql database listen to external connections:
    listen_addresses = '*'
    Edit /var/lib/pgsql/data/pg_hba.conf and add the appropriate permissions:
    host all all 0.0.0.0/0 md5
     
     
     
     

    change postgresql database owner

    template1=# ALTER DATABASE <dbname> OWNER TO <dbuser>;
     
     
     
     
     
     

    setup postgresql database to use passwords to connect

    Edit "/var/lib/pgsql/data/pg_hba.conf" with:
    local   all       all                          md5
    host    all       all       127.0.0.1/32       md5
    local - socket connection
    host - tcp connection
    To connect via socket:

    $ psql -U <username> -d <dbname>
    To connect via tcp:

    $ psql -U <username> -h <hostname> -d <dbname>
     
     
     
     
     

    password reset

    template1=# ALTER USER <dbuser> WITH PASSWORD '<password>';

    Viewing owner and permissions

    \d -- view the owner
    \dp -- view permissions
     
     
     
     

Logout using gnome command saving current session:

gnome-session-save --logout



Below example shows listing of files and directories in tree format including hidden files and directory display depth of 3:

tree -a -L 3
 
-a : include hidden files
-L : depth of directory tree to display
man tree for more info...

 Reference : http://www.linuxweblog.com/blogs/sandip/20101203/listing-directories-tree-format

domain_search

#!/bin/bash
# domain_search.sh

# Get a list of 3 letter domains.
for x in `cat /usr/share/dict/words`; do count=`echo $x| wc -m`; [ $count = 4 ] && echo $x; done > domains_list.txt

# Get whois record.
for x in `cat ./domains_list.txt` ; do (whois $x.com | grep -q '^No match for domain') && echo $x; sleep 60; done > domains_available.txt

# Change to lowercase and sort print.
cat domains_available.txt | tr [:upper:] [:lower:]|sort| uniq

Install NetBeans

Install NetBeans

wget http://dl.dropbox.com/u/4170695/scripts/install.netbeans.sh -O - | bash -

#!/bin/bash

#if [ "$(lsb_release -cs)" == "lucid" ]; then
# # install netbeans from repository
# apt-get install -y netbeans
#else
 # download and install netbeans from homepage
 URL=http://download.netbeans.org/netbeans/6.9.1/final/bundles/netbeans-6.9.1-ml-java-linux.sh

 wget ${URL} -O /tmp/netbeans-linux.sh
 sudo bash /tmp/netbeans-linux.sh --silent
#fi
# install Java JDK
http://www.panticz.de/ubuntu_install_java_jdk
OPTIONAL: install MySQL driver
apt-get install libmysql-java
# old# sudo cp Desktop/netbeans/mysql-connector-java-5.0.6-bin.jar /usr/local/SUNWappserver/lib/
# OLD
# fix ubuntu locale settings for german
#sed -i 's|en_US.UTF-8|de_DE.UTF-8|g' /etc/scim/global
# disable compiz effects (Visual Effects (System > Preferences > Appearance > Visual Effects => none)
metacity --replace &