Friday, August 5, 2016

Installation of Icinga Server for monitoring on RHEL7

Icinga is a modern open source monitoring tool that originated from a Nagios itself. The ICINGA tool is not much different from Nagios as they use the similar plugins as the Nagios uses but the major differences could be seen in Web UI and interface.

We will be going through entire deployment and installation process of Icinga Monitoring Tool  for RHEL 7, using repoforge(Earlier known as RPMforge), EPEL & Icigna  repositories for Apache and Nagios plugins which needs to be installed in the system.


1. Before proceeding with Icinga installation we need to configure RepoForge & ICINGA repositories on the sever by using below command

# rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

And also the ICINGA repositories:


# rpm --import http://packages.icinga.org/icinga.key
# curl -o /etc/yum.repos.d/ICINGA-release.repo http://packages.icinga.org/epel/ICINGA-release.repo
# yum makecache


2. The next step is to try to install Icinga web interface provided by icinga-gui package. Earlier CentOS/RHEL 7 has some issues with the package, but its fixed in latest version of CentOS/RHEL releases

# yum install icinga-gui

3. After RepoForge & icinga repositories had been added on your system, start with Icinga deployment

# yum install icinga icinga-doc

4. Install Apache development packages:

# yum install httpd-devel

4. As presented on this article introduction, your system needs to have Apache HTTP server and PHP installed in order to be able to run Icinga Web Interface.
After you finished the above steps, a new configuration file should be now present on Apache conf.d path named icinga.conf. In order to be able to access Icinga from a remote location from browser, open this configuration file and replace all its content with the following configurations.

# vim /etc/httpd/conf.d/icinga.conf

Make sure you replace all file content with the following.

ScriptAlias /icinga/cgi-bin "/usr/lib64/icinga/cgi"
<Directory "/usr/lib64/icinga/cgi">
#  SSLRequireSSL
Options ExecCGI
AllowOverride None
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/passwd
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
# Require local
Require valid-user
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
Require valid-user
</IfModule>
</Directory>
Alias /icinga "/usr/share/icinga/"
<Directory "/usr/share/icinga/">
#  SSLRequireSSL
Options None
AllowOverride All
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/passwd
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAll>
Require all granted
# Require local
Require valid-user
</RequireAll>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
Require valid-user
</IfModule>
</Directory>



5. After you have edited Icinga httpd configuration file, add Apache system user to Icinga system group and use the following system permissions on next system paths.

# usermod -aG icinga apache
# chown -R icinga:icinga /var/spool/icinga/*
# chgrp -R icinga /etc/icinga/*
# chgrp -R icinga /usr/lib64/icinga/*
# chgrp -R icinga /usr/share/icinga/*

6. Before starting Icinga system process and Apache server, make sure you also disable SELinux security mechanism by running 'setenforce 0' command and make the changes permanent by editing /etc/selinux/config file, changing SELINUX context from enforcing to disabled.

# nano /etc/selinux/config


Modify SELINUX directive to look like this.

SELINUX=disabled

You can also use 'getenforce' command to view SELinux status.
7. As the last step before starting Icinga process and web interface, as a security measure you can now modify Icinga Admin password by running the following command, and then start both processes.

# htpasswd -cm /etc/icinga/passwd icingaadmin (Type your preferred password)
# systemctl start icinga
# systemctl start httpd

8. In order to start monitoring public external services on hosts with Icinga, such as HTTP, IMAP, POP3, SSH, DNS, ICMP ping and many others services accessible from internet or LAN you need to install Nagios Plugins package provided by EPEL Repositories.

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
# yum install nagios-plugins nagios-plugins-all

9. To login on Icinga Web Interface, open a browser and point it to the URL http://Amazon_EC2_hostname/icinga/. Use icingaadmin as username and the password you chose earlier and you can now see your localhost system status.

That is the process of installing and configuring Icinga server on Red Hat enterprise linux 7.


Checkout below video for more practical representation:

 

Monday, May 23, 2016

How to work with Ansible (Automation tool) on CentOS 7


Ansible is free tool to automation tool for Linux hosts. Its useful for the environment where you have lots of linux hosts/servers to manage and maintain. Lets get started with it,

