Vmware tools autoinstall after kickstart

kickstart postinstall, you can read how to do this on the internet.

wget http://foo/tools.tar.gz

tar xzvf *.tar.gz

cd directory-where-you-untarred

vmware-tools-install.pl -d

BINGO !
Giggidi Giggidi

Windows command line power control

While this is a Linux forum this came in REALLY handy so what the heck 🙂

Frustratingly hidden away, windows command for putting the machine into Hibernate and / or standby are hidden away in the api under the powrprof.dll library.

 

Shutdown %windir%\System32\shutdown.exe -s

Reboot %windir%\System32\shutdown.exe -r

Logoff %windir%\System32\shutdown.exe -l

Standby %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby

Hibernate %windir%\System32\shutdown.exe -h     OR

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate

 

Also if you Windows 7 wakes up and you don’t know why check:

powercfg lastwake

Hope this helps.

Linux check all ips in a subnet with ping

Let’s say you have a subnet 192.168.1.0 / 24 and you want to scan all ip’s to see if any hosts are up:

Type the following command, enter:

 

$ for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo “192.168.1.$ip UP” || : ; done

Output:

192.168.1.65 UP
192.168.1.66 UP
192.168.1.70 UP
192.168.1.76 UP
192.168.1.253 UP
192.168.1.254 UP

Permanently set hostname in Ubuntu

Debian based systems use the file /etc/hostname to read the hostname of the computer at boot time and set it up using the init script /etc/init.d/hostname.sh

One can edit the file /etc/hostname and change the hostname and then run:

/etc/init.d/hostname.sh start

Update /etc/hosts ip 127.0.0.1 respectively ( leave the localhost entry untouched)

Steps:

  1. sudo vi  /etc/hostname
  2. Save the file with the hostname you like to set
  3. sudo /etc/init.d/hostname.sh start
  4. sudo vi /etc/hostname
  5. Save file with 127.0.0.1 entry updated
  6. Test using hostname -f
  7. Log off using exit

Ref: http://sysblogd.com/50/change-hostname-permanently-on-debian-or-ubuntu.htm

Installing SNMP on Centos 6.x

Installing SNMP daemon and tools:

As root

yum -y install net-snmp.i686

yum -y install net-snmp-utils

Once these are installed start the snmp daemon:

/etc/init.d/snmpd start

chkconfig snmpd on

 

This is just the basic install but testing it :

snmpwalk -v 1 -c public -O e 127.0.0.1

For production servers it is advisable to at least change the community name.

All configs are in

/etc/snmp/snmpd.conf

and traps are setup here:

/etc/snmp/snmptrapd.conf

No traps are set by default.

Enjoy !!

Missing Perl module with phptop how to fix.

While trying to run phptop after unzipping it I get the following error:

[root@torino phptop-0.5.3]# ./phptop 
Can't locate Term/Size.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at ./phptop line 24.
BEGIN failed--compilation aborted at ./phptop line 24.
[root@torino phptop-0.5.3]#

 

To fix it I had to follow the coming steps:

[root@torino phptop-0.5.3]# yum install cpan
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: it.centos.contactlab.it
 * epel: mirror.karneval.cz
 * extras: it.centos.contactlab.it
 * updates: mirror.bofh.so
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-CPAN.i686 0:1.9402-127.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package Arch Version Repository Size
================================================================================
Installing:
 perl-CPAN i686 1.9402-127.el6 base 244 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 244 k
Installed size: 663 k
Is this ok [y/N]: y
Downloading Packages:
perl-CPAN-1.9402-127.el6.i686.rpm | 244 kB 00:00 
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing : perl-CPAN-1.9402-127.el6.i686 1/1 
 Verifying : perl-CPAN-1.9402-127.el6.i686 1/1
Installed:
 perl-CPAN.i686 0:1.9402-127.el6
Complete!
[root@torino phptop-0.5.3]#

Then run cpan

[root@torino phptop-0.5.3]#cpan

And you will be asked  whether to accept default answers just press <ENTER>/

Lots of test later you are presented with the cpan prompt tyoe install Term::Size as follows:

  • ommit: wrote '/usr/share/perl5/CPAN/Config.pm'
    Terminal does not support AddHistory.
    cpan shell -- CPAN exploration and modules installation (v1.9402)
    Enter 'h' for help.
    cpan[1]> install Term::Size

After a long verbose build process assuming all went well ( you need internet connectivity to perform this step) type quit at the prompt as so:

cpan[2]> quit

This returns you to the shell prompt:

[root@torino phptop-0.5.3]# ./phptop 
No phptop records found.
[root@torino phptop-0.5.3]#

Voila !!! the program is working.The error is due to the lack of page reads as yet but the program compiled (JIT) and ran.

 

 

 

Installing EPEL Repository on CentOS

EPEL stands for Extra Packages for Enterprise Linux. This is a massive collection of packages that are very useful for the building of many modern stacks and include many tools for the running and maintenance of systems.

The homepage of EPEL is here: http://fedoraproject.org/wiki/EPEL.

You can browse the package set using repoview:

Installing on Centos 5.x & 6.x:

For EL5:

su -c 'rpm -Uvh http://mirror.switch.ch/ftp/mirror/epel/5/i386/epel-release-5-4.noarch.rpm'
...
su -c 'yum install puppet'

For EL6:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'
...
su -c 'yum install puppet'

For EL7

sudo yum install epel-release

Setting hostname

#vim /etc/sysconfig/network

Use something like

HOSTNAME=testarossa.maranello.local

to overwrite the default name and domain of the server.

e.g.

NETWORKING=yes
HOSTNAME=testarossa.maranello.local

To avoid rebooting issue the following :

hostname  testarossa.maranello.local

That will set it for the current  session.

 

 

 

Monitoring connections

To monitor TCP and UDP connections the following command is very useful:

netstat -t -u

to have a continuous update use the watch command:

watch netstat -t -u

There is a much stronger tool for real time analysis called iptraf.

It is quite self explanatory :

at command line run

iptraf

This tool has many functions and is text mode menu ncurses based application really worth learning.