Saturday, December 29, 2012
installaion openerp 7.0 alpha on ubuntu 10.04
#!/bin/bash
######################################################################
# AIM :Open erp 7.0 install
#By :Navneet Rathi
#Date:06-Dec-2012
#
#####################################################################
#postgresql install
apt-get update
http_proxy=210.212.152.5:80
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get upgrade
http_proxy=
sudo apt-get install postgresql-9.1 libpq-dev
#
#create a user openerp on postgresql
#
su - postgres -c "createuser -s openerp" 2> /dev/null || true
#install basic requirement for Openerp 7.0
apt-get install python-software-properties python-dateutil python-feedparser python-gdata python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi graphviz python-antlr python-libxml2 python-egenix-mxdatetime python-setuptools python-yaml python-zsi python-docutils python-psutil bzr wget
#install dependendies
apt-get install python-simplejson python-webdav python-werkzeug python-xlwt
## Dependencies install using wasy install
sudo easy_install pychart # ', # not on pypi, use: pip install http://download.gna.org/pychart/PyChart-1.39.tar.gz
sudo easy_install babel # ',
sudo easy_install docutils # ',
sudo easy_install feedparser # ',
sudo easy_install gdata # ',
sudo easy_install lxml < 3 # ', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
sudo easy_install mako # ',
sudo easy_install PIL # ', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
sudo easy_install psutil # ', # windows binary code.google.com/p/psutil/downloads/list
sudo easy_install psycopg2 # ',
sudo easy_install pydot # ',
sudo easy_install python-dateutil < 2 # ',
sudo easy_install python-ldap # ', # optional
sudo easy_install python-openid # ',
sudo easy_install pytz # ',
sudo easy_install pywebdav # ',
sudo easy_install pyyaml # ',
sudo easy_install reportlab # ', # windows binary pypi.python.org/pypi/reportlab
sudo easy_install simplejson # ',
sudo easy_install vatnumber # ',
sudo easy_install vobject # ',
sudo easy_install werkzeug # ',
sudo easy_install xlwt #'
#install werkzeug need for some unexpected errors
sudo easy_install werkzeug
#fetch openerp 7.0
http://nightly.openerp.com/trunk/nightly/deb/openerp_7.0alpha-latest-1_all.deb
#install it now
dpkg -i openerp_7.0alpha-latest-1_all.deb
#sudo su
#copy paste this script in a file
# nano/gedit openerp.sh
# chmod 777 openerp.sh
#./openerp.sh
#
#after the Script execute completely open the browser and type http://localhost:8069
#
Automated Mysql Server Backup on ubuntu 10.04
#!/bin/bash
#
# if using root then not required
#
sudo su
sudo apt-get install automysqlbackup
vi /etc/default/automysqlbackup
# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost
DBNAMES=`find /var/lib/mysql -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f5 | grep -v ^mysql\$ | tr \\\r\\\n ,\ `
# Backup directory location e.g /backups
# Folders inside this one will be created (daily, weekly, etc.), and the
# subfolders will be database names.
BACKUPDIR="/var/lib/automysqlbackup"
# Email Address to send mail to? (user@domain.com)
MAILADDR="<your_email_address>”
#
#and thats its you are ready to go no cron nothing this will do the job automatically
#
#
# if using root then not required
#
sudo su
sudo apt-get install automysqlbackup
vi /etc/default/automysqlbackup
# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost
DBNAMES=`find /var/lib/mysql -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f5 | grep -v ^mysql\$ | tr \\\r\\\n ,\ `
# Backup directory location e.g /backups
# Folders inside this one will be created (daily, weekly, etc.), and the
# subfolders will be database names.
BACKUPDIR="/var/lib/automysqlbackup"
# Email Address to send mail to? (user@domain.com)
MAILADDR="<your_email_address>”
#
#and thats its you are ready to go no cron nothing this will do the job automatically
#
Wednesday, December 19, 2012
Set up The Squid Proxy (Minimum Configuration) on ubuntu 10.04
- To install Squid :
1.1 Type the following command in a terminal :
sudo aptitude install squid2. Configuration of Squid is done by editing the following file: /etc/squid/squid.conf
sudo nano /etc/squid/squid.conf
2.1.Naming the proxy
It is important that Squid knows the name of the machine. To do this, locate the line : visible_hostname.
Changed to
visible_hostname <machine name>
Note: you can find the machine name in /etc/hostname file in linux :
sudo vi /etc/hostname
2.2 Choosing the Port
By default, the proxy server will use port 3128. To choose another port, locate the line:
http_port 3128
and change the port number, if we want to listen on custom port :
http_port 3177
2.3.Choosing the interface
By default the proxy server will listen on all interfaces. For security reasons, its better to put it on your local network only.
For Example : If the network card connected to your LAN has IP 172.16.1.1, change the line:
http_port 172.16.1.1:3177
2.4. Setting access rights and priorities :
By default, nobody else is allowed to connect to the proxy server. A list of permissions must be created.
For example, we will define a group encompassing the local network.
acl lanhome src 172.16.0.0/255.255.0.0
‘lanhome’ can be any name which we want to specify in squid config file for the private domain
2.5. Authorizing access to group :
Now that the group is defined, we will authorise it to use the proxy.
Locate the line http_access allow ... and add below (before the line http_access deny all):
http_access allow lanhome
Note : Allow the use of non-standard ports
By default, Squid allows HTTP traffic only on specific ports (e.g. 80). This can cause problems for websites using other ports.
To avoid this deadlock,
find the line
http_access deny! Safe_ports
and then edit it to:
# http_access deny! Safe_ports
3.Starting the Proxy
Restart the proxy to apply the modifications you made. Type:
sudo /etc/init.d/squid restart
4. Server logs
There are three types of logs are generated by squid.Found in the /var/log/squid.
- accesslog
Most log file analysis program are based on the entries in access.log.
Squid allow the administrators to configure their logfile format and log output method with great flexibility. Previous versions offered a much more limited functionality.
- cache.log
- store.log
SSL ENCRYPTED MYSQL REPLICATION
Set up the master server
Setting up the master consists of the following steps:- Generate SSL certificates.
- Edit MySQL configuration my.cnf.
- Restart MySQL server process.
- Set up database replication privileges (and force SSL).
- Perform initial database backup to start replication from.
- Finish up.
Set up the slave server
The steps for the slave server are:- Setup the SSL certificates.
- Edit MySQL server configuration my.cnf.
- Restart MySQL server.
- Configure and start slave server.
- Finish up.
Detailed steps:
we generate the CA certificate:
$ mkdir ~/mysql-tutorial/ && cd ~/mysql-tutorial/
$ openssl genrsa 2048 > ca-key.pem
$ openssl req -new -x509 -nodes -days 1000 \ -key ca-key.pem -out ca-cert.pem
Create the server certificate, remove its passphrase and sign it:
$ openssl req -newkey rsa:2048 -days 1000 \ -nodes -keyout server-key.pem -out server-req.pem
$ openssl rsa -in server-key.pem -out server-key.pem
$ openssl x509 -req -in server-req.pem -days 1000 \ -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem
Create the client certificate, remove its passphrase and sign it
$ openssl req -newkey rsa:2048 -days 1000 \ -nodes -keyout client-key.pem -out client-req.pem
$ openssl rsa -in client-key.pem -out client-key.pem
$ openssl x509 -req -in client-req.pem -days 1000 \ -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem
Install the certificates into to /etc/mysql/ directory:
$ sudo cp *.pem /etc/mysql/
Skip the bind address
assign the id to mysql server and enable the bin log And enable SSL by editing and add the following lines to my.cnf :
ssl-ca=/etc/mysql/ca-cert.pem
ssl-cert=/etc/mysql/server-cert.pem
ssl-key=/etc/mysql/server-key.pem
Restart the mysql server:
sudo service mysql restart
mysql -u root -p -h <host-name>
GRANT REPLICATION SLAVE ON *.*
TO '<slave_user>'@’%'
IDENTIFIED BY '<slave_password>'
REQUIRE SSL;
FLUSH PRIVILEGES;
USE <database name>;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
note the log position and log file name
example. binlog filename mysql-bin.000003 position :1122
Take the mysql dump
mysqldump -h localhost -u root -p --opt <database> > ~/<database>.sql
UNLOCK TABLES;
quit;
scp ~/<database>.sql <username>@<ipaddress>:/path/to/paste/
On The Slave
Edit the slave server
Add the id and skip the networking and bind address of the server.
Id of both the server should not be same
STOP SLAVE;
CREATE DATABASE IF NOT EXISTS <database>;
USE <database>;
SOURCE /path/to/<database>.sql;
CHANGE MASTER TO
MASTER_HOST='<master’s ip>',
MASTER_USER='slave_user',
MASTER_PASSWORD='<password>',
MASTER_CONNECT_RETRY=60,
MASTER_LOG_FILE='<binlog file name>',
MASTER_LOG_POS=<position>,
MASTER_SSL=1,
MASTER_SSL_CA='/etc/mysql/ca-cert.pem',
MASTER_SSL_CERT='/etc/mysql/client-cert.pem',
MASTER_SSL_KEY='/etc/mysql/client-key.pem';
START SLAVE;
SHOW SLAVE STATUS \G;
Wordpress installation on linux
Installing the Wordpress
Ubuntu
|
Redhat
|
sudo apt-get install apache2 | yum –y install httpd |
sudo aptitude install mysql-server-5.1 | yum –y install mysql-server-5.1 |
sudo aptitude install php5 phpmyadmin | yum –y install php php-mysql |
sudo apt-het install unzip wget | yum –y install unzip wget |
sudo service apache2 restart sudo service mysql restart | chkconfig httpd on chkconfig mysqld on /etc/init.d/mysqld start /etc/init.d/httpd start |
wget http://wordpress.org/latest.zip or wget http://wordpress.org/latest.tar.gz | wget http://wordpress.org/latest.zip or wget http://wordpress.org/latest.tar.gz |
sudo mv latest.zip /var/www
or
sudo mv wordpress-3.0.1.tar.gz /var/www
cd /var/www
sudo unzip latest.zip
or
sudo tar -zxvf latest.tar.gz
ls –al
ps aux | grep apache
You will see the Apache user group on the left.
Now change your WordPress folder to the same user group, you can do this in a parent folder or subfolder but for sanity it usually best for parent folder, use -R to recursively do it
And change the permission
To
chmod -R 755 /var/www/<path to word press folser>
Note if www is your wordpress folder then just use the command upto www
sudo rm -f latest.zip
or
sudo rm -f wordpress-3.0.1.tar.gz
For creating a database using phpMyAdmin, follow these steps:
o Start by choosing a name for your WordPress database (like ‘wordpress‘ or ‘blog‘), enter it in the Create new database field, and click Create (choose the right Connection Collation for you or use utf8_general_ci).
o Click the Home icon in the upper left to return to the main page, then click Privileges. If a user relating to WordPress does not already exist in the list of users, create one:
o Click Add a new User.
o Chose a username for WordPress (like ‘wordpress‘) and enter it in the User name field. (Be sure Use text field: is selected from the dropdown.)
o Choose a strong password password (use strongpasswordgenerator.com), and enter it in the Password field. (Be sure Use text field: is selected from the dropdown.) Re-enter the password in the Re-type field.
o Write down the username and password you chose.
o Leave all options under Global privileges at their defaults.
o Click Go.
o Return to the Privileges screen and click the Edit privileges icon (on the right-most column) on the user you’ve just created for WordPress. In the Database-specific privileges section, select the database you’ve just created for WordPress under the Add privileges to the following database drop down. The page will refresh with privileges for that database. Click Check All to select all privileges, and click Go.
o On the resulting page, make note of the host name listed after Server: at the top of the page. (This will usually be localhost.)
cd /vacr/www/wordpress
sudo cp wp-config-sample.php wp-config.php
Edit this new file, wp-config.php, with your favorite editor and change the values under the section labeled
MySQL settings
o DB_NAME: Database Name used by WordPress
o DB_USER: Username used to access Database
o DB_PASSWORD: Password used by Username to access Database
o DB_HOST: The hostname of your Database Server
And also put your Authentication Unique Keys and Salts under the section labeled Authentication Unique
Put all the data in the configuration file.
Subscribe to:
Posts (Atom)