Knowledge7

The Linux and Mobile Solution Provider

  • About
  • Training
  • Services
  • Clients
  • In the news
  • Blog
  • Contact Us
You are here: Home / Archives for Avinash Meetoo

Devices and file systems

This topic is part of our Linux System Administration training

Linux provides tools to manage disk partitions and file systems. A system administrator should be able to:

  • Understand the PC architecture concerning hard disks
  • Manage partitions (i.e. display information, create, delete, modify, etc.)
  • Create a file system on a new partition (e.g. ext3, swap)

A file system can only be used when mounted. It is important to know how to:

  • Create a mount point
  • Mount (and unmount) a file system
  • Mount using labels and UUIDs
  • Manage fstab
  • Manage swap

Of course, as soon as data exists on a file system, it is important to monitor the system regularly:

  • Check an existing file system
  • Monitor free space using df
  • Monitor usage using du
  • Monitor SMART status using smartctl

In a file system where users are allowed to create files, it is sometimes important to be able to impose user quotas. A Linux system administrator should be able to:

  • Set up quota for an existing file system
  • Use quotaon and quotaoff
  • Set limits with edquota (and understanding soft and hard limits)
  • Check quotas using quota
  • Produce reports using repquota
  • Warn users using warnquota
This topic is part of our Linux System Administration training

Our forthcoming training courses

  • No training courses are scheduled.

Shell scripting

This topic is part of our Linux Network Services and Security training

Even though Linux has a lot of commands, sometimes it is necessary to write simple (and some not so simple) scripts when we have to automate jobs.

The Bash shell is capable of running scripts and it also possible to write scripts in the various programming languages that exist in Linux (such as AWK, Python and Ruby).

The following scripts need to be written and tested:

  • booklist
    Manage a book database: print, insert, select, delete, update
  • compareperm
    Check whether two files have the same permissions
    Usage: compareperm file1 file2
  • findhardlinks
    Find links (not symbolic) to a given file
    Usage: findhardlinks file [directory]
  • largestfile
    prints the largest file in a directory
    Usage: largestfile directory
  • summarise
    prints number of normal files, directories and symbolic links
    summarise directory. Two versions of the script can be written: one that does three passes through the files and can be slow and a second version which only does one pass through the files and, consequently, is quicker.
  • anagrams
    finds and prints all the anagrams in /usr/share/dict/words. The technique used was described by Jon Bentley in his magnificent book, Programming Pearls.
This topic is part of our Linux Network Services and Security training

Our forthcoming training courses

  • No training courses are scheduled.

Package management

This topic is part of our Linux System Administration training

The Red Hat Package Manager (RPM) is an open packaging system, which runs on Red Hat Enterprise Linux as well as other Linux and UNIX systems like SuSE, Mandriva, Fedora and CentOS.

RPM is used to:

  • Install new packages
  • Uninstall existing packages
  • Upgrade existing packages to the latest version
  • Verify the integrity of existing packages

RPM also has powerful querying facilities. Those can be used, for example, for listing all installed packages, getting information on an installed package, identifying from which package a specific file is from, etc.

As RPM installs files obtained from the Internet, it also supports the use of cryptographic keys to authenticate packages.

Package Management Tool

RPM is a command line program and can be somewhat complex to use. For those who prefer graphical applications, there exists the a graphical package management tool.

YUM (Yellowdog Updater Modified)

YUM is now the standard tool for package management in Red Hat Enterprise Linux and derivatives. For most usual tasks, YUM should be used in preference to RPM as it supports new features that are now considered to be essential by most system administrators.

For example, YUM can install packages from various sources, called repositories. Those repositories can be on the Internet (e.g. an official Red Hat repository), on a LAN as well as local. Creating a local repository is a relatively straightforward task. This opens a lot of possibilities like downloading packages from a mirror, creating a repository of them on the LAN and configuring all computers in an organisation to use that rapidly-accessible repository.

Furthermore, YUM is better than RPM as it tracks (and resolves) dependencies among packages automatically. This makes installing complex packages trivial.

Package Management with APT

The Advanced Packaging Tool (APT) as used in Debian, Ubuntu and Linux Mint is the equivalent of RPM/YUM.

In general, system administrators prefer using the aptitude tool instead of the apt-get and apt-cache commands which are lower level tools with fewer capabilities.

aptitude can either be used as a command line tool or as a text application (see picture above). In both cases, aptitude can then:

  • install a package with its dependencies
  • remove a package while leaving its configuration files
  • purge a package with its configuration files
  • remove auto-installed packages which are no longer required
  • display detailed information about packages
  • search for packages which match a regular expression

aptitude is more advanced than YUM as it knows how to track dependencies both on installation and removals. YUM only resolves dependencies when installing packages.

This topic is part of our Linux System Administration training

Our forthcoming training courses

  • No training courses are scheduled.

System services

This topic is part of our Linux Network Services and Security training

Logging

