Monthly Archives: April 2012

Time synchronization on Ubuntu 12.04LTS using NTP

To install the ntp, just enter this command at the terminal:

sudo apt-get install ntp

After installation, edit the default ntp configuration:

sudo nano /etc/ntp.conf

Commented out the default Ubuntu server,you can add your own time-servers here to synchronize with, or lists:

After you are done with the configuration, just restart the ntp service:

sudo service ntp restart

To check if the NTP service is synchronizing:

sudo ntpq -c lpeer

To check the synchronization log:

sudo tail -f /var/log/syslog

Geeky Comparison with Windows clock after synchronization 🙂


If you are using the firewall, then just allows port 123 on UDP level.

Hope this will help you!

Please Remember me in your prayers!

How to Install the DHCP Server on Ubuntu 12.04LTS

Ubuntu as DHCP Server:

To install dhcp server, enter the following command at a terminal prompt:

sudo apt-get install isc-dhcp-server

If there is more than one network card(s) in your Ubuntu server, then you have to select the network card on which your server will be listen for dhcp request. (By default, it listens on eth0).

You can change this by editing  /etc/default/isc-dhcp-server file:

sudo nano /etc/default/isc-dhcp-server

Change “eth0” to the interface on which you want that your server will listen for dhcp request (In my case, it is eth1):

It’s always a good practice to make a backup copy of /etc/dhcp/dhcpd.conf file:

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak 

Now we will change the default configuration by editing /etc/dhcp/dhcpd.conf, I normally delete everything inside the file and manually add the configuration that suits my needs 🙂

sudo nano /etc/dhcp/dhcpd.conf

Here is my dhcpd.conf file, you need to change it according to your needs:

ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
option subnet-mask;
option broadcast-address;
option routers;
option domain-name-servers;
option domain-name "ubuntu.internal";
subnet netmask {

Restart dhcp service using the following command:

sudo service isc-dhcp-server restart 

Configure Windows as DHCP Client:

Just follow these steps, in order to configure your Windows machine as DHCP client (In my case, it’s Windows 7):

To check the IP Address on Windows 7:

To Check the DHCP Leases on Ubuntu Server:
sudo tail /var/lib/dhcp/dhcpd.leases

Hope this will help you!

Please Remember me in your prayers!

apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName

After the initial install of Apache server, I got the following error while restarting the Apache service on Ubuntu 12.04:

The solution is really simple, just  add ServerName directive to /etc/apache2/httpd.conf :

 sudo nano /etc/apache2/httpd.conf


ServerName localhost

Finally restart the Apache server:

sudo /etc/init.d/apache2 restart

Hope this will help you!

Please Remember me in your prayers!

How to install Samba server on Ubuntu 12.04

Part 1: Configuring anonymous share with samba server

To install the samba package,enter the following command:

sudo apt-get install samba samba-common

Check the version of installed samba software by using this command:

smbd --version

Also install these suggested packages for samba:

sudo apt-get install python-glade2 system-config-samba

Go to your Windows machine and use this command in order to check the WORKGROUP name:

net config workstation

It will show the output, something like this:

Backup the smb.conf file, then delete it and create the new one:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 
sudo rm /etc/samba/smb.conf 
sudo touch /etc/samba/smb.conf 
sudo nano /etc/samba/smb.conf

Add this, in your smb.conf file (or change it according to your requirement):

#======================= Global Settings ===================================== 
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
path = /samba/share 
browsable =yes
writable = yes
guest ok = yes
read only = no

Save the smb.conf file and restart the service:

sudo service smbd restart

Access the samba share from windows (where ubuntu is the name of my samba server):

wao, we are able to access the samba share successfully 🙂

Let’s try to create something, inside the share folder:

Error, we cannot create anything inside the share folder 😦

Check the current permission on the samba share:

cd /samba/
ls -l

Change it, in such a way that everyone can read and write it(Check it, that it is allowed in your environment or not):

sudo chmod -R 0777 share
ls -l

Try to create something again, inside the share folder:

Verify the newly created file on samba server:

cd share/
ls -l 

Part 2: Add and manage users and groups

Add a group in your ubuntu server (in my case smbgrp):

sudo addgroup smbgrp

Create a new share, set the permission on the share ,add the user to the samba group and create samba password:

cd /samba/
sudo chown -R arbab:smbgrp secure/ 
ls -l 
sudo chmod -R 0770 secure/
ls -l
sudo adduser arbab smbgrp
sudo smbpasswd -a arbab

Add the newly created samba share in smb.conf file:

 path = /samba/secure
 valid users = @smbgrp
 guest ok = no
 writable = yes
 browsable = yes

Restart the samba service and check the syntax error with testparm:

sudo service smbd restart 
sudo testparm

Testing from Windows Machine:

Verification from Ubuntu server:

cd /samba/secure/
ls -l

Hope this will help you!

Please Remember me in your prayers!

Enjoy 🙂

How to install Webmin on Ubuntu 12.04

Webmin is a web-based interface for system administration for Linux/Unix. You can setup user accounts, Apache, DNS,DHCP, file sharing and much more by using any modern web browser.

First, we need to install the dependencies with the command:

sudo apt-get install perl libnet-ssleay-perl libauthen-pam-perl libpam-runtime 

openssllibio-pty-perl apt-show-versions python

Now, we need to download the Webmin deb package from Sourceforge (I download it  in /tmp directory):


Then just run the command :

sudo dpkg --install webmin_1.580_all.deb

Webmin is installed now and you will be able to access it via a browser using, https://server-ip:10000. In my case it is,https://tendo:10000.

(It will show you the security warning, just accept it)

Enter your Username and Password that you use for login on to your server.

After login, Webmin main page will show you the summary of your server:

Hope this will help you!

Please Remember me in your prayers!

Change Ubuntu Server from DHCP to a Static IP Address

First, we will check the ip address of our ubuntu server, which is assigned by DHCP server:

Let’s open up the /etc/network/interfaces file.

sudo nano /etc/network/interfaces

primary interface, normally eth0, contains these lines:

Currently, we are using dhcp, in order to change it from dhcp to static, then modify and add these lines:

We also need to edit the DNS settings by editing the resolv.conf file:

sudo nano /etc/resolv.conf

Add the appropriate server address after “name server

At the end, restart the networking components:

sudo /etc/init.d/networking restart

Check the new assigned ip address using ifconfig command:

Ping If you get a response, name resolution is working:

Hope this will help you!

Please Remember me in your prayers!

How to install Java 6 on Ubuntu 12.04

First, we will check that java is already install or not on our system:

java -version

As, we can see that the java is not install on our system, so we will downloads the Java binary installer from Oracle. (In this example, we will download & install the jre, but the procedure is exactly the same for jdk).

Transfer the downloaded file (jre-6u31***) to the Ubuntu from Windows machine using WinSCP.

Now, move to the directory where you copy the jre file(in my case, it is in tmp directory)

cd /tmp/

Give execute permission to jre file.

sudo chmod +x jre-6u31-linux-x64.bin

Run the jre file.

sudo ./jre-6u31-linux-x64.bin

After execution, it makes a new directory in the same location where jre file reside.

Move this newly created directory to /usr/lib/jvm/

sudo mv jre1.6.0_31 /usr/lib/jvm/

Enter this command:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_31/bin/java" 1

We are done!

Check the installed version of java.

java -version

Confirmation (Optional 🙂 ):

Here is a confirmation that we successfully installed the java on Ubuntu 12.04.

Hope this will help you!

Please Remember me in your prayers!

%d bloggers like this: