Latest Entries »

Configure Conky-Lua in Ubuntu (12.10 & 12.04) or Fedora


conky කියන්නෙ graphical system monitor එකක්. හැබැයි මේක වැඩ කරන්නෙ Unity එකටයි Gnome classic එකටයි විතරයි. ඉහල තියෙන පින්තූරෙ දැක්කම ඒක පේනව ඇති. මේක ඔයාලගෙ ලිනක්ස් machine එකට දාන විදිය මම දැන් කියන්නම්.

මුලින්ම terminal එක open කරගන්න. ඊලගට ඔයලා පාවිච්චි කරන්නෙ Hanthana හරි Fedora නම් හරි පහත command එක terminal එකේ type කරන්න.
yum install conky-all
ඔයාල භාවිතා කරන්නෙ Ubuntu නම්
sudo apt-get install conky-all
ඊලගට conky-loa download කරගන්න.

හරි download උනාට පස්සෙ download folder එකට ගිහල්ල mouse එක right click කරල .tar.gz package එක extract කරගන්න.


එහෙම extract කරපු folder එක ඇතුලෙ ඔයාලගෙ OS එකට අදලා tar.gz package එක extract කරගන්න. මගේ තියෙන්නෙ Ubuntu නිසා මම ඒ package එක extract කරගත්ත.


හරි දැන් ඔයා තෝරගනිපු folder එක open කරගෙන (Ubuntu වල නම් conky ubuntu-lua folder එක) ඒකෙ තියෙන conkyrc කියන file එක .conkyrc කියල වෙනස් කරගන්න. ඊලගට ඒ file එක Home folder එකේ paste කරන්න. conkyrc file එක ".conkyrc" කළ එකෙන් කරන්නෙ ඒ file එක අපි hidden file එකක් කළ එකයි (හරියට Windows වල වගේ). ඊලගට Home folder එකට ගිහිල්ල ඒකේ menu bar එකේ View->Show Hidden Items select කරන්න. හරි දැන් ඔයාට Hidden files ටික බලාගන්න පුළුවනි. (හෙන ගොඩක් තියෙනවනේ :) )


හරි දැන් ඔයා Home folder එක ඇතුලෙ .conky කියල new folder එකක් හදන්න. ඒකට දෙවනියට extract කරපු (conky ubuntu-lua) folder එක ඇතුලෙ තියෙන අනිත් file දෙක copy කරන්න.


හරි ඊලගට Home folder එකට මුලින්ම copy කරපු .conkyrc file එක gedit හරි මොකක් හරි editor එකකින් open කරගන්න.


ඊලගට කරන්න තියෙන්නෙ ඒකෙ තියෙන
~/.lua/scripts/clock_rings.lua
line එක
~/.conky/clock_rings.lua
 ඊලගට
http://weather.noaa.gov/pub/data/observations/metar/stations/ LQBK
line එක
http://weather.noaa.gov/pub/data/observations/metar/stations/ VCBI
විදියට වෙනස් කරන එක විතරයි. ඊලගට terminal එක open කරගෙන conky කියල type කරන්න. එතකොට ඔයාට අර උඩම තියෙන graphical system monitor එක ලැබේවි.

තාම අපේ වැඩේ සම්පූර්ණ නැහැ. ඒ කියන්නෙ අපි terminal එක close කළාට පස්සෙ හරි PC එක restart කරාට පස්සෙ හරි මේක නැති වෙලා යනව. ඒකට කරන්න තියෙන්නෙ Application -> System tools -> Preferences -> Startup Applications කියන එක select කරල පහල රූපෙ තියෙන විදියට ඒක සම්පූර්ණ කරල computer එක restart කරල බලන එක විතරයි.



Name : Conky
Command : sh -c "sleep 30s; conky -c ~/.conkyrc"
අන්තිමට කියන්නෙ තියෙන්නෙ graphical system monitor එකේ ඔයාගෙ dongle එකේ transmit/recieve rates බලාගන්න ඕනෙ නම් කරන්න තියෙන්නෙ .conkyrc file එකේ eth0 කියන තැන් ppp0 කියල වෙනස් කරගන්න එක විතරයි.

References
http://www.unixmen.com/configure-conky-lua-in-ubuntu-11-10-12-04-fedora-debian-and-linuxmint-howto-conky/