I have tested the below mentioned steps on CentOS 7:

First of all, we are going to need epel on CentOS to install ansible:



[root@vm2 ~]# uname -r
3.10.0-123.el7.x86_64


[root@vm2 ~]# cat /etc/redhat-release

CentOS Linux release 7.0.1406 (Core)


[root@vm2 ~]# yum install epel-release

Now after installing epel, lets install ansible:

[root@vm2 ~]# yum install ansible

After installation is done, test it out:

[root@vm2 ~]# ansible --version

ansible 2.0.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

Now, ansible works on ssh keys. So just generate one if you don't have it.

[root@vm2 ~]# ssh-keygen
<You can have a secure password, or just keep it blank also should work>

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

 Now Copy the ssh key to remote hosts:

[root@vm2 ~]# ssh-copy-id 192.168.0.81

[root@vm2 ~]# ssh-copy-id 192.168.1.222

Now Add your hosts/servers in the below mentioned ansible file:

[root@vm2 ~]# vim /etc/ansible/hosts

[servers]
192.168.0.81
192.168.1.222

Now, Save & Exit.

Its time to test ansible with ping module:

[root@vm2 ~]#  ansible -m ping 'servers'
192.168.0.81 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.1.222 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Looks good.

Lets try some other command:

[root@vm2 ~]# ansible -m command -a 'rpm -qa kernel' 'servers'
192.168.0.81 | SUCCESS | rc=0 >>
kernel-3.10.0-327.18.2.el7.x86_64
kernel-3.10.0-327.10.1.el7.x86_64
kernel-3.10.0-327.el7.x86_64
kernel-3.10.0-327.13.1.el7.x86_64

192.168.1.222 | SUCCESS | rc=0 >>
kernel-2.6.32-504.el6.x86_64
kernel-2.6.32-573.7.1.el6.x86_64

Yeah, So Now you are able to fetch these information in single command.


[root@vm2 ~]# ansible -m command -a 'grep CPU /proc/cpuinfo' 'test-servers'
192.168.0.81 | SUCCESS | rc=0 >>
model name    : Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz

192.168.1.222 | SUCCESS | rc=0 >>
model name    : Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz
model name    : Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz



[root@vm2 ~]# ansible -m command -a 'free -m' 'test-servers'
192.168.1.222 | SUCCESS | rc=0 >>
             total       used       free     shared    buffers     cached
Mem:          7693       5845       1847        187          7        449
-/+ buffers/cache:       5388       2304
Swap:         7999        684       7315

192.168.0.81 | SUCCESS | rc=0 >>
              total        used        free      shared  buff/cache   available
Mem:          11726        6426         390         393        4909        4568
Swap:         16383         130       16253



[root@vm2 ~]# ansible -m command -a 'fdisk -l /dev/sda' 'test-servers'
192.168.0.81 | SUCCESS | rc=0 >>

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000f988

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1230847      614400   83  Linux
/dev/sda2         1230848   525518847   262144000   83  Linux
/dev/sda3       525518848   559073279    16777216   82  Linux swap / Solaris
/dev/sda4       559073280   976773167   208849944    5  Extended
/dev/sda5       559075328   976773167   208848920   83  Linux

192.168.1.222 | SUCCESS | rc=0 >>

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa34fa34f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      256000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32        7681    61440000   83  Linux
/dev/sda3            7681        8701     8192000   82  Linux swap / Solaris
/dev/sda4            8701       60802   418497560    5  Extended
/dev/sda5            8701       60802   418496512   83  Linux


Awesome. You can Also Create/Delete user accounts:

[root@vm2 ~]# ansible -m command -a "useradd spiderman" 'test-servers'
192.168.1.222 | SUCCESS | rc=0 >>


192.168.0.81 | SUCCESS | rc=0 >>




[root@vm2 ~]# ansible -m command -a "grep spiderman /etc/passwd " 'test-servers'
192.168.0.81 | SUCCESS | rc=0 >>
spiderman:x:1002:1002::/home/spiderman:/bin/bash

192.168.1.222 | SUCCESS | rc=0 >>
spiderman:x:505:506::/home/spiderman:/bin/bash