EL6 Linux can be configured to log the various events occurring in files residing in /var/log. It is also possible to log to the console as well as to log to a remote log server.

Logging is done by the syslog demon which defines the following seven priorities: debug (less critical), info, notice, warning, err, crit, alert and emerg (the most critical). syslog is configured using the syslog.conf file.

The work to be done is to enable remote logging and make other computers log to it.

One important consequence of (heavy) logging is the need for log rotation. This makes sure that the log files remain at a manageable size and also takes care of archiving old log files. Log rotation can also be used to delete old log files which are not relevant anymore.

What is the relationship between cron and log rotation? How is log rotation configured?

Of course, the whole purpose of logging is to monitor the log files on a regular basis in order to detect unexpected events. Look at the various log files in /var/log and think about the different unexpected events that might appear in them and how those events might be detected.

At what frequency should log files be monitored? How?

In EL7 onwards, logging is managed by system and logs can be examined using journalctl.

Backup

A Linux system administrator should be able to:

  • Plan a backup strategy
  • Dump a raw device to a file or restore a raw device from a file (using dd for example)
  • Perform partial and manual backups and restore the files (using tar for example)
  • Synchronise two directories (using rsync for example)

There are various tools that are available for doing backups. Some are dated (e.g. dump/restore) and are being deprecated. It is important that the proper tools be used when needed.

System time

Finally, it is important that the time and date be properly set (EL6 and EL7) as essential services like cron and anacron depend on time being correct.

The work to be done is to ensure that the Linux server gets its time and date from a NTP (Network Time Protocol) server found on the Internet (i.e. become an NTP client). Setting up an NTP server is not required.

This topic is part of our Linux Network Services and Security training

Our forthcoming training courses

  • No training courses are scheduled.

How to install Linux in a virtual machine in Windows

As explained by the HowToGeek people,

“Virtual machines allow you to run any operating system in a window on your desktop. You can install the free VirtualBox or VMware Workstation (both of them free), download a Linux distribution such as CentOS or Ubuntu, and install that Linux distribution inside the virtual machine like you would install it on a standard computer.

When you need to boot up your Linux system, you can do it in a window on your desktop — no need for rebooting and leaving all your Windows programs behind. Everything but demanding games and advanced 3D effects should work just fine.

Here are two interesting YouTube videos:

Installing Centos7 in Oracle VM VirtualBox

Installing CentOS 7 in VMWare Workstation 10

Enjoy!

Our forthcoming training courses

  • No training courses are scheduled.

Why I use Linux and why you should too

Here is my story about how I accidentally discovered Linux sixteen years ago.

As a Lecturer at MCCI at that time, I wanted to make sure that all students and academics could access the Internet from all computers found in the institution. I tried doing that by setting up a Windows NT server to share the single dial-up connection we had then but I was getting a lot of technical issues.

Reserve your seat(s) for our MQA-approved
Linux System Administration training
starting on Tuesday 25 October 2016.

Book now

Places are limited. Book QUICKLY to ensure
your company obtains HRDC refunds.

By sheer luck, I got a copy of PC Quest magazine, an inexpensive computer magazine from India, and it came with a Red Hat Linux 6.2 CD. I didn’t know much about Linux (I had briefly used it as a student in France) but I was quite conversant with UNIX. I decided to give Red Hat Linux a try. I “borrowed” a small PC (Pentium 133 with only 32Mb of RAM!) and installed Red Hat Linux 6.2 on it. A few days later, just by methodically following the instructions which came with the operating system, I had a fully functional DHCP server, a DNS server, a firewall and the sole Internet connection was being shared by everyone thanks to a Proxy server and IP masquerading.

This is the moment I fell in love with Linux. Some time later, I removed Windows NT from the main server, saving money on licenses in the process, and replaced it with Red Hat Linux. This setup worked perfectly with practically no issues for a number of years. Since the past sixteen years, I have deployed Linux at Knowledge7 and in many other enterprises and, each time, everything worked well and was very cost-effective.

How you can master Linux too

Many people have the wrong impression that administering Linux is very difficult. But it does not have to be.

I created Knowledge7 in 2009 to provide the best Linux training in Mauritius. Since then, we have trained about 300 Linux professionals. We are happy that they have found tremendous value in our courses, especially as more and more companies in Mauritius now rely on Linux servers and appliances to power their mission-critical applications.

Thanks to our highly-rated Linux System Administration training, you or your staff can quickly learn how to install,configure and administer this powerful operating system according to industry best-practices.

Trainees use the latest CentOS Linux 7 (fully compatible with Red Hat Enterprise Linux 7) during all practical sessions. I am the sole trainer for the whole course and I will gladly share my 16 years of experience of Linux with everyone.

Contact me on 5834-9001 if you need any further information.

Our forthcoming training courses

  • No training courses are scheduled.

Knowledge7 is looking for a training room

20160125-training-room

We are looking for a new venue to host our upcoming Linux System Administration training.

