Pages

Wednesday 4 December 2013

Installing and removing specific version of Docker

Add repository to your apt source :http://docs.docker.io/en/latest/installation/ubuntulinux/#ubuntu-raring

One you're done. Uninstall previous version if any
$ sudo apt-get purge lxc-docker
Now you may install other specific version

$ sudo apt-get install lxc-docker-0.6.6

Now, you can confirm it by getting docker version
$ docker -v


Monday 13 May 2013

Virtualbox 4+

How to mount  shared folder ?


$ sudo mount -t vboxsf  SHARED_FOLDER_NAME /mount/paths

example:
Define shared folder , from vbox interface.  Remember the Machine Name.

Inside linux/Guest machine, run following command to mount the shared folder identified by it's machine name.

$sudo mkdir /home/f_drive

$ sudo mount -t vboxsf  F_DRIVE  /home/f_drive

You're done.


How to  increase or resize installation?
To resize your guest OS disc size, use VBoxmanage utility shipped with virtualbox.


VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB  

replace YOUR_HARD_DISK.vdi with your OS vdi and SIZE_IN_MB with the size you want to re-allocate.


How to resize root/extended/swap partition inside ubuntu?

Change your guest OS settings and make it boot from ubunut live cd/iso .
Choose "try ubunut"
run gparted
$sudo gparted
now, right click on partition which you want to resize.

You may not be able to resize few. For that, expand your extended partition to fill the remaining unallocated space. After that, move the logical partitions within the extended partition to the end. Then you should be able to shrink the extended partition at it's beginning, thus allowing you to expand your root partition.


Monday 6 May 2013

Browser is downloading .php file, instead of showing it

This case happened with me, when i created a new vhost entry in my server.
I looked around and found few solution.
In the end, i found php mod wasn't installed on my vps.

I then, installed ' libapache2-mod-php5 '
sudo apt get install   libapache2-mod-php5

And, on refreshing the page, i get it working.

Named Based routing or Virtual Host configuration

Ever wonder to run single IP address over multiple domains?
Rephrasing:  Run multiple site/domain on single ip?

Well, here comes name based routing into picture.
You can create virtual host entry in your apache's or nginx's site-available folder, and the you can enable it to point your domain to your vps/server ip address.

Here is how a typical vhost entry look like:

Wednesday 1 May 2013

Mod-wsgi: Installation on Apache2



sudo apt-get install libapache2-mod-wsgi
This should install the module. Now to activate it:

        sudo a2enmod mod-wsgi

Now to restart Apache2:
        sudo /etc/init.d/apache2 restart

Virtualmin: Open-source cpanel alternative

Few days back, I installed EHCP and gave it a try. Though it has the feature which a little literate hosting provider would neeed. However, its interface and feature organisation wasn't appealing. It really need work here . Beacause, after installing when i log into it, it looked totally  perplexed me.  However, it's features were suffice to fill  this gap.
Being said that i would also like to say Big Thank to ehcp developers for coming this far and giving a product that does what it made for.

Next, after googling little more I come across one more open-source cpanel alternative: Virtualmin.
It's based on webmin, So, it may look same for webmin users, but here they have provided support as well. That comes with virutalmin-pro version. Pro version has cool new features like support for Rails hosting, which i really miss in Virutalmin-GPL.

Sunday 21 April 2013

Utmost things to do with your new vps

Firstly, update and upgrate your installation

   apt-get update
  apt-get upgrade
Secondly, create new user and prevent root ssh login , to enhance security of your vps

Mysql2 installation and password reset


MySQL is a powerful database management system used for organizing and retrieving data.

To install MySQL, open terminal and type in these commands:

         sudo apt-get update
         sudo apt-get install mysql-server

Apach2 : complete removal


sudo apt-get --purge remove apache2
sudo apt-get remove apache2
sudo  apt-get purge apache2
sudo apt-get autoremove
sudo apt-get remove apache2*
sudo  dpkg --purge apache2.2-common

Sunday 14 April 2013

EHCP: opensource hosting control panel


Installing ehcp
  Go to their site and follow their simple, easy to follow instruction.
  1. Download tar
  2. run install script
     And follow instructions that pop on your screen.
After installing, launch your browser and load this page:  http://yourIP/ehcp
Enter your username(admin) and password(1234). You are ready to use ehcp cpanel

Saturday 13 April 2013

Nginx: Next generation server--Super light, Super fast

Nginx Conf file


Add the server information in the nginx file


     server {
listen 80 default_server;
server_name localhost
        location / {
            root   /home/deployer/www;
 #          index  index.html index.htm;
        }
        error_page  404              /404.html;
        error_page   500 502 503 504  /50x.html;
   }



    listen 80;
    server_name domain.com;
    charset utf-8;
    root /www/domain.com/public_html;
    passenger_enabled on;
    passenger_base_uri /blog;
    rails_spawn_method smart;
    rails_env production;




Now, you have server listening on port :80 and it's root location is set to /home/deployer/www.
For rails project, your application /public directory should be present there :Create a symlink in www, so that the app is viewable via the web.

 ln -s /home/deployer/www/media_analysis/public /home/deployer/www/media


Nginx start/stop/restart commands:

  • sudo /etc/init.d/nginx stop 
  • sudo /etc/init.d/nginx start 
  • sudo /etc/init.d/nginx restart

Errors:
   404 Not Found Error:
Make sure,  you have "passenger_enabled  on", if multiple server blocks:
                         If you already have passenger_root and passenger_ruby in your nginx.conf, but having this error, you must have some location blocks. Then you must specify passenger_enabled on; inside each location block.

Deploying to a sub URI


                      You already have your server(vhost) configured and you want your Ruby on Rails application to be accessible from the URL http://www.myDomain.nl/rails.
To do this, make a symlink in the virtual host’s document root, and have it point to your Ruby on Rails application’s public folder. For example:

ln -s /webapps/newApp/public /websites/myDomain/rails

Next, set 'passenger_enabled on' and add a 'passenger_base_uri' option to the server block:

http {
    ...

    server {
        listen 80;
        server_name www.myDomain.nl;
        root /websites/myDomain;
        passenger_enabled on;        # <--- These lines have
        passenger_base_uri /rails;   # <--- been added.
    }

    ...
}



References:

  1. http://techoctave.com/c7/posts/16-how-to-host-a-rails-app-with-phusion-passenger-for-nginx
  2. http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_a_ror_app
  3. http://alexpearce.me/2012/06/setting-up-a-vps/