Archive for December, 2013

Run googlechrome as root user

# vi /usr/bin/google-chrome or vi /usr/bin/chromium-browser

Add –user-data-dir to below line

Before change:

After change:
exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS “$@” –user-data-dir

Now open chrome browser. It works…

piwik installation on centos and redhat servers

Intro: Piwik is an open source software which monitors the website statistics.

Step 1:



Step 2: Please install as follows

[root@myhost ~]# yum install php-pdo php-gd php-xml php-mysql curl php-curl php-mbstring

Step 3: Now go to apache document root

[root@myhost ~]# cd /var/www/html/

Step 4: Now download piwik latest version as follows

[root@myhost html]# wget

Step 5: Extract it

[root@myhost html]# unzip

Step 6: Move to piwik

[root@myhost html]# cd piwik

Step 7: Now change the permissions

[root@myhost piwik]# chmod 777 config
[root@myhost piwik]# chmod 777 tmp

Step 8: Create a user in MySQL

mysql> CREATE USER ‘piwik’@’localhost’ IDENTIFIED BY ‘password’;
Query OK, 0 rows affected (0.00 sec)

Step 9: Grant privileges to user

mysql> GRANT ALL PRIVILEGES ON piwik_db.* TO ‘piwik’@’localhost’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Step 10: Now open the browser with http://localhost/piwik/ and go on the process.

###### Generate csr on Centos and Redhat servers ######

Step 1:
1. mod_ssl
2. openssl
If not installed, then run as below

[root@myhost ~]# yum install mod_ssl openssl

Step 2:

Now generate a private key as follows

[root@myhost ~]# openssl genrsa -out domain-name.key 1024

Now generate CSR as follows

[root@myhost ~]# openssl req -new -key domain-name.key -out domain-name.csr

It prompts as follows

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:
Email Address []:

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Note 1: Enter the required fileds so that, csr will be generated for the domain.

Note 2: Above is useful for commercial certification. Forward the csr file to hosting or ssl providers to generate commercial or licenced ssl certificate.

For free self sighned ssl certification please follow below step 3.

Step 3:

Generate Self Signed Key please follow as below

[root@myhost ~]# openssl x509 -req -days 365 -in domain-name.csr -signkey domain-name.key -out domain-name.crt

By following these steps, it generates a private key, csr and crt. Copy all these files to /etc/httpd/conf/ssl/

Before copy create a directory with the name of website to identify easily at /etc/httpd/conf/ssl/.

Now create a virtual host or add below lines to apache configuration file (httpd.conf) which enables ssl for the website

<VirtualHost ipaddress:443>
DocumentRoot /var/www/html/domain-name
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl/
SSLCertificateKeyFile /etc/httpd/conf/ssl/
SSLCACertificateFile /etc/httpd/conf/ssl/
ErrorLog logs/domain-name.com_ssl-error_log
CustomLog logs/domain-name.com_ssl-access_log common

Save and Quit the file. Then reload or restart apache services. Then run the website with