ලිනක්ස් වල HSDPA dongle එකකින් Internet Connect වෙමු

හුගක් අයට තියෙන ලොකු ප්‍රශ්නයක්. හැබැයි උත්තරේ නම් සරලයි. වින්ඩෝස් වල වගේ අපි පාවිච්චි කරන ඩොන්ගල් වල drivers install කරන්න දෙයක් නැහැ ඒ නිසා කට්ටියට හරි ලේසියි. මම පාවිච්චි කරපු හැම Huawei dongle එකකම වගේ drivers Ubuntu වල තිබුන. හරි Internet Connect වෙන්න කරන්න තියෙන්නෙ පොඩි දෙයයි. ඒ ටික පහල දාල තියෙන Screenshots ටික බලල කරන්න. මේ ක්‍රමයෙදි ඔයාගෙ ISPගෙ APN එක දැනගෙන ඉන්න වෙනව. ඒ අයගෙ customer service එකට call එකක් දුන්න නම් ඔයාට APN එක මොකක්ද කියල නිකම්ම දැන ගන්න පුළුවන්. මම පාවිච්චි කරන Etisalat වල APN එක වෙන්නෙ "etisalat.data".









How to Install Lost Ubuntu Bootloader Using Boot-Repair

ලිනක්ස් පාවිච්චි කරන හුගක් අයට තියෙන ප්‍රශ්නයක් තමයි ඒ අයගෙ machine එකට අළුතෙන් Windows දැම්ම‍ට පස්සෙ bootloader එක නැති වෙලා යන එක. ඔයා පාවිච්චි කරන්නෙ Ubuntu නම්, නැතිවෙලා ගිය bootloader එක ආයෙමත් install කරන්න පුළුවන්. හැබැයි ඒකට Ubuntu Live CD එකකුයි Internet එකයි අවශ්‍යයි. හරි දැන් අපි bootloader එක install කර ගන්නෙ කොහොමද කියල බලමු.

- මුලින් ම ඔයාගෙ computer එක Ubuntu live-CD එක දාල boot කර ගන්න.
- "Try Ubuntu" මත Enter කරන්න.
- Internet connect වෙන්න.
- Terminal එක open කර ගෙන පහත commands type කරන්න.

sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update 
sudo apt-get install -y boot-repair && boot-repair 

හරි ඊලගට තියෙන්නෙ අපි Install කරපු Boot-Repair program එක open කර ගන්න එක. ඒ සදහා terminal එක open කරල පහත command එක type කරන්න.
boot-repair 

හරි එතකොට ඔයාට ඔය උඩ තියෙන විදියට program එක open වේවි. ඊලගට කරන්න තියෙන්නෙ ඔය "Recommended repair" කියන button එක ඔබන එක විතරයි. ඊලගට repair එක ඉවර උනාට පස්සෙ paste.ubuntu.com/XXXXX විදියට එන URL ලියා ගන්න. ඊලගට computer එක restart කරන්න. මේ ටික කරලත් ඔයාලගෙ වැඩේ හරි ගියෙ නැත්නම් අර කලින් ලියාගත්ත URL එක forum එකකට දාල බලන්න.

References
https://help.ubuntu.com/community/Boot-Repair

Windows default වෙන විදියට Ubuntu bootloader එක හදන්නෙ කොහොමද?

මේ සදහා ක්‍රම දෙකක් තියෙනව. ඒ ක්‍රම දෙකටම grub file එක වෙනස් කළ යුතුයි. ඒ ක්‍රම දෙක තමයි

  • shut down කරන්න කලින් පාවිච්චි කරපු OS එක boot වෙන්න දෙන එක හෙවත් "saved" method එක.
  • හැම වෙලාවෙම එක OS එකක් default විදියට තැබීම.

මුලින්ම අපි සොයා ගන්න ඕනෙ මොන OS ද අපේ bootloader එකේ තියෙන්නෙ කියල. ඒ සදහා terminal එක open කරගෙන පහත command එක type කරන්න.

grep menuentry /boot/grub/grub.cfg


ඉතින් ඔයාගෙ computer එකේ OS ගොඩක් තියෙනවනම් කරන්න තියෙන්නෙ "saved method" එක යොදා ගන්න එක. මම වගේ :)

