:::: MENU ::::

Home

  • Mar 06 / 2014
  • 0
Linux

How to compile and install its own Linux kernel

The Linux Kernel is the operating system kernel. It is the core of the system and provide an interface between the hardware and the software layers.

Most of Linux distributions are coming with a pre-compiled and ready-to-use kernel for most of standard usage. However, some functionalities are sometimes missing in the kernel to allow the execution of specific functions or the support of some hardware (cards, …). In these cases, you will need to use the source code of the needed kernel, recompile it and reinstall it to replace the existing one. All the official soruces of the different kernels are available for free on the website kernel.org.

I will show you here how to modify the source code, compile and install your own kernel for your system (command-lines provided are working under Debian/Ubuntu based system, you will probably need to adapt them depending on the system you are running).

Pre-requisites

In a first time, check that you got the different packages necessary for the operation:

Once these packages are correctly installed, you can go on the official website to retrieve the source and the configuration files for the kernel you want to use: http://www.kernel.org. In our example, we will use the kernel on version 3.13.5 (latest stable version available today).

Let’s move to the /usr/src directory and then download the kernel archive that we will uncompress immediately:

Kernel sources are now uncompressed in the /usr/src/linux-3.13.5 folder and we can go ahead with its configuration.

Configuration

Let’s move in the directory you just created and start with the use of command make menuconfig to launch the configuration tool:

At this time, you can activate any feature you want on the kernel. For example:

  • To activate the virtualization and its specific functions, move on Virtualization and then press the Space bar to get access to the different available functionalitiesuis  (that you can activate/deactivate as you want)
  • To activate the modules support, move on Enable loadable module support and choose the modules you want to enable by pressing the Space bar (activated items will be checked)

kernel_01

Once you’re done with this configuration, choose Exit and confirm the save of your configuration. This one will be saved in the current directory under the .config file (that you can manually edit with a simple text editor if necessary).

Compilation

Now that the kernel is configured, you will have to compile it so that it can be used on your system. For that, you will need to execute several commands for the different compilation steps:

  • Dependencies compilation (now useless with latest versions)
  • Kernel image compilation
  • Modules compilation
  • Modules installation

At this time, your kernel has been compiled and is ready to be set up on your system.

Installation

To install your own kernel, you just need to execute the command-line below:

This command will create the following files in the /boot start directory:

  • vmlinuz-3.13.5 : the current kernel
  • config-3.13.5 : the kernel configuration file
  • System.map-3.13.5 : the symbol table exported by the kernel
  • initrd.img-3.13.5 : the root file used temporarily during the boot process

This command should update automatically the Grub configuration file (grub.cfg). You won’t need to perform the update manually.

If it’s not done automatically, you can execute it manually with the command-line below:

Checking

In order to check that your kernel has correctly been loaded and is used, you need to reboot your system. Once restarted, you can check which kernel is used with the uname command:

You are now using your own kernel with the functionalities you wanted.

  • Feb 19 / 2014
  • 0
Linux

Create Software RAID under Linux system

A hard drive disk is a device with limits (performance, lifetime, …) and a broken disk often leads to a data loss, and sometimes with a loss of data more or less important.
In order to avoid that kind of inconvenience, there are several hardware solutions allowing disk replication, but most of time with a too high cost for a standard use (non professional). Fortunately, there is also a software RAID, which can be set up easily and quickly without any additional hardware (assuming you already own at least 2 hard drive disks) given that it’s working on a software layer between the hardware abstraction layer and the file system.

There are different levels of RAID ; the most common levels are:

  • RAID 0 : the “striping” allows to improve performance by splitting the IO requests on several devices in parallel (2 to n disks)
  • RAID 1 : the “mirroring” allows to write same data on several disks at the same time (to disks)
  • RAID 5 : the “striping and mirroring” allows the combination of RAID 0 and RAID 1 (3 to n disks)

I will present here how to set up a RAID 1 solution (mirroring) but it will be easy to adapt the following steps if you need another RAID level.

RAID 1 setup

For the setting up, ensure you have the mdadm package installed and ready on your system. For Debian/Ubuntu, you can use the following command:

Prepare both disks in Software Raid (type 0xfd) thanks to the fdisk tool:

You can now shrink and erase both disks with zeros thanks to the command below:

Create your RAID 1 (or any level, by changing the level attribute):

Format this new partition in ext4:

Mount your partition you just created:

To get an automatic mounting point after any restart of the system, edit the file /etc/fstab  and add this following line:

You can now check and follow your RAID status, by using following commands:

RAID Monitoring

To ensure the RAID is always working correctly and be informed when a disk is out of order, it is possible to set a monitoring solution thanks to the common tools of mdadm with a mail alert system.

Check that the monitoring settings are correctly defined in the file /etc/mdadm/mdadm.conf with the sender address (MAILFROM) and the receiver address (MAILADDR):

You will need a mail server enabled on your server (postfix, ssmtp, …) and listening on port 25.

To check and test this configuration, ou can easily perform a test by sending a mail report thanks to this command:

To ensure that monitoring is enabled for your RAID devices, just check that the –monitor option is correctly set by performing the following command:

