Archive | Ubuntu RSS feed for this section

Ubuntu: Working with text editor (vim)

19 Mar

If you are following my blog, you will find my last few articles are on Ubuntu.

Yeah, that’s where I am working now.

I’ve installed Ubuntu and working to have some knowledge, coz I’m going to develop my own extension for php in next few weeks.

Before going to get my hands dirty with extension development, I will need to get a bit used to the Ubuntu. I have already learnt some commands like how to install and update apache, php and other stuff. However until now I was unable to write something using any text editor. Thought I tried to use text editor by going to Application/Accessories/Text editor, however I was unable to create document other than my home directory. So I decided to use vim. I is never an easy job to work with vim if you are newbie.

Let’s tell you what I have learnt so for.

  1. To open a file you will need to write the following command in you shell terminal.

$ sudo vim /etc/resolv.conf

The above command will open if file already exist or will create new one.

  1. To make changes to the file you will need to press “Insert” key of your keyboard.
  2. You can use arrow keys to move left, right, up and down. You can use h, j, k, l for this purpose too.
  3. Once you write something in the file. Press “escape” key. This will take you to the command mode. Its necessary to go to the command mode for saving the document.
  4. After pressing the “escape” key, press colon(:). This will take you to the end of the file.
  5. write :wq for save and quite. And press enter at the end.
  6. you can you use i for going to “insert” mode and a for append mode.

That’s it for now. Hopefully I’ll learn more next time and will share with you too.

Ubuntu: Installing apache and Php

18 Mar

Its very easy to install apache and php on Ubuntu.

After installing Ubuntu you will need to do the following.

Go to Application/Accessories/Terminal

And write

$ sudo apt-get install apache2

A process will start when you will give correct password and apache will be installed in few minutes depending on your internet speed.

Next, for installing Php, write

$ sudo apt-get install php5

This will install Php5 for you.

If you want to create php extension you will need to install phpize.

This will need some extra steps.

Like, you will first need to install pear as

$ sudo apt-get install php-pear

This will prompt for y. enter y and press enter.

Now use the following code for installing phpize.

$ sudo apt-get install php5-dev

You may have heard about PECL extension. To install these extension you will need the following steps.

Before taking these step you will need to go through all the steps discussed above.

  1. install apache
  2. install php
  3. install pear
  4. install phpize

After installing all the above you will need to install another package named libcurl3-openssl-dev. To install this package you will need to run the following in terminal.

$ sudo apt-get install libcurl3-openssl-dev

And now install PECL as

$ sudo pecl install pecl_http

After running this command and accept default options PECL extension will be installed.

However to use this you will need to add a line to php.ini file. Do the following for this purpose

$ sudo nano /etc/php5/apache2/php.ini

And add the following line of code

“extension = http.so”

And restart your services as

$ sudo /etc/init.d/apache2 restart

$ sudo /etc/init.d/httpd restart

That’s it you have now installed apache, php, phpize and PECL extension.

Ubuntu: Creating resolv.conf file and connecting to internet

18 Mar

Yesterday I installed Ubuntu’s latest version for the first time in my life. It was no doubt a good experience. One thing that irritate me was, I was unable to connect to the internet. Thanks to our MIS department engineer who help me in getting out of the problem.

Here is what he did.

  • Create resolv.conf in /etc/ directory and place the following code.

nameserver 68.34.1.3

nameserver 68.34.1.4

These should be the first two line of the resolv.conf file.

Here first line contain the DNS sever IP and the second line is for alternate DNS.

Now in terminal write

sudo vim /etc/network/interfaces

This will open interfaces file

This file should contain the following code.

auto lo

iface lo inet loopback

iface etho0 inet static

address 66.45.5.55

netmask 45.45.5.55

network 45.45.4.44

broadcast 45.45.5.66

gateway 45.45.4.33

dns-nameserver 45.23.4.44, 45.23.4.64

dns-search example.org

auto eth0

Keep in mind that the address are not real, you will need to make sure all these address are correct in your case.