[root@vm2 ~]# ansible -m command -a "userdel -r spiderman" 'test-servers'
192.168.0.81 | SUCCESS | rc=0 >>


192.168.1.222 | SUCCESS | rc=0 >>




Hope this helped you.

Thanks ^_^








Tuesday, November 3, 2015

How to configure Ubuntu 12.04 with Gmail SMTP

For this we need Ubuntu 12.04 LTS installed in your physical or virtual system. 

Lets get started with this,

We need to install required packages for the same,

sudo apt-get install mailutils postfix libsasl2-2 ca-certificates libsasl2-modules

When you install postfix for the first time, system will ask you for the smtp domain name and smtp type. Select "Internet Site" and "smtp.yourdomain.com" where ever applicable. (Where 'yourdomain.com' is your working domain name)

Now lets start configuring SMTP in postfix.

sudo vim /etc/postfix/main.cf

(Edit configuration file, so that it looks like this..)

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

(Save & Exit)

Now your google user name and password goes in this file:

vim /etc/postfix/sasl_passwd

(Edit as below)

[smtp.gmail.com]:587    <GMAILUSERNAME>:<GMAILPASSWD>

(Save & Exit)

Lets make sure postfix can read this file and not everyone else:

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

Lets use the certificate for the authentication:

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

and finally lets restart the postfix service:

/etc/init.d/postfix reload

Now let's test our configuration if its working or not:

echo "Test email from Postfix" | mail -s "Test Postfix" USERNAME@gmail.com

Verify is the mail is sent:

tail -f /var/log/mail.log

If required we can also add your gmail account in aliases:

vim /etc/aliases

root: GMAILADDRESS@gmail.com

(save & exit)

newaliases

Thanks for the visit
:)









Monday, August 10, 2015

Working with apt-get and dpkg package manager tools of 'Debian'



First of all we are going to work with Apt-get package manager. For those who are already familiar with Yum of Red Hat based distros may find this quite identical tool. Apt-get pulls and installs packages from the online repository to ease your pain to find, download and install packages and its dependency manually.

You have to be root using for the following hands-on, Let's get started:

root@yogeshkk21:~# apt-get update

This command pulls package information from repository server and caches the same locally

root@yogeshkk21:~# apt-cache search nginx

We can search for a specific package in the entire cache using this command


root@yogeshkk21:~# apt-get install nginx

This command is to install a package

root@yogeshkk21:~# which nginx

To verify nginx is installed

root@yogeshkk21:~# apt-cache search apache2

Let's search for Apache2 package as well

root@yogeshkk21:~# apt-get install apache2

And Install it same as nginx

root@yogeshkk21:~# apt-get remove ngnix

Now, let's learn How to remove it

root@yogeshkk21:~# apt-get remove --purge nginx

apt-get remove only removes the binary, but keeps associated library and configuration files. So to remove everything, use purge.

root@yogeshkk21:~# apt-get autoremove

This command removes unnecessary packages alongside the removed package

root@yogeshkk21:~# which ngnix

Let's verify

root@yogeshkk21:~# apt-get remove apache2 ; apt-get autoremove apache2

This removed apache2 package along with unnecessary packages of it

root@yogeshkk21:~# which apache2

Let's verify again

root@yogeshkk21:~# apt-get install apache2

Let us install apache2 package again

root@yogeshkk21:~# apt-get upgrade

This command allows you to upgrade any packages required for apache2

root@yogeshkk21:~# apt-get dist-upgrade

This command allows you to upgrade distribution kernel if available

Now if we talk about dpkg package manager, it's the little bit different from the apt-get. This does not pull the dependencies automatically like apt-get does. Let's see:

root@yogeshkk21:~# wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2015.02.12_amd64.deb

Let's try to install Dropbox application on our Ubuntu 12.04 distro.

root@yogeshkk21:~# mv download\?dl\=packages%2Fubuntu%2Fdropbox_2015.02.12_amd64.deb dropbox.deb

Let's rename this downloaded file to something more simple.

root@yogeshkk21:~# dpkg -i dropbox.deb

To install the Deb file, use -i option. Now you will see that lots of dependency errors are been thrown at you. Its simply because, dpkg can't pull all those dependency for you. So, what now? Should I download and install them manually? No, there is a way out.