If it’s not, you will have to add the option in the /etc/default/mdadm file (DAEMON_OPTIONS).

  • Feb 12 / 2014
  • 0
Linux

Add a Swap File

When you’re running on a Linux System (or any Unix Operating System), it’s common to use a swap to complete and optimize the memory usage on the computer (especially for older ones). There are different ways to do that, you can:

  • Create a swap on a full partition system (most of Linux distribution will allow you to create it when installing the system or later using fdisk commands to create partition and activate it by following the same steps than below from #2)
  • Create a swap file later on any partition and activate it directly using command-line

I will present here the second case: the creation of a swap file (you will need to get root rights to perform most of the following commands).

  1. Create a file with dd command to create a 1024MB empty file (which will be used by swap).

    We are here writing a file of 1024*1024MB=1048576 blocks size with a Read/Write of 1024 bytes at a time.
  2. Now format the file to swap format
  3. Ensure that the rights access are correct on this file (for security purposes)
  4. Now activate swap on your file
  5. To deactivate swap on your file, juste use the following command

You can now check your swap availability by using the top or free -m command.

Right now, you probably want this swap file to be mounted and activated automatically at the system startup to avoid to perform these steps manually each time ? No problem, juste edit the /etc/fstab file and add this following line:


Your system has now a swap file ready to use !

  • Feb 06 / 2014
  • 0
Google Chrome

Uninstall/Install manually Google Chrome

Sometimes, further to a problem, an automatic uninstall process of Chrome is not efficient. In that case, you will need to proceed with a manual uninstall. Here are the steps you can use to perform a safe reinstallation:

  1. Perform a Google Chrome uninstall as explained right here: https://support.google.com/chrome/answer/95319?hl=en
  2. Create a new Chrome user profile: https://support.google.com/chrome/answer/142059?hl=en
  3. Download file remove.zip (right click – Save as), save it on your desktop, unzip it and execute the remove.reg file to remove any Google Chrome entries in your Windows registry (you will probably need administrator rights for this step)
  4. Once you’ve performed all these steps, you can perform a fresh install of Google Chrome from the official website: https://www.google.com/chrome

You can now start again your favorite browser, and reconfigure it as you want (or simply connect to your Google Account and let the synchronization do it by itself …) !

  • Jan 31 / 2014
  • 0
Android, Google Chrome

Set Chrome as default browser on Android

You have just installed Chrome on your Android device, and you now want to define it as default for your browser. Badly, you already have a browser installed on your phone which is the default browser… here are the steps to modify this:

  1. Go in the Settings of your phone
  2. In these settings, open the Applications parameters
  3. Once opened, look for the actual default browser (can be called Browser, Internet, …)
  4. Choose it, and under the Launch by default section, click on Clear defaults
  5. Go back to the Home and try to open any Internet link, the phone will now ask you which is the browser you want to use as default. You just need to choose Chrome

Voila, Chrome is now your default browser !

  • Jan 27 / 2014
  • 0
Python, web2py

Web2py framework

Do you like web development and Python ? You’re looking for a framework free, complete and in a constant evolution (features, security, …) ? So Web2py is for you !

web2py is a free, open-source web framework for agile development of secure database-driven web applications; it is written in Python and programmable in Python. web2py is a full-stack framework, meaning that it contains all the components you need to build fully functional web applications.

web2py is designed to guide a web developer to follow good software engineering practices, such as using the Model View Controller (MVC) pattern. web2py separates the data representation (the model) from the data presentation (the view) and also from the application logic and workflow (the controller). web2py provides libraries to help the developer design, implement, and test each of these three parts separately, and makes them work together.

web2py is built for security. This means that it automatically addresses many of the issues that can lead to security vulnerabilities, by following well established practices. For example, it validates all input (to prevent injections), escapes all output (to prevent cross-site scripting), renames uploaded files (to prevent directory traversal attacks). web2py takes care of main security issues, so developers have less chances of introducing vulnerabilities.

web2py includes a Database Abstraction Layer (DAL) that writes SQL dynamically so that you, the developer, don’t have to. The DAL knows how to generate SQL transparently for SQLite, MySQL, PostgreSQL, MSSQL, FireBird, Oracle, IBM DB2, Informix and Ingres.

The DAL can also generate function calls for the Google Datastore when running on the Google App Engine (GAE). Experimentally we support more databases and new ones are constantly added. Please check on the web2py web site and mailing list for more recent adapters. Once one or more database tables are defined, web2py automatically generates a fully functional web-based database administration interface to access the database and the tables.

web2py differs from other web frameworks in that it is the only framework to fully embrace the Web 2.0 paradigm, where the web is the computer. In fact, web2py does not require installation or configuration; it runs on any architecture that can run Python (Windows, Windows CE, Mac OS X, iOS, and Unix/Linux), and the development, deployment, and maintenance phases for the applications can be done via a local or remote web interface. web2py runs with CPython (the C implementation) and PyPy (Python written in Python), on Python versions 2.5, 2.6, and 2.7.

web2py provides a ticketing system for error events. If an error occurs, a ticket is issued to the user, and the error is logged for the administrator.

web2py is open source and released under the LGPL version 3 license.

Official website : Official Website Web2py
Informations source : Web2py Book

Question ? Contact