Linux

Linux Routes - How to use them?

Linux Routes - How to use them?

Examples of Route Command and it’s usage. Source: 7 Linux Route Command Examples (How to Add Route in Linux) To learn the fundamentals of Routing, please visit the link below: Fundamentals of Routing

Set Up a TFTP Server on Linux | Linux.com

Set Up a TFTP Server on Linux | Linux.com

Most users are familiar with FTP, but if you want to kickstart Red Hat installs, PXE boot systems, auto-provision VoIP phones or unbrick a Linux-based router, you want a Trivial File Transfer Protocol (TFTP) server. Setting one up on Linux is easy, and a perfect project to take on over the weekend. Source: Weekend Project: Set Up a TFTP Server on Linux | Linux.com | The source for Linux information

Developing email applications on Windows, targeted for Linux environment - email, mailx, sendmail

If you’re developing on a Windows platform for an application targeted for Linux or Unix that deals with email, then this article will be useful. Let us begin by understand the problem. Problem If you are a Java/Spring developer, (developing in Java is platform independent - runs on any platform where a JVM is available) then you have two options in front of you for sending emails from a Java application:

CentOS7 missing Net-Tools Package and why you should not install it moving forward

In CentOS 7, a lot of the command-line utilities for configuring and troubleshooting network properties like arp, ifconfig, iptunnel, iwconfig, nameif, netstat, route - are no longer there in the new CentOS 7 version. While still included in many Linux Distributions, (and you may be tempted to run - ‘yum install net-tools’ - to get them back into your Linux footprint). But they are considered deprecated and therefore should be phased out in favor of more modern replacements.

CentOS 6.8 & 7 - Change Timezone

Here is a cheat sheet on changing the timezone in a linux system (CentOS 6.8 or 7): # Remove the current timezone file rm /etc/localtime # Create a symbolic link to the new timezone you want # ls -la /usr/share/zoneinfo/ # ls -la /usr/share/zoneinfo/US/ # For GMT ln -s /usr/share/zoneinfo/GMT /etc/localtime # For EST ln -s /usr/share/zoneinfo/EST /etc/localtime # For UTC ln -s /usr/share/zoneinfo/UTC /etc/localtime # For GMT ln -s /usr/share/zoneinfo/GMT /etc/localtime # For New York (Eastern) ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime # For Central ln -s /usr/share/zoneinfo/US/Central /etc/localtime # For Mountain time ln -s /usr/share/zoneinfo/US/Mountain /etc/localtime # For Pacific time ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime # Set Date and Time (as needed) # MMDDHHmmYYYY date 072522172010 hwclock --systohc # If you're using NTPD Service # CentOS 6.

How to sync your date when you restore a VirtualBox snapshot?

This article focuses on synchronizing/updating the clock in your guest linux VM after you restore a VirtualBox snapshot. When you create a VirtualBox snapshot, it’s essentially a photo taken and frozen in time. All bits including the date and time are frozen to that instant. When you restore a snapshot, the Linux guest VM system is restored back to that snapshot including the date and time. This may not be desired all the time especially if the purpose is to restore the configuration and settings to an earlier time but your want to roll forward the clock on the VM to the present instance.

Node.js, Python, C/C++, Ruby, PHP development from a tiny Linux embedded for about $10

Came across this tiny IoT embedded micro-controller/computer that runs BusyBox or FreeBSD Linux and can run code written in Node.js, Python, C/C++, Ruby and PHP all at a cost of $5 to $10 with WiFi, 2G/3G, Bluetooth, GPS add-ons for your cloud services. It also has enough GPIO pins to interface with external world and not to mention the I2C and I2S interfaces for talking to other devices and peripherals as well as interfacing for sounds (I2S).

Two useful links comparing CentOS 6.X's - SysV-Init vs CentOS 7.X - SystemD - init systems

In CentOS 6.8, the init system that brings up all the services (link autoexec files in Windows) was called SysV- Init. This has been the foundation for ages as long I’ve been using CentOS. But in the latest release of CentOS (CentOS 7+) the init engine has been moved to a more favorable engine labeled SystemD. SystemD is the init engine behind Ubuntu, Fedora, Red Hat and CentOS. So the standardization is good for the Linux community but moving from CentOS 6.

WaitUntilPortOpens() - How to wait until process A runs and binds to a port before spawning process B?