root@yogeshkk21:~# apt-get update

Let's update our cache once again

root@yogeshkk21:~# apt-get -f upgrade

And this command will do the job for us. It automatically pulls all the required library packages along with other dependencies. Nice, right?

root@yogeshkk21:~# dpkg -i dropbox.deb

Now, let's try that deb file again for installation. And you will notice, it gets installed! :)

root@yogeshkk21:~# which dropbox

Let's verify! Worked well.

root@yogeshkk21:~# dpkg --get-selections

Now let's also find out, how can we list all installed packages. This command will do the magic for us.

root@yogeshkk21:~# dpkg --get-selections  |grep -i dropbox

We can find specific package name from the output using grep.

root@yogeshkk21:~# dpkg --remove dropbox

Just like apt-get we have remove command as well in dpkg and it removes all binary for us.

root@yogeshkk21:~# dpkg --purge dropbox

To remove the application completely, using this command.

So that's how we can use apt-get and dpkg.

HTH ^_^

Above command is tested and worked on:

root@yogeshkk21:~# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:    precise


Tuesday, September 9, 2014

How to configure LAMP and Wordpress 4.0 on CentOS 7.0

How to configure LAMP and Wordpress 4.0 on CentOS 7.0 



Lets get started, shall we ;)

Check your IP address:
ip addr

Check available Repos:
yum repolist

If you want to save time, downloading at least 'base' packages, configure local 'base'repo.

First install FTP daemon,
yum -y install vsftpd ftp

Loop mount your DVD ISO to copy packages,

mount -o loop,ro /home/yogesh/Downloads/CentOS7.iso /mnt

To check run,
mount  

Now, create folder,
mkdir -p /var/ftp/pub/Centos7

And copy cd contains to your newly created folder,
rsync -av -P /mnt/* /var/ftp/pub/Centos7/.
restorecon -RFvv /var/ftp/pub/Centos7*

Install createrepo package if not installed,
yum -y install createrepo

Execute createrepo,
createrepo -v /var/ftp/pub/Centos7

Start FTP daemon, and open ftp ports in local host.
systemctl start vsftpd
systemctl enable vsftpd
firewall-cmd --permanent --add-service=vsftp
firewall-cmd --permanent --add-service=ftp


Change default repo,
cd /etc/yum.repos.d/
vim CentOS-Base.repo   <Add following line in 'base' section,
enabled=0

Create local repo,
vim local-base.repo
[localbase]
name=CentOS 7 Local Repo
baseurl=ftp://192.168.1.253/pub/Centos7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


Lets also install EPEL repo for CentOS 7,
yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
yum clean all ; yum repolist

Now Let is install LAMP packages. System will not download 'Base' packages present in your DVD.  because of local-repo.

First we will install & configure apache,
yum -y install httpd
systemctl start httpd
systemctl enable httpd
firewall-cmd --permanent --add-service=http
systemctl restart firewalld

We will test with web page later,

Now lets install mariadb database,
yum -y install mariadb-server mariadb
systemctl start mariadb 
systemctl enable mariadb 
mysql_secure_installation 

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] Y

 ... Success!

Disallow root login remotely? [Y/n] 
 ... Success!

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

After mariadb, we will install php.

yum -y install php php-mysql php-gd php-pear
vim /var/www/html/testphp.php

<?php
phpinfo();
?>

You can install GUI Web based php admin console called 'phpmyadmin',

yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpMyAdmin.conf 

Comment and add following lines:

#<Directory /usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     <RequireAny>
#       Require ip 127.0.0.1
#       Require ip ::1
#     </RequireAny>
#   </IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from 127.0.0.1
#     Allow from ::1
#   </IfModule>
#</Directory>

<Directory /usr/share/phpMyAdmin/>
        Options none
        AllowOverride Limit
        Require all granted
</Directory>

Now open following file:

vim /etc/phpMyAdmin/config.inc.php 

<And  replace 'cookie' with 'http' in following line>

$cfg['Servers'][$i]['auth_type']     = 'http';    // Authentication method (config, http or cookie based)?

Now restart httpd daemon,
systemctl restart httpd

Now your are ready with LAMP server!! :D



Lets see how do we install Wordpress 4.0 (Latest) in the same,

Lets first add hostname in following hosts file,
vim /etc/hosts
192.168.1.25    centos7.localdomain   centos7   <Change as per your hostname and IP>

Download latest package file from wordpress,
wget http://WordPress.org/latest.zip

Unzip and copy over to http root,
unzip latest.zip 
cp -R wordpress/. /var/www/html/

Also make sure you have taken care of Selinux context(If you are using selinux in enforcing mode)

getsebool -a |grep home
setsebool -P httpd_enable_homedirs on
restorecon -RFvvv /var/www/html/*

Now lets setup mariadb for wordpress database,

mysql -u root -p

Enter password: 
MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL ON wpdb.* TO wpuser@localhost IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

Next we have to get a sample file to configure wordpress. This sample file is already shipped in package. Simply copy it and change values in it,

cd /var/www/html/
cp wp-config-sample.php wp-config.php
vim wp-config.php 

define('DB_NAME', 'wpdb');                    <Wordpress database name>

/** MySQL database username */
define('DB_USER', 'wpuser');                  <Wordpress user name>

