venerdì 9 maggio 2014

Determine the process pid listening on a certain port

The -p flag of netstat gives you PID of the process:
 
 
netstat -l -p

View Redhat version

Piece of cake:
cat /etc/redhat-release

For kernel version
and uname -a 

martedì 15 aprile 2014

Ubuntu Update old Repositories

Find Ubuntu version:
  1. In a terminal execute:
    lsb_release -dc
  2.  The output will be something like this:
    Description: Ubuntu 9.10
    Codename: karmic

    Open file /etc/apt/sources.list with a text editor. 

    Delete all entries and substitute with the following:


    deb http://old-releases.ubuntu.com/ubuntu/ CODENAME main universe restricted multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ CODENAME main universe restricted multiverse
    
    deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-security main universe restricted multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ CODENAME-security main universe restricted multiverse
    
    deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-updates main universe restricted multiverse
    deb-src http://old-releases.ubuntu.com/ubuntu/ CODENAME-updates main universe restricted multiverse

    Extra Repository
     
    Backports: 
deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-backports main restricted universe multiverse deb-src http://old-releases.ubuntu.com/ubuntu/ CODENAME-backports main restricted universe multiverse 
 

Proposed:
deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ CODENAME-proposed main restricted universe multiverse  
 
 Replace the worh CODENAME with the codename found in point 2  
 

giovedì 10 aprile 2014

Redhat CentOS Fedora Yum commands

If during update you get a dependences error then launch:

yum clean all
yum --disablerepo='*' --enablerepo=base,updates update

sabato 5 aprile 2014

Change Windows 7 Bootloader Timeout


By default, Windows 7 (at least Ultimate) has a 30 second bootloader timer which seems a bit overkill to me. Fortunately there is an easy way to edit this, along with other bootloader settings. Open up an admin command window by going to Start -> All Programs -> Accessories -> Command Prompt. Right click on the shortcut and select Run As Administrator. Now, the utility we want to use is called bcdedit, and you can invoke it with simply a bcdedit /? to see all of it's usages. To change the bootloader timeout to 10 seconds, use the following:


> bcdedit /timeout 10

giovedì 27 marzo 2014

CentOS - Redhat VNC server config

VNC configuration insert ip address in /etc/hosts
service vncserver strat stop status
Install the VNC Server.

    # yum install tigervnc-server

Edit the "/etc/sysconfig/vncservers" file to configure the required displays. The following entries enable VNC for display numbers ":2" and ":3". Notice multiple "display:user" pairs are defined on a single line, but the arguments for each display are defined separately.

    VNCSERVERS="2:root 3:oracle"
    VNCSERVERARGS[2]="-geometry 1280x1024 -nolisten tcp -localhost"
    VNCSERVERARGS[3]="-geometry 1280x1024"

Set the VNC password for any users defined in the "/etc/sysconfig/vncservers" file.

    # vncpasswd
    Password:
    Verify:
    #

    # su - oracle
    $ vncpasswd
    Password:
    Verify:
    $ exit
    logout
    #

Enable the "vncserver" service for autostart and start the service.

    # chkconfig vncserver on
    # service vncserver start

to connect ipaddress:displayport

mercoledì 12 marzo 2014

CentOS configuring NTP

2.2.2. Network Time Protocol Setup

As opposed to the manual setup described above, you can also synchronize the system clock with a remote server over the Network Time Protocol (NTP). For the one-time synchronization only, use the ntpdate command:
  1. Firstly, check whether the selected NTP server is accessible:
    ~]# ntpdate -q server_address
    For example:
    ~]# ntpdate -q 0.rhel.pool.ntp.org
  2. When you find a satisfactory server, run the ntpdate command followed by one or more server addresses:
    ~]# ntpdate server_address...
    For instance:
    ~]# ntpdate 0.rhel.pool.ntp.org 1.rhel.pool.ntp.org
    Unless an error message is displayed, the system time should now be set. You can check the current by setting typing date without any additional arguments as shown in Section 2.2.1, “Date and Time Setup”.
  3. In most cases, these steps are sufficient. Only if you really need one or more system services to always use the correct time, enable running the ntpdate at boot time:
    ~]# chkconfig ntpdate on
    For more information about system services and their setup, see Chapter 11, Services and Daemons.
    Note
    If the synchronization with the time server at boot time keeps failing, i.e., you find a relevant error message in the /var/log/boot.log system log, try to add the following line to /etc/sysconfig/network:
    NETWORKWAIT=1
However, the more convenient way is to set the ntpd daemon to synchronize the time at boot time automatically:
  1. Open the NTP configuration file /etc/ntp.conf in a text editor such as vi or nano, or create a new one if it does not already exist:
    ~]# nano /etc/ntp.conf
  2. Now add or edit the list of public NTP servers. If you are using Red Hat Enterprise Linux 6, the file should already contain the following lines, but feel free to change or expand these according to your needs:
    server 0.rhel.pool.ntp.org iburst
    server 1.rhel.pool.ntp.org iburst
    server 2.rhel.pool.ntp.org iburst
    server 3.rhel.pool.ntp.org iburst
    
    The iburst directive at the end of each line is to speed up the initial synchronization. As of Red Hat Enterprise Linux 6.5 it is added by default. If upgrading from a previous minor release, and your /etc/ntp.conf file has been modified, then the upgrade to Red Hat Enterprise Linux 6.5 will create a new file /etc/ntp.conf.rpmnew and will not alter the existing /etc/ntp.conf file.
  3. Once you have the list of servers complete, in the same file, set the proper permissions, giving the unrestricted access to localhost only:
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict -6 ::1
  4. Save all changes, exit the editor, and restart the NTP daemon:
    ~]# service ntpd restart
  5. Make sure that ntpd is started at boot time:
    ~]# chkconfig ntpd on