Linux.com

Community Blogs



Linux: Log Suspicious Martian Packets / Un-routable Source Addresses

A Martian packet is nothing but an IP packet which specifies a source or destination address that is reserved for special-use by Internet Assigned Numbers Authority (IANA). You can log packets with un-routable source addresses on Linux operating system. This tutorial explains how to log spoofed packets on Debian / Ubuntu / CentOS / RHEL / Linux based server.

Linux: Log Suspicious Martian Packets / Un-routable Source Addresses

 

Linux ip Command Examples

I am a new Linux system admin user. How do I use ip command line utility to display or configure networking, routing, and tunnels on Linux operating systems? How do I configures or displays network interface parameters for a network using TCP/IP on Linux operating systems? The ip command is used to assign an address to a network interface and/or configure network interface parameters on Linux operating systems. This command replaces old good and now deprecated ifconfig command on modern Linux distributions.

Linux ip Command Examples

 

CentOS / RHEL: Yum Lock Package Version At a Particular Version

yum-plugin-versionlock plugin takes a set of name/versions for packages and excludes all other versions of those packages (including optionally following obsoletes). This allows you to protect packages from being updated by newer versions, for example. This quick tutorial explains how to install and use yum versionlock to prevent package update using yum on a CentOS or RHEL based server.

Read more: CentOS / RHEL: Yum Lock Package Version At a Particular Version

 

Configuring Apache2 to run Python Scripts

This is meant as a simple writeup to fill a gap in various "HOWTO"'s that I read when trying to setup my Apache2 server to process python scripts as CGI, though it would apply to any cgi scripts (perl scripts, compiled binaries...).
I've been developing for years (C, C++, PHP), but had never delved into python before, and I wanted to be able to have my scripts have a web interface.