Sometimes we have situations where you need to wait until one application is loaded that may bind to a certain port before kicking off a second application that may depend on that port. This process is typically described as “Wait-Until-Port-Opens” (or it could be the reverse - where you want to wait until a port closes). Here are some use-cases for this method or script: You have a Java web application (Jetty, Tomcat, WildFly, etc) that listens on port 8080 and you want your Nginx or Apache HTTPd server to start as a proxy-server once that back-end web server is bound to port 8080.

bash script to generate config or property file from a template file containing variables

Sometimes we have configuration or properties file (as templates) such as httpd.conf or server.conf where we want to dynamically replace $variables with values before writing the output to a new file. Example: # httpd.conf.tmpl SetHandler server-status Order deny,allow Deny from all Allow from $MONITOR_IP We want to develop an install script in Bash such that it reads the httpd.conf.tmpl and replaces the $STATUS_URI and $MONITOR_IP with appropriate values (either passed in as script arguments or coded in the bash script) and then write out the resulting output to a new file such as /tmp/httpd.

merging bash ssh session history

You may have observed once in a while that when you SSH onto a server and you try to look up a command you ran earlier (maybe the previous day) in the “history” output but you do not see it. This is because of how a SSH session works! Each time you ssh into a server, it leverages a set of TTY screens to maintain an individual history for that session.

CentOS 7 - How to open ports in firewalld?

Prior to CentOS 7, “iptables” and “shorewall” were the two options avaiable. Since CentOS-7, the default firewall tool is “firewalld”. Here is a short-guide on how to open two ports in the firewalld application: firewall-cmd --get-active-zones # Lets open Jetty Web Server port firewall-cmd --zone=public --add-port=8080/tcp --permanent # Lets open some other port 4242 for TCP firewall-cmd --zone=public --add-port=4242/tcp --permanent # Commit changes firewall-cmd --reload firewall-cmd --list-all Cheers.

How to configure OpenTSDB (or any process) as a systemd service in CentOS 7?

CentOS 7 uses Systemd for managing services (prior to CentOS 7 it was using upstart-init.d to manage the services). Step-1: Create CentOS 7 Service file: vim /usr/lib/systemd/system/opentsdb.service [Unit] Description=OpenTSDB Service After=network.target hbase.service [Service] Type=forking PrivateTmp=yes ExecStart=/usr/share/opentsdb/etc/init.d/opentsdb start ExecStop=/usr/share/opentsdb/etc/init.d/opentsdb stop Restart=on-abort [Install] WantedBy=multi-user.target Step-2: Let’s test the start and stop of this new OpenTSDB service $ sudo systemctl start opentsdb # If it starts up good, you should see the website when you goto http://<servername>:4242/ ps -leaf | grep "tsdb" # shows you something similar then you can add it as a service to auto-start sudo systemctl enable opentsdb Step-3: (optional) Reboot node and make sure that the service starts up accordingly after a reboot.

Fixing vim editor for dark backgrounds so comments are not dark blue

Here is a simple command that can fix your vim editor for dark backgrounds so that your comments are not showing up in dark blue (unreadable). Example screenshot: The temporary fix is to run the following command in the vim editor: :set background=dark instead of :set background=light The permanent fix for this is to add the command inside $HOME/.vimrc file set background=dark Please note that when you’re adding the property into the .

How to configure and install ZeroMQ (libsodium) on CentOS 6.7?

When getting started on ZeroMQ (version 4.2.0 or above) can be quite challenging especially with all the prerequisites. I’ve spent a good two days to get the process ironed out. So I’m sharing this so that others can avoid the same pitfalls and can have a good head-start with setting up their environment. Pitfall #1: Develop for your platform. I’m accustomed to developing in Ubuntu 14.04.3 LTE but in this case my deployment environment happens to be CentOS 6.

Simulating Load on a File-System

Sometimes you want an easy way to simulate load on a file-system that you are trying to test. Here’s a quick and easy way. Suppose your mount point you want to perform this IO is “/myspecialmount”. (Assuming you have plenty of space to test) Then the easiest way to load some IO is through the following bash-script: [sourcecode language=“bash”] #!/bin/bash while true do echo “=== Starting clean-up ====” rm -fr /myspecialmount/usr echo “=== Starting load ====” rsync -avp /usr /myspecialmount done [/sourcecode]

How to list the package contents of a yum install?

Sometimes you need to see what’s installed as part of a package via yum. To see the package contents you can use a utility that’s available on the RHEL/CentOS. [sourcecode language=“jscript”] $repoquery –list packagename [/sourcecode] If you do not have this utility available, you can install it by using this command [sourcecode] $yum install yum-utils [/sourcecode] Here is a sample output from looking at the package contents of Apache httpd.