හොදයි මුලින්ම "saved method" එක ගැන කතා කරමු. grub boot configuration file එක open කරගන්න පහත command එක terminal එකේ type කරන්න. අවශ්‍ය උනොත් password එකත් දෙන්න.

sudo gedit /etc/default/grub

එහිදි ඒ file එක gedit එකෙ හරහා open වේවි. ඊට පස්සෙ කරන්න තියෙන්නෙ හරි පොඩි දෙයයි. ඔයා පාවිච්චි කරන්න කැමති "saved method" එක නම් ඒ file එකේ තියෙ GRUB_DEFAULT කියන තැන සමාන ලකුන ඉස්සරහින් saved කියල type කරන්න.

GRUB_DEFAULT=saved

ඊට පස්සෙ පහත line එකත් ඇතුලත් කරන්න.

GRUB_SAVEDEFAULT=true

ඔය ඉහලින් විස්තර කරේ "saved method" යොදා ගන්න විදිය. ඔයාට ඔනෙ හැම වෙලාවෙම එකම OS එකක් default විදියට තියා ගන්න නම් කරන්න තියෙන්නෙ මම අර මුලින්ම අරගත්තු grep ... output එකේ තිබුන OS එකක නමක් copy කරගෙන ඒ නම් GRUB_DEFAULT එකට දෙන එක විතරයි. හැබැයි ඒ නම "" ලකුනු අතර type කළ යුතුයි.

GRUB_DEFAULT="Windows NT/2000/XP (loader) (on /dev/sda1)"


වැදගත්ම අන්තිම පියවර

ඔයා grub configuration file එක වෙනස් කරාට පස්සෙ ඒක save කරල gedit editor එක close කරන්න. ඊට පස්සෙ terminal එක open කරගෙන පහත command එක දෙන්න. password එක ඇහුවොත් ඒකත් දෙනන.

sudo update-grub

හරි දැන් වැඩේ හරි ඔයා computer එක restart කරල බලන්න.

references

http://askubuntu.com/questions/52963/how-do-i-set-windows-to-boot-as-the-default-in-the-boot-loader

How to Install and Configure DNS


My sincere gratitude goes to Mr. Anuradha Jayakody and Mr. Rajitha Tennekoon of Sri Lanka Institute of Information Technology for teaching me these valuable concepts. Most of the below configurations are taken from the lab sheets written by them.

Prerequisites

Centos 5.5 installed in VMWare.
Stop the LDAP service. Stop DHCP service.
Set VMware network settings to NAT and set your server IP settings to obtain IP address automatically.
Restart the network service on CentOS.

Installation and configuration steps

Installing the Pre-Requirements

Install VM-Ware tools Go-to Applications -> Add/Remove Software
Under "Servers" Check (Tick) DNS Name Server
Then Select "Network Servers" -> click "Optional packages" -> make sure to select 12:dhcp-3.05.....el5.x86_64
Close it and select "Server Configuration Tools" click on "Optional packages" and make sure to check the following
system-config-bind-4.0 ..... el5.centos.noarch -> Nice GUI interface to manage your DNS server and records
Then install the selected packages

Installing the Dependencies 

Open a new terminal and install DNS & following dependencies
yum install -y bind-libs bind bind-utils bind-chroot 

Downloading the necessary packages 

Download the Webmin.rpm package from the following URL.
http://sourceforge.net/projects/webadmin/files/webmin/1.560/webmin-1.560-1.noarch.rpm/download 
Install Webmin via Webmin.rpm package. Webmin is a Free magnificent web based administrative tool for Linux environment.

Restoring the Network 

Set VMware network settings to VMNET2 and set your server IP address statically.
Start the LDAP service.
Start DHCP service.
Restart the network service

Configuring & Setting up the DNS 

Setting up the Environment 

