Thursday, June 27, 2013

Installing many openerp on same server with different codes

Hello friends

I have created a scrip u just need to u just need to copy paste it and change the permission to be executable and let the script run answer the question asked by script and
you can have a openerp on your system with different names like
 openerp-server,nick-server,navneet-server etc .

#!/bin/bash
#make sure server has all the latest versions
#& patches by doing an update
#
sudo apt-get update
sudo apt-get dist-upgrade
#
#Install SSH
#
sudo apt-get install openssh-server denyhosts
#
#Create User
#
echo "Enter The Openerp Username"
read user
sudo adduser --system --home=/opt/$user --group $user
#
#Make Sure that Postgresql is installed on the system
#
sudo apt-get -y install postgresql
#
#Creating the user same as for postgres
#
createuser --createdb --username postgres --no-createrole --no-superuser $user
#
#Install all the dependencies
#
sudo apt-get -y install python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
python-webdav python-werkzeug python-xlwt python-yaml python-zsi
#
#Downloading the Source
#
wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz
cd /opt/$user
sudo tar xvf ~/openerp-7.0-latest.tar.gz
#changing the ownwrship of code so that it can be accessiable to the $user
#
sudo chown -R  $user: *
echo "owner ship is given"
sudo cp -a openerp-7.0* /opt/$user/server
rm -rf openerp*
echo "openerp is removed"
sudo cp /opt/$user/server/install/openerp-server.conf /etc/$user-server.conf
sudo chown $user: /etc/$user-server.conf
sudo chmod 640 /etc/$user-server.conf
echo "Enter the Port Number on which Openerp will start"
read port
echo "xmlrpc_port=$port" >>/etc/$user-server.conf
echo "init.d started"
cat<< 'EOT' > /etc/init.d/$user
#!/bin/sh
### BEGIN INIT INFO
# Provides:             openerp-server
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/opt/openerp/server/openerp-server
NAME=openerp-server
DESC=openerp-server
# Specify the user name (Default: openerp).
USER=openerp
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}
case "${1}" in
        start)
                echo -n "Starting ${DESC}: "
                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}
                echo "${NAME}."
                ;;
        stop)
                echo -n "Stopping ${DESC}: "
                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
                echo "${NAME}."
                ;;
        restart|force-reload)
                echo -n "Restarting ${DESC}: "
                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
     
                sleep 1
                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}
                echo "${NAME}."
                ;;
        *)
                N=/etc/init.d/${NAME}
                echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
                exit 1
                ;;
esac
exit 0
EOT
echo "conf file is genrated"
sudo chmod 755 /etc/init.d/$user
sudo chown root: /etc/init.d/$user
echo "permission are applied"
sed -i "s/openerp/$user/" /etc/init.d/$user
sed -i "s/peer/trust/" /etc/postgresql/9.1/main/pg_hba.conf
sed -i "s/md5/trust/" /etc/postgresql/9.1/main/pg_hba.conf
service postgresql restart
/etc/init.d/$user start
su postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt $user
echo "restart postgresql"
echo "open erp is started"


After the script ran completely add a user in postgresql with same name as you have mention in the script and you are ready to go.

Thanks..

Thursday, June 6, 2013

Pfsense and other availabe packages with that

Hi In the last post i have tell you about the creating the a home based Powerful router having lot of functionality that is Pfsense.
It is having a nice GUI and and having a lot of packages you can install in that

1. It is having a small DNS server
2. Proxy server
3.Network Monitor
4.Realtime Network Graphs of net uses
5. Download and Upload in the last month last week and last year and day

 You can install  all other coll stuff in that you can see that from the
System menu in that packages in that packages option you will find all the packages which you can install in the system in the available packages tab







Wednesday, June 5, 2013

Installing Pfsense

Install Pfsense on any old Pc having two network cards (1 for LAN and other for WAN)

1. Download the Pfsense CD from the pfsense website and burn it on the CD/DVD

2. Put the CD in CDROM and boot the computer using CD and you will get something like this.



let it boot in the default mode and it will ask you for the interfaces provide the interfaces for WAN and LAN and any other optional interface if you have or required.

Then connect the LAN interface to your Laptop or your Desktop which you are using and enter the ipaddress of LAN interface which youhave enter by default its 192.168.1.1

Enter the Ip address in the browser and a setup wizard came and complete the wizard



Enter the Login Details as
User :admin
Password :Pfsense

Your Firewall is all set for home use
In the Next part i will tell you about the bandwidth spiting and other cool stuff about the Pfsense.

Install OpenERP 7.0 on Redhat/Cent OS 6.4

Hi Friends I have Created a Script to install OpenERP on RedHat/CentOS

This is in the following Steps

Step 1 .

Make your system up to date

#yum -y update
#yum -y install man wget vim libevent unzip

# Download additional prerequisites
cd /tmp

wget http://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz && tar -xvzf pyparsing-1.5.7.tar.gz && cd pyparsing-1.5.7 && python setup.py install

wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.zip && unzip gdata-2.0.17.zip && cd gdata* && python setup.py install

rpm -Uvh http://pkgs.repoforge.org/tmux/tmux-1.6-1.el6.rf.x86_64.rpm

rpm -Uvh http://prdownloads.sourceforge.net/webadmin/webmin-1.620-1.noarch.rpm

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

rpm -ivh http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm

wget https://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg && sh
setuptools-0.6c11-py2.6.egg


# Install core prerequisistes for OpenERP
yum -y install python-psycopg2 python-lxml PyXML python-setuptools libxslt-python pytz python-matplotlib python-babel python-mako python-dateutil python-psycopg2 pychart pydot python-reportlab python-devel python-imaging python-vobject hippo-canvas-python mx python-gdata python-ldap python-openid python-werkzeug python-vatnumber pygtk2 glade3 pydot python-dateutil python-matplotlib pygtk2 glade3 pydot python-dateutil python-matplotlib python python-devel python-psutil python-docutils make automake gcc gcc-c++ kernel-devel byacc flashplugin-nonfree poppler-utils pywebdav postgresql92-libs postgresql92-server postgresql92




#make sure that Postgresql is installed on the system
yum install postgresql

And ofter installing the Postgresql use
service postgresql-9.2 initdb
chkconfig postgresql-9.2 on
service postgresql-9.2 start
This will make you PostgreSQL ready to accept the connection

# Add users for managment and OpenERP. Requires manual input of the password (set to "openerp")
#useradd <name user>
#useradd -e yyyy-mm-dd <mane user>
su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp"
adduser openerp
DIR="/var/run/openerp /var/log/openerp"
for NAME in $DIR
do
if [ ! -d $NAME ]; then
   mkdir $NAME
   chown openerp.openerp $NAME
fi
done
rm -rf openerp*

# Fetch and install OpenERP
cd /tmp
wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-20130408-232357.tar.gz && tar -xvzf openerp-7.0-20130408-232357.tar.gz --transform 's!^[^/]\+\($\|/\)!openerp\1!' && cd openerp && python setup.py install
rm -rf /usr/local/bin/openerp-server
cp openerp-server /usr/local/bin
cp install/openerp-server.init /etc/init.d/openerp
cp install/openerp-server.conf /etc
chown openerp:openerp /etc/openerp-server.conf
chmod u+x /etc/init.d/openerp

Starting Openerp as a service

chkconfig openerp on
service  openerp start

# Clear firewall, enabling access
iptables -F
iptables -F INPUT
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p tcp --dport 8069 -j ACCEPT
iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -j LOG -m limit

Guys now the openerp is production ready you can access it using
in browser http://<ipaddress-of-machine>:8069