Tuesday, January 8, 2019

How to setup NTP so clocks will be correct on OraLinux VMs without Timesync of VMTools

So my Weather proxy server "oralinux2" appeared to be broken, and I could get it fixed with a restart of the VM.

Then I checked the time with "date" command and found it was 4 hours off.

So it was working and sending my weather data to Wunderground, but it was always sending the current data with a timestamp that showed it was 4 hours old.  This results in Wunderground saying my station was offline.

(No new data in the last 5 minutes, based on the timestamp.)

To correct this in the past I manually ran a SYNC command like this:

ntpdate -s us.pool.ntp.org

This would set the time once....but in a few months the problem would happen again.

So I found this:

https://docs.oracle.com/cd/E37670_01/E41138/html/section_m5p_j1h_pp.html

13.1.1 Configuring the ntpd Service

To configure the ntpd service on a system:
  1. Install the ntp package.
    # yum install ntp
  2. Edit /etc/ntp.conf to set up the configuration for ntpd.
    Note
    The default configuration assumes that the system has network access to public NTP servers with which it can synchronise. The firewall rules for your internal networks might well prevent access to these servers but instead allow access to local NTP servers.
    The following example shows a sample NTP configuration for a system that can access three NTP servers:
    server NTP_server_1
    server NTP_server_2
    server NTP_server_3
    server  127.127.1.0
    fudge   127.127.1.0 stratum 10
    driftfile /var/lib/ntp/drift
    restrict default nomodify notrap nopeer noquery
    The server and fudge entries for 127.127.1.0 cause ntpd to use the local system clock if the remote NTP servers are not available. The restrict entry allows remote systems only to synchronise their time with the local NTP service.
    For more information about configuring ntpd, see http://doc.ntp.org/4.2.6p5/manyopt.html.
  3. Create the drift file.
    # touch /var/lib/ntp/drift
  4. If remote access to the local NTP service is required, configure the system firewall to allow access to the NTP service on UDP port 123, for example:
    # iptables -I INPUT -p udp -m udp --dport 123 -j ACCEPT
    # service iptables save
  5. Start the ntpd service and configure it to start following a system reboot.
    # service ntpd start
    # chkconfig ntpd on
You can use the ntpq and ntpstat commands to display information about the operation of ntpd, for example:
# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ns1.proserve.nl 193.67.79.202    2 u   21   64  377   31.420   10.742   3.689
-pomaz.hu        84.2.46.19       3 u   22   64  377   59.133   13.719   5.958
+server.104media 193.67.79.202    2 u   24   64  377   32.110   13.436   5.222
+public-timehost 193.11.166.20    2 u   28   64  377   57.214    9.304   6.311
# ntpstat
synchronised to NTP server (80.84.224.85) at stratum 3 
   time correct to within 76 ms
   polling server every 64 
For more information, see the ntpd(8), ntpd.conf(5), ntpq(8), and ntpstat(8) manual pages and http://doc.ntp.org/4.2.6p5/.

------------------------------------- Commands executed are: ----------------
  500  yum install ntp
  501  vi /etc/ntp.conf
  502  touch /var/lib/ntp/drift
  503  service ntpd start
  504  chkconfig ntpd on
  505  ntpq -p

--------------- npt.conf file contents -----------------Showing only the section changed --------------
 # For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1

# Hosts on local network are less restricted.
restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.2.17
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
fudge 192.168.2.17 stratum 10

#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
---------------- Many more lines are in the file....nothing else was changed ------------------------