Go to "System" -> "Server Settings" -> "Domain Name System"
Click ok for the Warning Massage (No Bind configuration was found)
Delete the existing components without the DNS Security Key [rndc key] and DNS server entry
You will be not able to delete the "Internet forward zone [.]" due to administrative restrictions. So you can delete it via the WebMin tool.
File -> Save Click Yes
If it does not load...........
open your web browser
go to "https://localhost:10000/"
Add an exception for the certificate issue and proceed
login using your root credentials
Go to "Servers" -> "BIND DNS Server"
Delete all the existing DNS Zones there
Now try to open your "BIND configuration GUI" via "System" -> "Server Settings" -> "Domain Name System"
Now you should be able to load the GUI
You should only see the rndc key and the DNS Server entry now.
Verify that all the entries are gone.

Adding “IPV4 Reverse” Zone 

Right click on "DNS Server" -> "Add" -> "Zone"
Now we are going to add our first zone.
We are going to add "IN Internet" Zone. So click the "OK" Button under the "IN Internet" drop-down menu.
Change the Origin Type to "IPV4 Reverse" -> click "OK"
Click on the "+ Add" Button twice.
Then Fill in your IP Address scheme in there. 10.0.1
Keep it as "Master" and click on "OK"
All the details in the next screen will depend on your network configuration and requirements. Ex. What is the refresh levels and the Expiration times.
We will keep the default settings and only we are considering is the "Zone File Path".
Change the "Zone File Path" into; 1.0.10.in-addr.arpa.zone -> Reverse of your IP Schema . Dirrection- Addr.arpa.zone
".zone" is a must and it is really important.
Then click "OK" and it will refresh the "BIND configuration GUI" and will not update anything.
After clicking "OK" then click "Cancel".
In "BIND configuration GUI" Goto File -> click "Save" -> Select "Yes"
Close it and Open it again so it will refresh and you will be able to see the zone that you added previously.
Now configure your Forward zone.
Right click on "DNS Server" -> "Add" -> "Zone"
We are going to add "IN Internet Forward" Zone. So click the "OK" Button under the "IN Internet" dropdown menu.
Change the Origin Type to "Forward" -> click "OK"
Give a name to the Forward zone "matara.sliit.lk."
Make sure to put a "." at the end of the name.
Here also change only the name of the "Zone File Path" as "matara.sliit.lk.zone"
Click "OK" and the Save the config as previously.

RNDC Entry

A Security key that uses to pass information securely between the DNS and DHCP server. Whenever you feel that the key is been compromised, Double click on the rndckey entry and click on the new button to generate a new key. 

Editing the configuration file 

Go to webmin and verify whether the created two entries(zones) are mapped or not.
Now it is the time to configure the configuration file on DNS server and make the DNS service run.
Click on the "Edit config File" in the webmin GUI.
Paste the following function after the first four comment lines
controls{
         inet 10.0.1.2 allow { localhost; } keys { rndckey; };
}; 
Find the following function on the configuration file.
zone "matara.sliit.lk." IN {
      type master;
      file "matara.sliit.lk.zone";
}; 
Edit it as follow.
zone "matara.sliit.lk." IN {
      type master;
      file "slaves/matara.sliit.lk.zone";
      allow-update {
            key rndckey;
      };
}; 
Then find the following function
zone "1.0.10.in-addr.arpa." IN {
      type master;
      file "1.0.10.in-addr.arpa.zone";
}; 
Edit it as follow.
zone "1.0.10.in-addr.arpa." IN {
      type master;
      file "slaves/1.0.10.in-addr.arpa.zone";
      allow-update {
             key rndckey;
      };
}; 
Observe the changes in the above functions that you have made and search and understand why you need to do such changes.
Click on the "SAVE" button to save the changes to the config file.

Editing the “resolv.conf” file 

In a terminal edit the resolv.conf file which resides on the etc folder.
gedit /etc/resolv.conf 
Give your search domain and your nameserver IP in the config file.
search matara.sliit.lk
nameserver 10.0.1.2 //your server ip
Save the file.
Find out the usage of “resolv.conf” file and about why we have insert the above two entries.

Making the Slave Zone copies 

Browse the folder "/var/named/chroot/var/named" and then delete all the unnecessary zones there if they exist.

DO NOT DELETE THE TWO ZONES THAT YOU HAVE CREATED BEFORE. 

Copy the two zone files that you have created inside this folder to the "slaves" folder which resides at the same directory.
So you will be having working copies at "/var/named/chroot/var/named" and the slave copies at "/var/named/chroot/var/named/slaves"
If something goes wrong, you will be able to back-up the zones using the original zones.

