Hi friends, after a long long time. I used to write this blog during my second year of the University life. These blog post contains the things I have done in Linux during my University life. Somehow I was unable to continue that. But now I need to add another post to this. It's about using MySQL and it's basic functions in Ubuntu. This was also an assignment I got during Uni life.
anu's blog
Thursday, June 30, 2011
Friday, March 26, 2010
Ubuntu grub 2 edit
I previously spoke about upgrade Ubuntu grub. I did it for do some fancy things like customize my grub such as adding a background picture, change colors. Then I came up with a serious issue. Actually after I found the solution it seemed very easy but finding the solution by my own took some serious time. That's why I thought to write this article.
When we fully update our OS, it will show in our grub loading time. It shows not only the upgraded version but also the previous versions also. So after we did that several times, our screen fill with those upgrade version details at the grub loading time. It seems unnecessary. If you are running some other OS with Ubuntu you will feel it badly, because you have to press down arrow key several times. In "GNU GRUB 0.97" version you can edit those information in menu.lst file which locate /boot/grub directory. All you have to do is comment those previous upgraded versions.
Here is the thing, after you have upgraded the grub 0.97 to grub 1.96 it is no use of editing that menu.lst file. Now you have to edit grub.cfg file which locates in the same directory. But the contents little bit difference. You will be able to identify those changes when you see it, like "uuid" replace with "root".
As an example in menu.lst file you will be able to see a block of context similar to this:
But that will display in grub.crg as follow:
So now you can use grub2 with confidence.
*** Thank You ***
** /-\ |\| |_| _| /-\ **
When we fully update our OS, it will show in our grub loading time. It shows not only the upgraded version but also the previous versions also. So after we did that several times, our screen fill with those upgrade version details at the grub loading time. It seems unnecessary. If you are running some other OS with Ubuntu you will feel it badly, because you have to press down arrow key several times. In "GNU GRUB 0.97" version you can edit those information in menu.lst file which locate /boot/grub directory. All you have to do is comment those previous upgraded versions.
Here is the thing, after you have upgraded the grub 0.97 to grub 1.96 it is no use of editing that menu.lst file. Now you have to edit grub.cfg file which locates in the same directory. But the contents little bit difference. You will be able to identify those changes when you see it, like "uuid" replace with "root".
As an example in menu.lst file you will be able to see a block of context similar to this:
#title Ubuntu 9.04, kernel 2.6.28-17-generic
#uuid 62ddb71b-c0fb-4a3d-9f21-87649aef2712
#kernel /boot/vmlinuz-2.6.28-17-generic root=UUID=62ddb71b-c0fb-4a3d-9f21-87649aef2712 ro quiet splash
#initrd /boot/initrd.img-2.6.28-17-generic
#quiet
But that will display in grub.crg as follow:
#menuentry "Ubuntu, linux 2.6.28-17-generic" {
# linux /boot/vmlinuz-2.6.28-17-generic
# root=UUID=eee7e530-9088-4a70-a70c-3a559164416d ro quiet splash
# initrd /boot/initrd.img-2.6.28-17-generic
#}
So now you can use grub2 with confidence.
*** Thank You ***
** /-\ |\| |_| _| /-\ **
Monday, March 22, 2010
Configure Apache server ready for PHP suport by using httpd.conf
This article also relate to one of my previous article named as "Installing Apache...". There I have mentioned that I going to tell more about configuring httpd.conf file. Here is the secons article relate to that. In my previous article I have spoke about SSL configuration. Now we can talk about configuring PHP in our web server.
Here are the steps that I have followed.
• First I downloaded the source from the following link.
http://www.php.net/get/php-5.3.1.tar.gz/from/in.php.net/mirror
• Next extracted the source file by using following command
tar -zxvf php-5.3.3.tar.gz
• Next go in to the extracted folder by using following command
cd /path_to_the_extracted_source_directory/
• Then configure the source by using following command
./configure –with-apxs2=/usr/local/apache2/bin/apxs –prefix=/usr/local/apache2/php
• Next thing is to build the source files. To do that used the command,
make
• After building they (php authorization) gave a license message and asked to run the following command,
make test
• After that place build files to mentioned directory in “prefix” tag by using,
make install
• The next thing I did is make a php file named it as “anu.php” and places it in the /usr/local/apache2/htdocs/ directory. The content of the php file is as follow,
phpinfo();
• Next I had to check the libphp5.so is in my /usr/local/apache2/modules directory. Yes it was there.
• The next thing was placed php.ini file into /usr/local/apache2/php directory in the current directory I got php.ini-development file and I had to copy it in to that directory.
cp -p php.ini-development /usr/local/apache2/php/php.ini
• Next step is edit httpd.conf file which is locate in /usr/local/apache2/conf directory Following lines are added further.
• That's all I had to do. At last I start the Apache and from my browser I tried to access my anu.php file
/usr/local/apache2/bin/apachectl start (in terminal)
https://localhost/anu.php ( in browser address bar)
* Now you will be able to see the default php page with lots of details. That means you have done it correctly. *
Here are the steps that I have followed.
• First I downloaded the source from the following link.
http://www.php.net/get/php-5.3.1.tar.gz/from/in.php.net/mirror
• Next extracted the source file by using following command
tar -zxvf php-5.3.3.tar.gz
• Next go in to the extracted folder by using following command
cd /path_to_the_extracted_source_directory/
• Then configure the source by using following command
./configure –with-apxs2=/usr/local/apache2/bin/apxs –prefix=/usr/local/apache2/php
• Next thing is to build the source files. To do that used the command,
make
• After building they (php authorization) gave a license message and asked to run the following command,
make test
• After that place build files to mentioned directory in “prefix” tag by using,
make install
• The next thing I did is make a php file named it as “anu.php” and places it in the /usr/local/apache2/htdocs/ directory. The content of the php file is as follow,
phpinfo();
• Next I had to check the libphp5.so is in my /usr/local/apache2/modules directory. Yes it was there.
• The next thing was placed php.ini file into /usr/local/apache2/php directory in the current directory I got php.ini-development file and I had to copy it in to that directory.
cp -p php.ini-development /usr/local/apache2/php/php.ini
• Next step is edit httpd.conf file which is locate in /usr/local/apache2/conf directory Following lines are added further.
LoadModule php_module modules/libphp5.so
AddHandler php5-script php
DirectoryIndex index.html index.php3
AddType text/html php
AddType application /x-httpd-php-source phps
• That's all I had to do. At last I start the Apache and from my browser I tried to access my anu.php file
/usr/local/apache2/bin/apachectl start (in terminal)
https://localhost/anu.php ( in browser address bar)
* Now you will be able to see the default php page with lots of details. That means you have done it correctly. *
*** Thank You *** :-) ...
Saturday, March 20, 2010
Configure Apache server ready for SSL suport by using httpd.conf
This is relate to one of my previous blog post named as "Installing Apache 2.2.14". Their I have mentioned that further editing for the httpd.conf will come later. This is one of that.
This is about enabling SSL in Apache server by editing the httpd.conf file. Lets check how can we do that.
There are several ways to configure SSL (Secure Sockets Layer) in Apache. The easiest way is reconfigure Apache with enable SSL. It can be done as follows.
• First we have to go into the source file which we have downloaded. We can do it by using the following command in our terminal. (relate to the above mentioned post)
cd /path_of_the_file_location/
• Then we have to configure the Apache tree with enable SSL. We can use the following command.
./configure –prefix=/usr/local/apache2 –enable-ssl
• Next we have to build and install Apache by using following commands
make
make install
• Next step is to edit our httpd.conf file which locates in /usr/local/apache/conf . The things we have to edit in that are written below.
Listen 0.0.0.0:443
SSLEngine on
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key
• Although we gave ssl.crt and ssl.key files above, there are no such directories in the mentioned location as default. We have to make those directories. The commands are as follows.
mkdir /usr/local/apache2/conf/ssl.crt
mkdir /usr/local/apache2/conf/ssl.key
• Now I had to create a self-signed server certificate for test purposes. The complete command is,
openssl req -new -x509 -days 365 -keyout /usr/local/apache2/conf/ssl.key/server.key -out /usr/local/apache2/conf/ssl.crt/server.crt -subj '/CN=Test-Only Certificate'
• Eventually I able to start Apache with SSL support.
/usr/local/apache2/bin/apachectl startssl
*** Thanks for reading this blog ***
This is about enabling SSL in Apache server by editing the httpd.conf file. Lets check how can we do that.
There are several ways to configure SSL (Secure Sockets Layer) in Apache. The easiest way is reconfigure Apache with enable SSL. It can be done as follows.
• First we have to go into the source file which we have downloaded. We can do it by using the following command in our terminal. (relate to the above mentioned post)
cd /path_of_the_file_location/
• Then we have to configure the Apache tree with enable SSL. We can use the following command.
./configure –prefix=/usr/local/apache2 –enable-ssl
• Next we have to build and install Apache by using following commands
make
make install
• Next step is to edit our httpd.conf file which locates in /usr/local/apache/conf . The things we have to edit in that are written below.
Listen 0.0.0.0:443
SSLEngine on
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key
• Although we gave ssl.crt and ssl.key files above, there are no such directories in the mentioned location as default. We have to make those directories. The commands are as follows.
mkdir /usr/local/apache2/conf/ssl.crt
mkdir /usr/local/apache2/conf/ssl.key
• Now I had to create a self-signed server certificate for test purposes. The complete command is,
openssl req -new -x509 -days 365 -keyout /usr/local/apache2/conf/ssl.key/server.key -out /usr/local/apache2/conf/ssl.crt/server.crt -subj '/CN=Test-Only Certificate'
• Eventually I able to start Apache with SSL support.
/usr/local/apache2/bin/apachectl startssl
*** That's all ***
But you may confused "actually is it over?" Yes, you can check it by your self.
First have to do is place a web page on the relavant directory and try to access that page from your web browser through localhost. Then click on the small icon at the begining of the address bar. Then you will get a small popup and then you can understand what had happened.
*** Thanks for reading this blog ***
Saturday, February 13, 2010
Upgrade your Ubuntu grub 0.94 to grub 2
First thing I have to say is after the upgrade the version print as 1.97 not "2". It is because we are using a beta version. For the reader I apologize because I was unable to upload photos relevant to this upgrade process. Here it's difficult to get screen shots (you will know why, when you are upgrading) and the photos I have taken are not clear enough to upload. Lets get to work.
After you login to the system, open terminal and give the following command.
Next you will be shown a blue screen with a message. Give " YES " to that question.
Again another window will appear and you have to do is just press "ENTER" key. But don't do these things as machines, first you read them well and try to understand what they are trying to convey you.
Now you have to reboot the machine.
In the next boot up process you will be given the an option to select your operating systems and addition to that there will be a line about "Grub 2". Select that and press "e". At the end of that same screen you can see what is "e" stands for.
Then from the next screen you have to select "root" and press "e" as you have done before.
Then you can see a line starting with
root [number and characters combination]
This number and character combination is not an arbitrary or come from heaven. You can see this details in /boot/grub/menu.lst file.
You have change the word "root" into "uuid". Just change that word only not any other character. Then press "ENTER".
From the next screen you have to select the particular "uuid ..." which you have edited and press "b". As I mentioned earlier the meaning of these argument are described at the bottom of the window.
At last you have to do is give the following command in your terminal.
That's it.
You may think what is the purpose of upgrading this grub. I just want to customize my grub such as adding an background image like things. I will come up how you can do that in my future post.
Thank you. Have Fun.
After you login to the system, open terminal and give the following command.
sudo apt-get install grub-pc
Next you will be shown a blue screen with a message. Give " YES " to that question.
Again another window will appear and you have to do is just press "ENTER" key. But don't do these things as machines, first you read them well and try to understand what they are trying to convey you.
Now you have to reboot the machine.
sudo reboot
In the next boot up process you will be given the an option to select your operating systems and addition to that there will be a line about "Grub 2". Select that and press "e". At the end of that same screen you can see what is "e" stands for.
Then from the next screen you have to select "root" and press "e" as you have done before.
Then you can see a line starting with
root [number and characters combination]
This number and character combination is not an arbitrary or come from heaven. You can see this details in /boot/grub/menu.lst file.
You have change the word "root" into "uuid". Just change that word only not any other character. Then press "ENTER".
From the next screen you have to select the particular "uuid ..." which you have edited and press "b". As I mentioned earlier the meaning of these argument are described at the bottom of the window.
At last you have to do is give the following command in your terminal.
sudo upgrade-from-grub-legacy
That's it.
You may think what is the purpose of upgrading this grub. I just want to customize my grub such as adding an background image like things. I will come up how you can do that in my future post.
Thank you. Have Fun.
Sunday, January 10, 2010
Cricket updates in Ubuntu terminal as a pop-up message
I'm a cricket fan. I like to watch cricket matches. But I don't have a TV in my boding place and exam is coming very closer. Therefore I'm satisfying just getting updates of the match. But to do that I have to go to a relevant website (I recommend http://www.cricinfo.com/) and get the update. But when I'm working with terminal I have waste extra time to go to web browser and watch it. How if the relevant details appear side of my window as a pop-up message. Cool isn't it? Let's try then.
dpkg --list | grep -i notify
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html"
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live"
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"
notify-send "`lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"`"
while [ 1 ]; do notify-send "`lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"`"; sleep 5m; done
Have fun.
- First you have to check whether you have the package "libnotify-bin". You can check it by executing following command in your terminal
dpkg --list | grep -i notify
- If you don't have that, then you have to install it by using our common "apt-get install" command.
- After that give the following command to see the content of a web page in the terminal. The command format is;
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html"
- After looking at the screen shot you can see there is not much information. The reason is most of them are comming under hidden links which you can see under "References"
- I just want to get the total marks and current batsman score and who are the current bowlers. Those details comes under last URL in this case. Finding it is a different scenario which is not relate to the topic, so I'm not going to explain it further.
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live"
- As you can see in the image I got relevant information as well as some additional stuff. From next command I filter out what I exactly need.
lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"
- Then by using following command I will be able to get the above detail as a pop up message side of my terminal window.
notify-send "`lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"`"
- As you can see that message will fadeout after some seconds. From the below command I get the updated information in every 5 minutes (5m)
while [ 1 ]; do notify-send "`lynx --dump "http://www.cricinfo.com/rsadomestic-09/engine/current/match/423149.html?view=live;wrappertype=live" | grep -A 20 -e "KwaZulu-Natal Inland 259 & 352/5d"`"; sleep 5m; done
Have fun.
Saturday, November 7, 2009
Installing Apache 2.2.14 in Ubuntu
1.) Open the terminal window and log as root
sudo su
Then give root password and enter
2.) Next we have to update the package index. ( https://help.ubuntu.com/8.04/serverguide/C/apt-get.html ) The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file. To update the local package index with the latest changes made in repositories, type the following:
apt-get update
3.) Now you have to check whether you have installed gcc and make packages already in Ubuntu. ( http://ubuntuforums.org/showthread.php?t=261366 ) To check that run the following command
dpkg --get-selections > installed-software
From above command they will create a list of what you have installed already in youe OS. After running that command you are not visible any changes in your terminal. Because that just create a file in your current position. So you have to run the bellow command to find where you are now.
pwd
Next run the bellow command to open that file
gedit /the_path_given_by_above_command/install-software
From that list you can check whether you have installe gcc and make packages already.
4.) If you are not installed gcc this is the command. We do this to get development tools. The importace of gcc ( http://en.wikipedia.org/wiki/GNU_Compiler_Collection ) is to compile various programs under GNU project.
apt-get install gcc
5.) Then you have to install make package too. Why we install "make" ( http://en.wikipedia.org/wiki/Make_(software) ) , because make is a utility for automatically building executable programs and libraries from source code.
apt-get install make
6.) Now you have to download the Apache source file. To do that visit this site ( http://httpd.apache.org/download.cgi ) and download the relavant stable version.
7.) This step is an extra thing that most of people don't follow but Apache developers thougherally ask to follow. That is verify that you have download the real source file. This can be check by using public key encryption process.
If you are trying to check PGP method you have to install pgpgpg package first.
apt-get install pgpgpg
8.) Next thing we have to do is extract the downloaded source directory. To do that go to the downloaded directory by using
cd /path_to_the_directory_where_you_save_the_source/
command and then give bellow command
tar zxvf file_name
In here z stands for "filter the archive through gzip", x stands for "extract files from an archive" v stands for "verbosely list files processed" and f stands for "use archive file"
9.) Then you have to go into extracted directory and configure. The next step is to configure the Apache source tree for your particular platform and personal requirements. To configure, give this command
./configure --prefix=/user/local/apache2.2.14
10.) Now you can build the various parts which form the Apache package by simply running the command
make
The time taken to process depend on your computer power as well as the modules that you have choosed to configure above command.
11.) Now it's time to install the package under the configured installation /user/local/apache2.2.14 The command is
make install
After running this command some directories and files will create on that given path.
12.) Now the basics are over. Now you can customize it. To do that go into /user/local/apache2.2.14./conf/ directory and open httpd.conf file and customize.
13.) Now you can start your Apache HTTP server by immediately running
/usr/local/apache2.2.14/bin/apachectl start
Then open a web browser and type http://127.0.1.1 in the browser address bar.
You can stop apache server by running following command
/usr/local/apache2.2.14/bin/apachectl stop
*** That's it.***
*** Further Editing in httpd.conf file will be later ***
THANK YOU...
sudo su
Then give root password and enter
2.) Next we have to update the package index. ( https://help.ubuntu.com/8.04/serverguide/C/apt-get.html ) The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file. To update the local package index with the latest changes made in repositories, type the following:
apt-get update
3.) Now you have to check whether you have installed gcc and make packages already in Ubuntu. ( http://ubuntuforums.org/showthread.php?t=261366 ) To check that run the following command
dpkg --get-selections > installed-software
From above command they will create a list of what you have installed already in youe OS. After running that command you are not visible any changes in your terminal. Because that just create a file in your current position. So you have to run the bellow command to find where you are now.
pwd
Next run the bellow command to open that file
gedit /the_path_given_by_above_command/install-software
From that list you can check whether you have installe gcc and make packages already.
4.) If you are not installed gcc this is the command. We do this to get development tools. The importace of gcc ( http://en.wikipedia.org/wiki/GNU_Compiler_Collection ) is to compile various programs under GNU project.
apt-get install gcc
5.) Then you have to install make package too. Why we install "make" ( http://en.wikipedia.org/wiki/Make_(software) ) , because make is a utility for automatically building executable programs and libraries from source code.
apt-get install make
6.) Now you have to download the Apache source file. To do that visit this site ( http://httpd.apache.org/download.cgi ) and download the relavant stable version.
7.) This step is an extra thing that most of people don't follow but Apache developers thougherally ask to follow. That is verify that you have download the real source file. This can be check by using public key encryption process.
If you are trying to check PGP method you have to install pgpgpg package first.
apt-get install pgpgpg
8.) Next thing we have to do is extract the downloaded source directory. To do that go to the downloaded directory by using
cd /path_to_the_directory_where_you_save_the_source/
command and then give bellow command
tar zxvf file_name
In here z stands for "filter the archive through gzip", x stands for "extract files from an archive" v stands for "verbosely list files processed" and f stands for "use archive file"
9.) Then you have to go into extracted directory and configure. The next step is to configure the Apache source tree for your particular platform and personal requirements. To configure, give this command
./configure --prefix=/user/local/apache2.2.14
10.) Now you can build the various parts which form the Apache package by simply running the command
make
The time taken to process depend on your computer power as well as the modules that you have choosed to configure above command.
11.) Now it's time to install the package under the configured installation /user/local/apache2.2.14 The command is
make install
After running this command some directories and files will create on that given path.
12.) Now the basics are over. Now you can customize it. To do that go into /user/local/apache2.2.14./conf/ directory and open httpd.conf file and customize.
13.) Now you can start your Apache HTTP server by immediately running
/usr/local/apache2.2.14/bin/apachectl start
Then open a web browser and type http://127.0.1.1 in the browser address bar.
You can stop apache server by running following command
/usr/local/apache2.2.14/bin/apachectl stop
*** That's it.***
*** Further Editing in httpd.conf file will be later ***
THANK YOU...
Subscribe to:
Posts (Atom)