The first step is getting Apache2 to recognize that my .py files were to be executed and not spit out as text files.
docs.python.org has some nice HOWTOs (http://docs.python.org/3.3/howto/webservers.html) on how to think about python and the web, and apache.org has mountains of documentation (http://httpd.apache.org/docs/2.2/howto/cgi.html) relating to running CGIs. What I didn't find was a simple guide on how to set it up. I'm a developer, not a sys-admin, and while I like knowing how to configure Apache and tune my linux boxes, sometimes I just want to get my webserver up and running and start coding.

So, in case anyone was going through the same situation as me, here is my quick and dirty setup.

For reference, this setup was done on Ubuntu 13.10, using ubuntu's default apache2 installation, and python3.
I'm also assuming you know how to configure apache for a basic html site. There are lots of HOWTO's for that.

Starting the basics:

  • apache install: sudo apt-get install apache2
  • python install: sudo apt-get install python

or

  • python3 install: sudo apt-get install python3

The first step, which in my PHP experience I never had to do, is not mentionned in the guides above is to enable CGI processing in apache.

sudo a2enmod cgi

This will automatically enable mod_cgid if your server is configured with a multi-threaded MPM, which was the case for me.

Then you can either make a folder in your site's path where your cgi files will live, or configure certain directories to handle certain file types as cgi scripts.
This is described well in the apache2 doc above, but essentially you to make all files in a cgi folder be executed, you would use this conf:

<Directory /srv/www/yoursite/public_html/cgi-bin>
        Options ExecCGI
        SetHandler cgi-script
    </Directory>

and to allow .py files to be executed as scripts in a particular folder you would use this conf:

    <Directory /srv/www/yoursite/public_html>
        Options +ExecCGI
        AddHandler cgi-script .py
    </Directory>

Once you have that, if you're running python 3, you can make a python script like this one, and stick it in whichever folder is configured for cgi:

    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-# enable debugging
    import cgitb
    cgitb.enable()
    print("Content-Type: text/html;charset=utf-8")
    print()
    print("Hello World!")

You can change the first line from

#!/usr/bin/env python

to

#!/path/to/your/python/binary

such as

#!/usr/bin/python3

in case the default is python and you want this script to be parsed by python3

 

Several Monitoring Metrics for Virtualized Infrastructure

To build a virtualized cloud infrastructure, four major elements play the vital role in the way to design a virtual infrastructure from its physical counterpart. These four elements are at the level of processors, memory, storage and network. In the continuity of the design, there is the life of the infrastructure, that is to say the daily operations. Is it administering the daily virtual infrastructure as they do in a physical environment? Pooling many resources involves consideration of other parameters that we will see here.

Processors performance monitoring

Although the concept of virtual (vCPU) for a hypervisor (VMware or Microsoft Hyper-V) is close to the notion of the physical heart, a virtual processor is much less powerful than a physical processor. Noticeable CPU load on a virtual server can be absolutely more important than the physical environment. But nothing to worry about if the server has been sized to manage peak loads. In contrast, maintenance of indict alert threshold often makes more sense and it is wise to adjust.

By the way, all hypervisors are not necessarily within a server farm. The differences may be at the level of processors (generation, frequency, cache) or other technical characteristics. This is something to consider as a virtual server that can be migrated to warm hypervisor to another (vMotion in VMware, Microsoft Live Motion). After a trip to warm virtual server, the utilization of the processor can then vary.

Does the alert threshold define by taking into account the context changes?

The role of the scheduler in access to physical processors is per virtual servers. You may not be able to access it immediately, because there would be more virtual servers, more access and waiting time (latency) which is important to consider. In addition, performance monitoring is not limited solely to identify how power is used, but also to be able to detect where it is available. In extreme cases it is possible to visualize a virtual server with low CPU load. This indicator of processor latency for each virtual server is an indicative of a good use of the available power. Do not believe that the power increases by adding virtual processors to the server, it is actually more complex and it is often the opposite effect of what is required to happen. Usually, you need to send this problem by analyzing the total number of virtual processors on each hypervisor.

Monitoring the memory utilization

If the memory is shared between the virtual servers running within the same hypervisor, it is important to distinguish used and unused memory. The used memory is usually statically allocated to virtual server while the unused memory is pooled. Due to this reason it is possible to run virtual servers with a total memory which also exceeds the memory capacity of hypervisor. The memory over-provisioning of virtual servers on hypervisor is not trivial. It is a kind of risk taking, betting that all servers will not use their memory at the same time. There is no concern of the type “it is” or “this is wrong”, much depends on the design of virtual servers. However, monitoring will prevent it from becoming a source of performance degradation.

A first important result is that over provisioning prevents starting of all virtual servers simultaneously. Indeed, a hypervisor verifies that it can affect the entire memory of a virtual server before starting it. It is possible to start with a timer so that everyone releases its unused memory in a specific order.

The slower memory access is second consequence. VMware has implemented a method of garbage collection (called as a ballooning) with virtual servers. It occurs when the hypervisor is set to provide memory to a virtual server when available capacity is insufficient. The hypervisor strength release memory with virtual servers. This freed memory is then distributed to servers as needed. This mechanism is not immediate; there is some latency between the request for memory allocation and its effectiveness. This is the reason it slows down memory access. This undermines the good performance of the servers.

Another consequence of the ballooning, it can also completely change the behavior of the server’s memory. Linux systems are known to use available memory and keep it cached when it is released by the process (memory that does not appear to be free). The occupancy rate of memory of such a server is relatively stable and high. This rate will decrease with ballooning and will not be stable (frequent releases and increases).

Also there are cases where used memory can be pooled between virtual servers. This appears when the ballooning is not enough. Performance is greatly degraded when it is a situation to be avoided.

 

Installing Red5 Media Server on CentOS and RHEL

Red5 Media Server is a powerful media streaming server worked on RTMP protocal. Red5 is an open and extensible platform, which can be used in Video Conferencing or Network gaming.

Read this article to How to install Red5 media server on CentOS and RHEL Systems

 

How To Install Tomcat 7 Server on CentOS & RedHat

Apache Tomcat is an opensource webserver product of Apache Foundation like Apache HTTP server. It is used to deploying Java Servlet and JSP applications. To deploy any application in Tomcat we can simply create a war file and deploy them. 

Read this article Install Apache Tomcat on CentOS/RHEL servers for details information.

 

How to Install Zabbix Monitoring Tool on Linux

How to Install Zabbix Monitoring Tool on Linux. Zabbix is an open source software for networks and application monitoring. Zabbix provides agents to monitor remote hosts as well as Zabbix includes support for monitoring via SNMP, TCP and ICMP checks. Click here to know more about zabbix.


Click here to read full article

Zabbix is an open source software for networks and application monitoring. Zabbix provides agents to monitor remote hosts as well as Zabbix includes support for monitoring via SNMP, TCP and ICMP checks. Click here to know more about zabbix.
 

A Simple BASH Script to Test Your Internet Connectivity

Most of the users all over the world make use of Google's Index Page to check whether their Internet connection is working or not.  Many times it is required to check periodically whether the server you are running is connected to internet or not. It is very cumbersome to open the web page every time you wish to check the connection. As an alternative, it definitely makes sense to run some scripts in the background periodically scheduling them using cron.

Read More on YourOwnLinux...

 

Making Bootable USB using Syslinux

Note Kindly check the following packages on your system: 1. syslinux if not installed then install it using yum yum install syslinux 2. qemu-system-x86_64 ( i am installin 64 bit fedora so to test the pen drive finally we need this Virt. machine) if not installed then install it using yum yum install -y qemu.x86_64 it will take some time Note if you dont want to test ur pen drive then you can skip the above step: Now we can start the process 1. Download the ISO image of the OS ( Linux) on you system and mount the same under some directory. e.g with the following command. mount -t iso9660 /home/harkamal/ISO/Fedora-16-x86_64-Live-KDE.iso /mnt/iso/ 2. use a pen drive which doesn't contain any files, it can have folders but not free files. and at least 1GB free space. Now find out where you pen drive has mounted automaticall it gets mounted on /media/HARKAMAL Note: HARKAMAL is the LABEL of my pen drive yours could be something else pl. note it. command to find out where your pen drive gets mounted are df -h or fdisk -l use the first one as root user or use sudo instead. in my case it was /deb/sdb1 pl note it too. 3. go to /mnt/iso with the command cd /mnt/iso ( here u have mounted the ISO img. in step 1 with mount cmd) 4 Now run cp * -rv /media/HARKAMAL/ note: pl change the LABLEL accordingly 5 now run the following command syslinux --install -d EFI/boot/ /dev/sdb1 6 Now go to the directory /media/HARKAMAL/EFI/boot cd /media/HARKAMAL/EFI/boot 7. here copy isolinux.cfg to syslinux.cfg command is: cp isolinux.cfg syslinux.cfg 8 Now we have to edit the file syslinux.cfg open it using vim and changes the very first stanza under the heading label linux0 consisting of the line: "append initrd=initrd0.img root=live:CDLABEL=Fedora-16-x86_64-Live-KDE.iso rootfstype=auto ro liveimg quiet rhgb rd.luks=0 rd.md=0 rd.dm=0" now remove 'quiet and rhgb' entries from the above line and also remove root=live:CDLABEL=Fedora-16-x86_64-Live-KDE.iso change it to root=LABEL=HARKAMAL after making the above changes the line should finally look like: append initrd=initrd0.img root=LABEL=HARKAMAL rootfstype=auto ro liveimg rd.luks=0 rd.md=0 rd.dm=0 Note there should not be any space between root,LABELand HARKAMAL Now our usb is ready to use we can test it by running the following command on Virtual machine. command to test the USB is: qemu-system-x86_64 -hda /dev/sdb1 -m 256 -vga std. if you virtual machine gets started with installing Fedora 16 option it menas ur USN+B is ready to use and install the ISO Enjoy))))))))))))))))) Keep Posted Regards Harkamal

 

Linux vs Windows Data Servers (the bottom line)

Based on years of writing software within a network environment, and communicating with database servers running on both Microsoft Windows or Linux that provide access to databases like Microsoft SQL server and PostgreSQL  I have to say, Microsoft better look over their shoulders,  the competition is gaining a strong hold on corporate decision makers and how they foresee the future's bottom line.

At this point, the money paid out with setting up a Microsoft SQL data server by the time they factor in the cost of the operating system, the database software, the per-seat licensing, and support you almost have to take a step back and scratch your head with how much money it takes to put this in production.

Again, based on my own experience, I’m not sure why anyone would want their corporate data on a Windows-based server that requires a lot more money and maintenance to keep the server up and running, while maintaining availability, reliability, and security.

A well configured Linux data server provides a much better overall experience for a fraction of the cost.

With how companies are struggling to operate in the green, why anyone wouldn’t explore these open source options like PostgreSQL, MySQL, and operating systems like CentOS just doesn’t make any sense.

 
Page 3 of 9

Upcoming Linux Foundation Courses

  1. LFS426 Linux Performance Tuning
    08 Sep » 11 Sep - New York
    Details
  2. LFS520 OpenStack Cloud Architecture and Deployment
    08 Sep » 11 Sep - Virtual
    Details
  3. LFD320 Linux Kernel Internals and Debugging
    15 Sep » 19 Sep - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board