Setting permissions to those files 

Open up a terminal and move in to the slaves directory
cd /var/named/chroot/var/named/slaves 
Check the permissions of the files and folders on that directory.
Now give the write permissions to the group for the files inside the directory.
chgrp named *
chmod g+w * 
Addressing Forward and Transfer zones 

Go back to webmin.
Go to Servers -> BIND DNS Server -> click on "Forwarding and Transfers"
What is a Forward zone?
It will get you out through the Internet
If you don't have an IP Address of a valid Name Server (Provided by ISP) to route through the internet, give your router interface IP.
Type it under the IP address of "Servers to forward queries to"
Then Click on "Save" button.
Why are you giving your router interface address if you haven’t got a valid Name server?

Starting the DNS server 

Before starting the BIND server, make sure to check the “BIND.conf” file.
You can do this via the "Check BIND Config" Item in the webmin GUI under Servers -> BIND DNS Server.
Or else you can use the terminal to check the config file.
named-checkconf 
If you come across any errors, it is the time to correct the syntaxes in BIND.conf file. Do the corrections until you succeed.
Before proceed let’s check what happen if we have any errors.
Insert any letter in a blank space in your configuration file using webmin.
Save the file and check the config file via the “Check BIND Config” option in webmin.
Then correct the error.
Click on the link "Start BIND" in the Upper right corner of the Webmin Interface to start the BIND service.
Or start the service via the terminal.
service named start

Checking and Verifying whether the DNS server is working

You can use the “nslookup” tool to check the DNS service.
Open a terminal type nslookup.
Then type the name you need to resolve.
Hint : type “matara.sliit.lk” and observe the output.
Then check the both name-to-IP and IP-to-name conversions are working properly or not.
Also use the “dig” and “host -l” tools to check whether the DNS is working properly.
dig matara.sliit.lk
dig 1.0.10.in-addr.arpa
host -l matara.sliit.lk
Observe the out puts from the tools and search about the usage of the tools.

How to Install and Configure DHCP Server


My sincere gratitude goes to Mr. Anuradha Jayakody and Mr. Rajitha Tennekoon of Sri Lanka Institute of Information Technology for teaching me these valuable concepts. Most of the below configurations are taken from the lab sheets written by them. 

Prerequisites

Centos 5.5 installed in VMWare.
Stop the LDAP service.
Set VMware network settings to NAT and make your server IP settings to obtain IP address automatically.
Restart the network service on CentOS.

Installation and configuration Steps

Type the following command and install DHCP.
yum install –y *dhcp*
After you install the DHCP service, change your network settings to VMNET2 and assign your server static IP address.

Warning: If you do not configure the network settings to VMNET2 this installation will mess-up and harm entire company network.

Check the server’s IP is configured to 10.0.1.2 ( Specially you have to make sure, your server has been configured to static IP address)

 What is the command you have used to check the IP settings?
ifconfig
Type following command to copy the sample DHCP file given by the installation. Importantly, you have to remember that, this is the file we are going to configure as the DHCP server. Any misconfiguration of this file will effect to the smooth functionality of the DHCP server.
cp -f /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf
If it asks to over write the file, over write it. Understand and write down what is the backup file here? And what is the configuration file we will be using here?
Back up file - dhcpd.conf.sample Configuration file - dhcpd.conf
Type following command to edit the dhcpd.conf file
gedit /etc/dhcpd.conf
If you don’t have following 3 lines in your DHCPD.conf file add them. And google for them and find what are meanings of those lines.

ddns-update-style interim;
#ignore client-updates;
allow client-updates; 


DYNAMIC DNS UPDATES

The DHCP server has the ability to dynamically update the Domain Name System.Within the configuration files, you can define how you want the Domain Name System to be updated. These updates are RFC 2136 compliant so any DNS server supporting RFC 2136 should be able to accept updates from the DHCP server.

Two DNS update schemes are currently implemented, and another is planned. The two that are currently available are the ad-hoc DNS update mode and the interim DHCP-DNS interaction draft updatemode. If and when the DHCP-DNS interaction draft and the DHCID draft make it through the IETF standards process, there will be a third mode, which will be the standard DNS update method. The DHCPserver must be configured to use one of the two currently-supported methods, or not to do dns updates. This can be done with the ddns-update-style configuration parameter.