The training will take place on Wednesdays 2, 9, 16, 23 and 30 March 2016 (i.e. five consecutive Wednesdays) from 9:00 to 16:00. We will not need the training room on other days.

Ideally we need:

  • One training room for 12 trainees and 1 trainer
  • All required furniture (tables and chairs)
  • Air-conditioning
  • White board and RGB projector
  • Electric sockets for each trainee and the trainer
  • Appropriate for an MQA-approved training
  • In Ébène, Quatre-Bornes or Port-Louis

Internet connectivity and wired networking is very desirable but optional as we can bring our own Internet connection (Emtel Home & Office) and networking equipment (switch and cables) if needed. We also have our own RGB projector if needed.

We will also bring our own computers (12 Dell desktop PCs with screen / keyboard / mouse) and a server. Between two training sessions (i.e. from one Wednesday to the next one), we would like to be able to leave all our equipment (computers,  networking devices, etc.) at the venue but fully locked and secured.

Please email Avinash Meetoo at , call him on 5834-9001 or leave a comment if you have (or you know) a suitable venue to rent for our upcoming training.

Thanks.

Our forthcoming training courses

  • No training courses are scheduled.

Geolocation and Google Maps

This topic is part of our Android Application Development training

Geolocation and Google Maps are two important features of most Android devices.

Geolocation is a feature which Android applications can use to obtain the position of the device. Geolocation uses either the GPS, the GSM network or Wifi to determine (with different levels of accuracy) the latitude and longitude of the device. It can also determine the altitude, bearing as well as speed of the device if possible.

The application to develop should display all relevant geolocation information when the user clicks on Where am I?!? The location should be automatically updated when the device moves.

Essential Android classes for geolocation include LocationManager, LocationListener and Location.

Google Maps

The application will have to be enhanced to display a Google Map of the position of the device instead of just textual information. This Google Map will be updated whenever the device moves.

To display a map from Google Maps in Android 3.0 and up, it is important to use the Google Play Services.

  • Ensure that you have installed the Google Play services application on your physical device.
  • Make sure that the Google Play services is setup properly for the project in Android Studio. Google Play Services includes the Google Maps capability.
  • Google Maps requires an API Key to work. Obtain the key corresponding to the debug certificate.
  • Finally, the AndroidManifest of the project as well as the layout need to be modified accordingly.

Once this is done, the idea is to use classes provided by Google to control with the map shown.

This topic is part of our Android Application Development training

Our forthcoming training courses

  • No training courses are scheduled.

Leveraging device capabilities

This topic is part of our Android Application Development training

In Android, an Intent is a message which allows you to request functionality from other Android components, whether those components are from the same application or from a different one. An intent can be used for instance to open an activity from the same app or to open an activity from another app.

20150827-song-explorer-v7

SongExplorerForAll v7

In SongExplorerForAll v6, we created an about menu in the action bar. Here, clicking on the about menu displays a dialog which gives information about the app.

When creating an intent, we have to specify the type of action to perform. Here, we use ACTION_VIEW which is basically used when we need to display data to the user.

20150827-song-explorer-for-all-v8

SongExplorerForAll v8

Another type of action is ACTION_SEND. This is used when we want the user to be able to share some data through another app. In SongExplorerForAll v8, when the user clicks on the share icon in the action bar, the latter will be able to share information about the Song Explorer For All app. The user is presented with a list of apps which can perform the sharing action (e.g. Gmail), from which he/she can choose.

There are two types of intents namely explicit intents and implicit intents. When using explicit intents, we have to explicitly specify the component to start by name. On the other side, when using implicit intents, we simply declare the action to perform. The Android system then finds appropriate component(s) to handle the intent. If there are several apps which can handle the intent, we can show a chooser dialog.

This topic is part of our Android Application Development training

Our forthcoming training courses

  • No training courses are scheduled.

systemd for Linux system administrators

20150825-systemd

According to Wikipedia, “systemd is a suite of system management daemons, libraries, and utilities designed as a central management and configuration platform for Linux”. systemd replaces a collection of existing subsystems, most notably the SysV init. systemd was initially developed by Lennart Poettering and Kay Sievers.

Lennart Poettering has written a number of insightful and very interesting posts on systemd which I would like to share with you all:

  • systemd for Administrators, Part 1
  • systemd for Administrators, Part 2
  • systemd for Administrators, Part 3

systemd has been adopted by a number of major distributions including Red Hat Enterprise Linux, CentOS, Fedora, Debian, Ubuntu, Arch, Gentoo and openSUSE.

Naturally, we cover systemd in our Linux courses.

Have fun learning systemd.

Our forthcoming training courses

  • No training courses are scheduled.
« Previous Page
Next Page »

Looking for something?

Want to know more?

Get our newsletter

Discover the latest news, tips and tricks on Linux, the Web and Mobile technologies every week for FREE

This work is licensed by Knowledge7 under an Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.