--------------- Output of ntpq - p command --------------
[root@oralinux2 ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 pfsensesff0.loc 129.6.15.28      2 u   60   64  377    0.250  67693.0 33537.4
 time.nullrouten 216.218.254.202  2 u   60   64    7   58.114  67696.9 32387.5
 hadb2.smatwebde 209.51.161.238   2 u   62   64    7   22.521  67478.6 32173.0
 ellone.fdisk.io 128.59.0.245     2 u   60   64    7   21.988  67694.7 32266.3


That is all for now,
David

Friday, April 22, 2016

Install VMWARE Tools in Oracle Linux 6.6 using the command line

Installing VMware Tools in a Linux virtual machine using a Compiler (1018414)

Purpose

This article provides steps to install VMware Tools in a Linux guest operating system using Compiler.

Note: For an overview of installing VMware Tools, see Overview of VMware Tools (340).

Resolution



Note: If your Linux distribution is not RPM-based, has a custom kernel, or is unsupported, use the steps below to compile VMware Tools, otherwise, see Installing VMware Tools in a Linux virtual machine using RPM (1018392).

To install VMware Tools in a Linux guest operating system using Compiler:

  1. Ensure that your Linux virtual machine is powered on.
  2. If you are running a GUI interface, open a command shell.

    Note: Log in as a root user, or use the sudo command to complete each of these steps.
  3. Click VM in the virtual machine menu, then click Guest > Install/Upgrade VMware Tools.
  4. Click OK.

    Note: In some cases, verify that the CDROM device is Connected from within the Edit Settings option of the virtual machine.
  5. To create a mount point, run:

    mkdir /mnt/cdrom
  6. To mount the CDROM, run:

    mount /dev/cdrom /mnt/cdrom
  7. To copy the Compiler gzip tar file to a temporary local directory, run:

    cp /mnt/cdrom/VMwareTools-version.tar.gz /tmp/

    Where version is the VMware Tools package version.
  8. To determine the version of VMware tools, run:

    ls /mnt/cdrom

    You see output similar to:

    # VMwareTools-5.0.0-12124.tar.gz
  9. To change to the tmp directory and extract the contents of the tar file into a new directory called vmware-tools-distrib, run:

    cd /tmp
    tar -zxvf VMwareTools-version.tar.gz

  10. To change directory to vmware-tools-distrib and run the vmware-install.pl PERL script to install VMware Tools, run:

    cd vmware-tools-distrib
    ./vmware-install.pl


    Notes:
    • Complete the screen prompts to install the VMware Tools. Options in square brackets are default choices and can be selected by pressing Enter.
    • To compile VMware Tools successfully, you need gcc Compiler and Linux Kernel sources provided by your Linux distribution. Consult your Linux distribution documentation for details on methods to install these packages.
    • It is normal for the console screen to go blank for a short time during the installation when the display size changes.
    • Some warnings or errors are normal, like when a files does not exist.
    • Depending on the Linux distribution, your network service might restart after installation. VMware recommends that you invoke this command from the console and not remotely.
  11. If you are running a GUI interface, restart your X Window session for any mouse or graphics changes to take effect.
  12. To start VMware Tools running in the background during an X Window session, run:

    /usr/bin/vmware-toolbox &
  13. Depending on your environment, you may need to unmount the CD-ROM. To unmount the CD-ROM, run:

    umount /mnt/cdrom
  14. Depending on your environment, you may need to manually end the VMware Tools installation. To end the VMware Tools install, click VM in the virtual machine menu, then click Guest > End VMware Tools Install.
  15. To remove VMware Tools installation packages, run:

    cd
    rm /tmp/VMwareTools-version.tar.gz
    rm -rf /tmp/vmware-tools-distrib

Additional Information

For general VMware Tools installation information, see General VMware Tools installation instructions (1014294).

If you experience a symbolic link creation error during installation, see Unable to create the symbolic link when installing VMware Tools in Linux (2010580).

If you are running an unsupported distribution or using an unsupported kernel version and are not able to compile modules or install VMware Tools, VMware recommends that you explore the VMware community support forums. There are regular discussions on the forums about the latest development kernels and workarounds for building VMware Tools modules.

VMware tools can be uninstalled using the /usr/bin/vmware-uninstall-tools.pl script. For related information, see Installing VMware Tools in vSphere (2004754).

Note: VMware Tools no longer includes drivers for x Server 1.8 or higher. Ensure that these SVGA and mouse drivers are installed before installing VMware Tools:
  • xorg-x11-drv-vmware
  • xorg-x11-drv-vmmouse
If the drivers are not installed, VMware Tools installation will skip the x Windows configuration.


For translated versions of this article, see:

See Also

Update History

01/27/2012 - Added link, Unable to create symbolic link when installing VMware Tools in Linux 03/12/2012 - Added ESX/ESXi 4.1 and 5.0 to product list 12/06/2012 - Added new Step 7 03/19/2013 - Added note about installing SVGA and mouse drivers for x Windows to the additional information section 03/12/2015 - Added ESXi 5.1, 5.5, and 6.0

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

Friday, February 19, 2016

DHCP - RHEL linux Oracle Linux How to reset

I found this site has lots of good information on how to release and renew your IP address and default gateway.


http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/

Linux Force DHCP Client (dhclient) to Renew IP Address

I'm using Ubuntu Linux. How to force Linux to reacquire a new IP address from the DHCP server? What is the command in Linux equivalent to Windows' "ipconfig /renew" command?

You need to use Dynamic Host Configuration Protocol Client i.e. dhclient command. The client normally doesn't release the current lease as it is not required by the DHCP protocol. Some cable ISPs require their clients to notify the server if they wish to release an assigned IP address.
The dhclient command, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an address.

Linux renew ip command

The -r flag explicitly releases the current lease, and once the lease has been released, the client exits. For example, open terminal and type the command:
$ sudo dhclient -r
Now obtain fresh IP:
$ sudo dhclient

How can I renew or release an IP in Linux for eth0?

To renew or release an IP address for the eth0 interface, enter:
$ sudo dhclient -r eth0
$ sudo dhclient eth0

In this example, I am renewing an IP address for my wireless interface:
 
sudo dhclient -v -r eth0
sudo dhclient -v eth0
 
Sample outputs:
Fig.01: Renew DHCP address example
Fig.01: Renew DHCP address example

The -v option shows information on screen about dhcp server and obtained lease.

Other options in Linux to renew dhcp

There is no need to restart network service. Above command should work with any Linux distro such as RHEL, Fedora, CentOS, Ubuntu and others. On a related note you can also try out the following commands:
# ifdown eth0
# ifup eth0
### RHEL/CentOS/Fedora specific command ###
# /etc/init.d/network restart

OR
### Debian / Ubuntu Linux specific command ###
# /etc/init.d/networking restart

nmcli command (NetworkManager) to renew IP address in Linux

The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices command-line tool for controlling NetworkManager. The nmcli is a command-line tool for controlling NetworkManager and getting its status. To renew IP address using nmcli for connection named 'nixcraft_5G' (use 'nmcli con' command to get list of all connections):
 
nmcli con
nmcli con down id 'nixcraft_5G'
nmcli con up id 'nixcraft_5G'
 
Sample outputs:

Fig.02: nmcli command in action

Saturday, September 19, 2015

Oracle Linux and RHEL command history tips

14.8. Tips on Using Command History

What are some other ways I can use command history?
If you type history, a numbered list scrolls by very quickly, showing you the previous 500 commands you have used.
You probably do not need to see all of the last 500 commands, so the command history 20 might be useful. This way, only the previous 20 commands you typed are displayed (you can use any quantity as an argument of the history command).

14.8.1. Other Shortcuts

Here are other command history shortcuts which may be useful to you:
  • "Bang, bang": Typing !! (called "bang bang") executes the last command in the history.
  • "Bang number": Typing !number (as in !302) executes the command which is numbered 302 in the history file.
  • "Bang string": Typing !string (as in !rpm) executes a command with the most recent matching string from the history file.
  • [Up arrow] and [down arrow]: At the shell or GUI terminal prompt, you can press the up arrow to move back through previous commands in your history list (the down arrow moves you forward through the commands) until you find the command you want. Press [Enter] to execute the command, just as if you had typed it on the command line.

Friday, February 13, 2015

Can I add a DB Link to Oracle that connects to MS SQLSERVER?

Source : Oracle 11g on linux
destination : ms sql server 2005

i need to create the db link from oracle to ms sql server to view the tables , is it posibble without configuring the gateways( as looks like it is licenced product)

Please let me know any alternative to achive this

Thanks
PGR
kgronau
Correct Answerby kgronau on Nov 12, 2013 10:00 AM
There are 2 gateway - the commercial Database Gateway for Ms SQl Server which requires a license and the Database Gateway for ODBC which is for free. The license for DG4ODBC is included in your database license. You only need to install a suitable ODBC driver on your Linux box (for example use the MS SQl Server ODBC driver for Linux - details can be found here: http://www.microsoft.com/en-gb/download/details.aspx?id=36437 ). and then configure the gateway using the My Oracle Support Note:
How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install  [Article ID 561033.1]


- Klaus

Adding MS ODBC driver to Linux

http://www.microsoft.com/en-gb/download/details.aspx?id=36437

So you can add a link to a MS SQLSRVR from an Oracle running on Linux.


Microsoft® ODBC Driver 11 for SQL Server® - RedHat Linux

Language:
English
The Microsoft ODBC Driver For SQL Server provides native connectivity from Windows to Microsoft SQL Server and Windows Azure SQL Database.
  • Details
    Note:There are multiple files available for this download.Once you click on the "Download" button, you will be prompted to select the files you need.
    Version:
    11.0.2270.0
    File Name:
    RedHat6\msodbcsql-11.0.2270.0.tar.gz
    RedHat5\msodbcsql-11.0.2270.0.tar.gz
    RedHat5\msodbcsql-11.0.2270.0.tar.gz.sha256
    RedHat6\msodbcsql-11.0.2270.0.tar.gz.sha256
    Date Published:
    15/01/2013
    File Size:
    1.1 MB
    1.2 MB
    1 KB
    1 KB
      The Microsoft ODBC Driver 11 for SQL Server provides robust data access to Microsoft SQL Server. It allows native C and C++ applications to leverage the standard ODBC API and connect to Microsoft SQL Server 2008, 2008 R2, SQL Server 2012, SQL Server 2014 and Windows Azure SQL Database. Microsoft ODBC Driver 11 for SQL Server also comes with powerful tools - sqlcmd and bcp.
  • System Requirements
    Supported Operating System
    Linux

      Either 64-bit Red Hat Enterprise Linux 5 or 64-bit Red Hat Enterprise Linux 6 with the following RPM packages installed from your distribution’s package repository: 64-bit SUSE Linux Enterprise 11 Service Pack 2 with the following packages installed:

      ODBC driver for 64-bit Red Hat Enterprise Linux 5 requires the following packages:
      • glibc
      • libgcc
      • libstdc++
      • e2fsprogs-libs
      • krb5-libs
      • openssl

      ODBC driver for 64-bit Red Hat Enterprise Linux 6 requires the following packages:
      • glibc
      • libgcc
      • libstdc++
      • krb5-libs
      • openssl
      • libuuid

      The unixODBC 2.3.0 Driver Manager built and installed according to the following instructions.
  • Install Instructions
      Download the Microsoft ODBC Driver 11 for SQL Server ODBC on Linux package for your platform by clicking one of the download buttons.

      Verify the integrity of your download:

      64-bit Red Hat Enterprise Linux 5
      • SHA2: 178280daf01a49b8322cd902b6440979adacd594c01cd2a1f081dda23dbfb343

      64-bit Red Hat Enterprise Linux 6
      • SHA2: e9b6bd33d174c7753b3a3f2d541713fbc156b46254484a169caa3f459dd828f7

      INSTALLING THE DRIVER MANAGER

      Important: Delete any driver manager packages installed on your computer before you install the unixODBC Driver Manager. Installing the unixODBC Driver Manager could cause a failure of an existing Driver Manager.

        Using the Installation Script:
        1. Make sure that you have root permissions.
        2. Go to the directory where the Microsoft SQL Server ODBC Driver download placed the file called msodbcsql-11.0.2270.0.tar.gz. Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command: tar xvzf msodbcsql-11.0.2270.0.tar.gz.
        3. Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called build_dm.sh. You can run build_dm.sh to install the unixODBC Driver Manager.
        4. To see a list of the available options, execute the following command: ./build_dm.sh --help.
        5. When you are ready to install, and if your computer can access an external site via FTP, execute the following command: ./build_dm.sh.

          If your computer cannot access an external site via FTP, get unixODBC-2.3.0.tar.gz. You can get unixODBC-2.3.0.tar.gz from http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. Then click the appropriate link to download unixODBC-2.3.0 (not unixODBC-2.3.1). UnixODBC-2.3.1 is not supported with this release of the Microsoft ODBC Driver 11 for SQL Server. Execute the following command to begin the unixODBC Driver Manager installation: ./build_dm.sh --download-url=file://unixODBC-2.3.0.tar.gz.
        6. Type YES to proceed with unpacking the files. This part of the process can take up to 5 minutes to complete
        7. After the script stops running, follow the instructions on the screen to install the unixODBC Driver Manager.

        You are now ready to install the driver. See Installing the Microsoft ODBC Driver for SQL Server on Linux for more information. 

        Manual Installation:

        If the installation script is unable to complete, configure and build the proper driver manager yourself.

        1. Remove any older installed version of unixODBC (for example, unixODBC 2.2.11). On Red Hat Enterprise Linux 5 or 6, execute the following command: yum remove unixODBC.
        2. Go to http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. Then click the appropriate link to save the file unixODBC-2.3.0.tar.gz to your computer. UnixODBC-2.3.1 is not supported with this release of the Microsoft ODBC Driver 11 for SQL Server.
        3. On your Linux computer, execute the command: tar xvzf unixODBC-2.3.0.tar.gz.
        4. Change to the unixODBC-2.3.0 directory.
        5. At a command prompt, execute the command: CPPFLAGS="-DSIZEOF_LONG_INT=8".
        6. At a command prompt, execute the command: export CPPFLAGS.
        7. At a command prompt, execute the command: "./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE".
        8. At a command prompt (logged in as root), execute the command: make.
        9. At a command prompt (logged in as root), execute the command: make install.

        You are now ready to install the driver. See Installing the Microsoft ODBC Driver 11 for SQL Server on Linux for more information.

      INSTALLING THE MICROSOFT ODBC DRIVER 11 FOR SQL SERVER ON LINUX

      To install the driver:
      1. Make sure that you have root permissions.
      2. Change to the directory where the ODBC Driver on Linux placed the file called msodbcsql-11.0.2270.0.tar.gz. Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command, tar xvzf msodbcsql-11.0.2270.0.tar.gz.
      3. Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called install.sh.
      4. To see a list of the available installation options, execute the following command: ./install.sh.
      5. Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. To discover the location of odbcinst.ini on your computer, execute the following command: odbc_config --odbcinstini.
      6. Before you install the driver, execute the following command: ./install.sh verify. The output of ./install.sh verify reports if your computer has the required software to support the ODBC Driver on Linux.
      7. When you are ready to install the ODBC Driver on Linux, execute the command: ./install.sh install. If you need to specify an install command (bin-dir or lib-dir), specify the command after the install option.
      8. After reviewing the license agreement, type YES to continue with the installation.

      Installation puts the driver in /opt/microsoft/msodbcsql/11.0.2270.0. The driver and its support files must be in /opt/microsoft/msodbcsql/11.0.2270.0.

      To verify that the ODBC Driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n "ODBC Driver 11 for SQL Server"