Sunday, June 21, 2015

How to enable mod_rewrite in Ubuntu 14.04


The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.

Step 1 - Activate the mod_rewrite module using this command.

Step 2 - Now Restart the Apache service.

Step 3 - Now we need to make some changes on Apache configuration file. Here I use "000-default.conf" configuration file and search for “DocumentRoot /var/www/html” and add the following lines.

    vi /etc/apache2/sites-available/000-default.conf
    <Directory "/var/www/html">
          AllowOverride All
    </Directory>

Step 4 - Now again restart the Apache service and check the status on "phpinfo.php".

Step 5 - Here I have created a small example of mod-rewrite, put ".htaccess" file in webserver document root for testing.

That's it...

How to Install phpMyAdmin on CentOS/RHEL 7/6/5


PhpMyAdmin is web-based client written in php for managing MySQL and MariaDB databases. It provides a user friendly web interface to access and manage your databases. 

Before installing and configuring phpmyadmin, we need to installing and configuring apache, mysql/mariadb and php.

Step 1 - Before Installing phpMyAdmin, we need to Install/Enable "EPEL or REMI" repository.

EPEL => rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
REMI => rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step 2 - Update repository and install the package using the below command.

[root@proxy ~]# yum check-update
[root@proxy ~]# yum --enablerepo=remi install phpMyAdmin

Step 3 - Now restart httpd service

Step 4 - Now, we can access phpMyAdmin in browser using the following url. http://192.168.0.1/phpMyAdmin 

Step 5 - phpMyAdmin by default allowed to access from localhost only. If you want to make it accessible from remote computers edit "/etc/httpd/conf.d/phpMyAdmin.conf" and update all 127.0.0.1 with your network OR find the lines “Deny from All ” and comment those lines.

Step 6 -After changing configuration, restart httpd service

Now we can check that it is working fine.

Troubleshooting :

# 2002 – Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)  => The server is not responding (or the local server’s socket is not correctly configured).

( This means your mysql server service is stopped , you must start the service  “service mysql start”).

That's it...

How to Install and configure OpenSSH with basic configuration


OpenSSH is a free open source set of computer tools used to provide secure and encrypted communication over a computer network by using the ssh protocol. Accessing a shell account via SSH may be one of the most secure and easiest ways to access files, run programs, or change system settings. With secure shell it is only possible to run commands in a command line environment, not graphically. 

Step 1 - First change to root user.

Step 2 - To install OpenSSH, open a terminal and run the below command. 
   apt-get install openssh-server openssh-client

Also we can use graphically, go to "Ubuntu Software Center" use below example.

Step 3 - After installing we can see the ssh configuration directory.

Step 4 - Before editing configuration file, backup the sshd_config file.

Step 5 - Now, we can configure ssh configuration file according to our requirement by using "gedit" or "vim".
Note : Here I am using default ssh settings.

Step 6 - After configuration, restart the sshd service.

Step 7 - After configuration go to client / remote PC and connect to server using "putty" or "terminal".
Here I successfully  connected, now I can use my server using ssh.

This method is by using terminal.

That's it....

Friday, June 19, 2015

How to Upgrade PHP 5.4.X TO 5.5.X OR 5.6.X on CentOS 6.X


Step 1 - Check the system OS and Hardware information.

Step 2 - Check the current version of Apache, PHP and MySql.
   And also check PHP dependency versions.

Step 3 - Add EPEL and Remi repositories into your server :

On CentOS 6.x 32-bit :
     wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
     wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
     rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

On CentOS 6.x x86_64 (64-bit) :
     wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
     wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
     rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Step 4 - After installing, check the repository is added or not.

Step 5 -  Now enable your newly added Remi repository. Open the /etc/yum.repos.d/remi.repo file using a text editor.

Edit enabled=0 line to enabled=1    => Select the version which you want to enable, go to that PHP version and enable 1. Here I am upgrade version php56.

Step 6 -After enabling "php56", we can upgrade php version by using below command.
   yum --enablerepo=remi,remi-php56 update php\*

Step 7 - After all we can check the PHP and PHP dependency version.

Step 8 - Now restart the Apache server.

Step 9 - We can also check the version in phpinfo.php file.

That's it...

Sunday, June 7, 2015

How to Install VirtualBox 4.3 on CentOS/RHEL


Oracle VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. VirtualBox is a general-purpose full virtualizer for x86 hardware.

VirtualBox supports a large number of guest operating systems: Windows, DOS, Linux, Solaris, OpenSolaris, OpenBSD, etc.

Step 1 - Try to install VirtualBox using your default repository.

Step 2 - Download VirtualBox repository by using the below command and check that it is added on your repository.

Step 3 - Then check your OS and kernel versions.

Step 4 - After that update your yum repository using the below command.
Here we can see the kernel version is updated after the completion of "yum update".

Step 5 - First install repository "epel-relesase".

Step 6 - Before installing VirtualBox, we need to install dependency packages.

Step 7 - After that, we can install VirtualBox.

Step 8 - Run the below command for kernal updation

Step 9 - After successful installation, we can use Virtual Box application.

That's it...