/** MySQL database password */
define('DB_PASSWORD', 'centos');        <Wordpress user password>

Rest just keep default values.

Now, you are ready with Word press. Open your system URL in browser, in my case its, http://192.168.1.253

Word press will ask you for basic inputs like Site Title, Username, password, email address, etc. After providing those you can open and start using your wordpress! 

:)

Happy Wordpressing!!! 


Monday, July 28, 2014

How to configure VNC server in Ubuntu 12.04

Install Gnome basic desktop.

sudo apt-get install gnome-core
 
when prompted type Y and then press Enter. This will install the gnome desktop components.
Reboot
 
sudo reboot now -h

To keep the desktop and login window from opening in Ubuntu everytime it starts we want to mask out the few lines which start the service.
 
sudo vim /etc/init/gdm.conf

The first few lines of the script should look like this once you've edited it:
 
# gdm - GNOME Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services

description "GNOME Display Manager"
author "William Jon McCann <mccann@jhu.edu>"

#start on ((filesystem
# and runlevel [!06]
# and started dbus
# and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
# or stopped udev-fallback-graphics))
# or runlevel PREVLEVEL=S)

stop on runlevel [016]

emits login-session-start

esc :wq to save the changes or :q! to start over. Now the desktop and login won't start in Ubuntu.

NOTE: This only installs a basic desktop, if you want to be able to use programs from your virtual desktop, network manager, media players, office, etc, they will need to be installed after vnc server is installed.

Reboot
 
sudo reboot now -h

We need to install VNC server to be able to interact with the gnome components for the desktop.
 
sudo apt-get install vnc4server

When prompted type Y and press Enter. This will install VNC Server which is required for running a virtual desktop on another machine.

Next type:
 
vncserver

You'll then be prompted to create and verify a new password.
We now need to kill the session we just created and make change the startup script for VNCServer to make it work properly.

So, type the following command to kill the session:
 
vncserver -kill :1

Now type the following command to open up the file we need to edit:
 
sudo vim .vnc/xstartup

Change it to look like this:
 
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &

 When you're done editing the file press the Esc key once and type :wq
This should save the changes and bring you back to the command line. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

Next type the following command to create the VNC Session once more:
 
vncserver -geometry 1366x750

Now you can access the ubuntu box using:

ubuntubox.example.com:1

Cheers

Thursday, July 24, 2014

How to change Local Time zone and configure NTP



If you want to set time yourself try the following command:

date 07241503

where 07 is month, 24 is date, 15 is hour and 03 is minute.

Or if you want to use NTP server, use the following command to synchronize:

ntpdate  0.centos.pool.ntp.org

If ntp server is taking wrong time because of wrong time zone, then you can easily check timezone.

service ntpd stop

cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime 


ntpdate  0.centos.pool.ntp.org


service ntpd start

chkconfig ntpd on

:)


Thanks,
(The above is tested on CentOS 6.5 - Suitable for CentOS 5,6,6.x and RHEL5,6,6.x)