THE INTERIM DNS UPDATE SCHEME

The interim DNS update scheme operates mostly according to several drafts that are being considered by the IETF and are expected to become standards, but are not yet standards, and may not be standardized exactly as currently proposed.

These are:
draft-ietf-dhc-ddns-resolution-??.txt
draft-ietf-dhc-fqdn-option-??.txt
draft-ietf-dnsext-dhcid-rr-??.txt

Because our implementation is slightly different than the standard, we will briefly document the operation of this update style here.

The first point to understand about this style of DNS update is that unlike the ad-hoc style, the DHCP server does not necessarily always update both the A and the PTR records. The FQDN option includes a flag which, when sent by the client, indicates that the client wishes to update its own A record. In that case, the server can be configured either to honor the client's intentions or ignore them. This is done with the statement allow client-updates;or the statement ignore client updates; By default, client updates are allowed.  

ddns-update-style interim : Now we have our information, so let's configure the server by creating a text file named /etc/dhcpd.conf. The first line in the file must be the DNS update scheme. There are 2 choices, but only one that works reliably ... so we will use that one.That is ddns-update-style interim  

ignore client-updates : allow the DHCP to update client info to a Dynamic DNS server. In our example, we are not going to try and update a Dynamic DNS via our DHCP server, so we will not allow client updates.

Dynamic DNS service

Dynamic DNS is provided by companies to allow users with Dynamic IP addresses to obtain a Domain Name that will always by linked to their changing IP address. The IP address is updated by either client software running on a computer or by a router that supports Dynamic DNS, whenever the IP address changes.

Carefully change following areas and understand each and every line and make a note that why exactly those lines are?

subnet 10.0.1.0 netmask 255.255.255.0 {
# --- default gateway
option routers 10.0.1.1;
option subnet-mask 255.255.255.0;
option nis-domain "blogspot.com"; 
option domain-name "blogspot.com"; 
option domain-name-servers
option time-offset -18000; # Eastern Standard Time 
allow booting; 
allow bootp; 
range dynamic-bootp 10.0.1.6 10.0.1.254;
default-lease-time 21600 max-lease-time 43200; 

Then comment the function named as 

host ns { ......
}

What is BootP? 

BOOTP, short for Bootstrap Protocol, is a protocol used to allow an Ethernet network device to obtain an IP Address over the network. 

A device that wants to obtain an IP address broadcasts a BootP request that identifies the device by its MAC address, an identifying six octet number ( ex: 00:A0:45:08:CD:8D) that is uniquely assigned to a device by its manufacturer. A BootP server on the network, sees the request and sends a BootP reply containing a desired IP address (ex: 192.168.1.10) to the device, thereby making it now become accessible to higher level network communications using that IP address. 

Save the file. 

Edit the following file and give the IP address that client need to contact and the Ethernet interfaceclients need to contact to obtain IP address from the server.

gedit /etc/sysconfig/dhcrelay 

INTERFACES="eth0" 
DHCPSERVERS="10.0.1.1" 

dhcrelay agent 

DESCRIPTION 

The Internet Systems Consortium DHCP Relay Agent, dhcrelay, provides a means for relaying DHCP and BOOTP requests from a subnet to which no DHCP server is directly connected to one or more DHCP servers on other subnets. 

OPERATION 

The DHCP Relay Agent listens for DHCP and BOOTP queries and responses. When a query is received from a client, dhcrelay forwards it to the list of DHCP servers specified on the command line. When a reply is received from a server, it is broadcast or unicast (according to the relay agent’s ability or the client’s request) on the network from which the original request came. 

Save the file and restart the DHCP service using 

service dhcpd restart 

Configure your client centos machines to obtain IP address form the DHPC service and verify that client has obtained an IP address from the given range of the IP addresses.

References

http://www.daemon-systems.org/man/dhcpd.conf.5.html 
http://wiki.answers.com/Q/What_is_the_BOOTP_protocol_used_for_where_might_you_find_it_in_Windows_network 

Add to Google Reader or Homepage

Bloggers - Meet Millions of Bloggers

Add to My AOL Add to netvibes