Colorful output in linux console

pink color

echo -e "\033[35m hellow world"

light blue 36m


so increase the numbers and test different colors 30 - 37


Set background color

use same format with numbers  40 - 47

Read more .....Click here !!

How to Configure Local Apt-Cacher-Server for Intranet -- Raja Arulappagari

Server Installation:

1. Install apt-cacher and apache2 webserver

#apt-get install apt-cacher apache2

2.Enable apt-cacher

Edit /etc/default/apt-cacher and change autostart to 1. (This will automatically start
cache server).

#vi /etc/default/apt-cacher

autostart=1

3.Restart the apache server

#/etc/init.d/apache2 restart

4.Restart the apt-cacher server

#/etc/init.d/apt-cacher restart

Now test your apt-cacher server.Go to remote machine in your network.open your
browser type the hostname or IP address of your apt-cacher
server.

#firefox http:///apt-cacher  [ hostname / ip ]

 
sometimes it won't work. Then try


#firefox http://hostname/ip :3142";


save and quit
 

[OR]

Create a small script.


#vi check-apt-cacher.sh
---------------------------------------------------------------------------------------------------
 

. /lib/lsb/init-functions
log_daemon_msg "Configuring APT cache proxy" "(based on SERVER_NAME_HERE's
presence...)"
ping -c 1 SERVER_NAME_HERE &> /dev/null
if [ $? = "0" ]; then
echo "Acquire::http::Proxy \"http://SERVER_NAME_HERE:3142\";" > /etc/apt/
apt.conf.d/01SERVER_NAME_HEREproxy
else
rm /etc/apt/apt.conf.d/01SERVER_NAME_HEREproxy &> /dev/null
fi
log_end_msg 0

---------------------------------------------------------------------------------------------------
 

(Note: Replace SERVER_NAME_HERE with the ipaddress of apt-cacher server).
save and quit
#chmod +x /root/check-apt-cacher
#crontab -e
*/1 * * * * /bin/bash /root/check-apt-cacher
save and quit
This script will run each minute (*/1) you can change it as you see fit.
You're done.
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
How It Works?

 
In each and every client machine in our network, we are going to mention the apt-
cacher server as a proxy server in the /etc/apt/apt.conf.d/ directory. So in our network,
If anyone Downloads packages using apt-get command. First, it checks in the cache
folder of apt-cacher server i.e.., /var/cache/apt-cacher/packages. If it doesn't find any
packages, it downloads from the internet and keeps in its cache folder and as well as
installs on the client machines(regardless of what version of ubuntu they are using). So
that if any other people tries to install the same package,they can directly install it from
the cache instead of hitting internet all the time,which saves bandwidth.
---------------------------------------------------------------------------------------------------
(Note : I have installed apt-cacher server on ubuntu 9.04 and i tried to access from
client side which is of ubuntu 9.04 and ubuntu 10.04. i installed few packages on the
client side, which client and as well as server doesn't have. The new package is fetched
form the internet and is kept in the apt-cacher cache directory.)

KVM Vs Vmware what to choose ?

I choose KVM

1) Cost is high in vmware and kvm is free


2) Ease of Deployment : Ease of installation is same in
both kvm and vmware , both are very easy , but in vmware
need to add licensing etc.

3) Speed : Lot of only research's showd kvm based meachins are more responsive then vmware .

4) Vmware meachines can be managed via infrasturcture client or ssh , kvm can be managed from CLI client, command line, SSH or thorugh enomaly web interface

Working with OpenNebula CLI ( OpenNebula CLI is available only on front-end )

1) Adding a new Host to compute cluster

onehost create

Note that im_mad, vmm_mad, tm_mad in our case should be im_kvm, vmm_kvm and tm_nfs respectively as we have configured them in /etc/one/oned.conf

Also note that Information manager needs to collect resource availability ( CPU and Memory ) information for the host we have added. This requires:

• oneadmin user on front-end should be able to ssh to host without entering password ( test this using sudo -u oneadmin ssh oneadmin@ on front-end )
• Inorder for this to work copy the contents of /var/lib/one/.ssh/id_rsa.pub on front-end to /var/lib/one/.ssh/authorized_keys on host

Type onehost list to check the status:

Notice the value of STAT attribute. If the attribute has a value of 'on' then the host has been successfully added to compute cluster:

ID NAME RVM TCPU FCPU ACPU TMEM FMEM STAT
0 192.168.155.127 0 200 198 198 1800340 1341620 on


Look into /var/log/one/oned.log on front-end for debugging
Once a host has been successfully added use onehost disable/enable to toggle its status.


2) Submitting a new Virtual Machine job

In order to provision a Virtual Machine in the compute cluster we need to construct a template and submit it using

onevm create