.Linux Technology

Linux Technology

HOW TO EXTRACT SQL.GZ FILE ON LINUX SERVER

HOW TO EXTRACT SQL.GZ FILE ON LINUX SERVER &-8211; this Article or News was published on this date:2019-08-29 02:10:02 kindly share it with friends if you find it helpful

Extract sql.gz file on linux server with ssh command


Simple command to extract sql.gz file on linux server with ssh :

gzip -d example.sql.gz

Fast – Test Your Internet Download Speed in Linux

Fast &-8211; Test Your Internet Download Speed in Linux &-8211; this Article or News was published on this date:2019-05-30 13:53:31 kindly share it with friends if you find it helpful

If your internet download speed seems poor, you most likely go at Speedtest.net and check, yes?. As this is the easiest way to test the speeds that we’re getting from our internet service provider, and it’s been a most liked choice for years.

But Netflix’s own speed testing service – Fast.com, a free, fast and simple tool that allows users to check their current Internet download and upload speed with latency in its excellent clean, ad-free interface. Since it uses Netflix’s own servers to test, so you can easily track if your ISP is throttling your speed.

Just head over to Fast.com to do a speed test of your current internet download speed.

Test Internet Download SpeedTest Internet Download Speed

Test Internet Download Speed

If you want to check the current internet speed of your Linux server from the command-line, you can use a utility called fast – a minimal zero-dependency script, written in Go language for testing your internet download speed from the terminal, which is powered by Fast.com – Netflix and runs on Linux, Windows and Mac.

This speed testing tool is very simple and has no options whatsoever. Simply, download binary file for your architecture (fast_linux_amd64 for 64bit systems) in your home directory, set execute permission and run it directly from the terminal to test your server Internet speed.

$ wget https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_amd64 -O fast
$ chmod +x fast
$ ./fast
Test Internet Download SpeedLinux Server Internet Speed Test

Linux Server Internet Speed Test

If you want, you can install it under /usr/local/bin directory on any Linux distribution by using the following commands.

$ wget https://github.com/ddo/fast/releases/download/v0.0.4/fast_linux_amd64 
$ sudo install fast_linux_amd64 /usr/local/bin/fast
$ fast
Test Internet Download SpeedInstall Fast.com Tool in Linux

Install Fast.com Tool in Linux

You can also install Fast on any Linux distribution using snap (requires snapd to be installed on the system).

$ snap install fast

That’s all! In this article, we have explained how to check current Internet download and upload speed of Linux systems using Fast.com speed testing service.

How to Create a GNU Hello World RPM Package in Fedora

How to Create a GNU Hello World RPM Package in Fedora &-8211; this Article or News was published on this date:2019-05-30 13:40:32 kindly share it with friends if you find it helpful

RPM (a recursive acronym for RPM Package Manager) is a free and open-source package management system for Linux. Although it was originally created for use in Red Hat Linux, now it is used in many Linux distributions such as CentOS, Fedora, and OpenSuse. Importantly, the name RPM refers to the package manager program and the .rpm is a file format.

In this article, we will explain on writing RPM files, showing how to easily create a simple source and binary software packages, for example, GNU “Hello World” RPM package in Fedora Linux distribution. We assume that you’ve some basic understanding of pre-made RPM packages, and with the Free Open Source Software building process.

Install Development Tools in Fedora

Let’s start by setting up the development environment in Fedora Linux by running the following command to install the necessary tools for building RPMs.

$ sudo dnf install fedora-packager @development-tools
Install Development Tools in FedoraInstall Development Tools in Fedora

Install Development Tools in Fedora

Next, add your non-privileged account to the ‘mock‘ group as follows (replace sfnews with your actual username). This will enable you to test the build procedure in a clean chroot.

$ sudo usermod -a -G mock sfnews

Now, create an RPM build in your ~/rpmbuild directory and verify the build using the following commands. It will show a list of sub-directories, which contains project source code, RPM configuration files and binary packages.

$ rpmdev-setuptree
$ tree ~/rpmbuild/
Install Development Tools in FedoraCreate Build Environment

Create Build Environment

Here is what each directory is meant for:

  1. BUILD – stores various %buildroot directories when packages are built.
  2. RPMS – will contain binary RPMs in sub-directories of Architecture.
  3. SOURCES – stores compressed source archives and any patches, this is where the rpmbuild command will look for them.
  4. SPECS – stores the SPEC files.
  5. SRPMS – stores the Source RPM instead of a Binary RPM.

Building a “Hello World” RPM

In this step, you need to download the source code (also known as the “upstream” source) of the Hello World project we are packaging, into the ~/rpmbuild/SOURCE directory with the following wget command.

$ cd ~/rpmbuild/SOURCES
$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz -P ~/rpmbuild/SOURCES

Next, let’s configure the RPM package using a .spec file (let’s name it hello.spec in this case) in the ~/rpmbuild/SPECS directory, using the rpmdev-newspec program.

$ cd ~/rpmbuild/SPECS
$ rpmdev-newspec hello
$ ls
Install Development Tools in FedoraCreate Hello Spec File

Create Hello Spec File

Then open the hello.spec file using your favorite editor.

$ vim hello.spec

The default template should look like this:

Name:           hello
Version:
Release:        1%{?dist}
Summary:

License:
URL:
Source0:

BuildRequires:
Requires:

%description

%prep
%autosetup

%build
%configure
%make_build

%install
rm -rf $RPM_BUILD_ROOT
%make_install

%files
%license add-license-file-here
%doc add-docs-here

%changelog
* Tue May 28 2019 Aaron Kili

Let’s briefly explain the default parameters in a .spec file:

  • Name – used to set a name for the package.
  • Version – should mirror upstream.
  • Release – numbers you work within Fedora.
  • Summary – is a brief one-line description of the package, the first letter should be uppercase to avoid rpmlint complaints.
  • License – check the License status of the software by inspecting the source files and/or their LICENSE files, and/or by talking to the authors.
  • URL – specifies the home page of the software package.
  • Source0 – specifies the source files. It can be a direct URL or a path of the software’s compressed source code.
  • BuildRequires – specifies the dependencies needed to build the software.
  • Requires – specifies the dependencies needed to run the software.
  • %prep – is used to create the environment for building the rpm package.
  • %build – is used to compile and to build the source codes.
  • %install – this is used to install the programs. It lists command(s) to needed to copy the resultant file from the build process to the BUILDROOT directory.
  • %files – this section lists the files provided by the package, which will be installed on the system.
  • %changelog – should stores the work on preparing the RPM, especially if there are security and bug patches included on top of the base upstream source. It’s automatically generated while creating the hello.spec file. The changelog data is usually displayed by rpm --changelog -q packagename>.

Now edit your .spec file and make changes as shown.

Name:           hello
Version:        2.10
Release:        1%{?dist}
Summary:        The "Hello World" program from GNU

License:        GPLv3+
URL:            http://ftp.gnu.org/gnu/%{name}
Source0:        http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz

BuildRequires: gettext
      
Requires(post): info
Requires(preun): info

%description 
The "Hello World" program package 

%prep
%autosetup

%build
%configure
make %{make_build}

%install
%make_install
%find_lang %{name}
rm -f %{buildroot}/%{_infodir}/dir

%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun
if [ $1 = 0 ] ; then
/sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

%files -f %{name}.lang
%{_mandir}/man1/hello.1.*
%{_infodir}/hello.info.*
%{_bindir}/hello

%doc AUTHORS ChangeLog NEWS README THANKS TODO
%license COPYING

%changelog
* Tue May 28 2019 Aaron Kili

You will notice that we have used some new parameters in the above file which have not been explained. These are called macros, used to build system invocations defined by RPM to set installation paths for packages. Therefore, it’s usually preferable to not hard-code these paths in spec files either, but use the same macros for consistency.

The following are RPM build and directory macros together with their definitions and defaults values:

  • %{make_build} – is used in the %build section of the spec file, it runs the make command.
  • %{name} – defines package or directory name.
  • %{buildroot} – %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}, same as $BUILDROOT
  • %{_infodir} – %{_datarootdir}/info, default: /usr/share/info
  • %{_mandir} – %{_datarootdir}/man, default: /usr/share/man
  • %{_bindir} – %{_exec_prefix}/bin, default: /usr/bin

Note that you can find the values for these macros in the /usr/lib/rpm/platform/*/macros or refer to Packaging Guidelines:RPM Macros.

Building the RPM Package

To build the source, binary and debugging packages, run the following rpmbuild command.

$ rpmbuild -ba hello.spec

After the build process, the source RPMs and binary RPMs wills be created in the ../SRPMS/ and ../RPMS/ directories respectively. You can use the rpmlint program to check and ensure that the spec file and RPM files created conform to RPM design rules:

$ rpmlint hello.spec ../SRPMS/hello* ../RPMS/*/hello*
Install Development Tools in FedoraCheck Packages for Errors

Check Packages for Errors

If there any errors as shown in the above screenshot, fix them before you can proceed.

Last but not least, use mock program to check that the package build will succeed in the Fedora restricted build environment.

$ mock --verbose ../SRPMS/hello-2.10-1.fc29.src.rpm
Install Development Tools in FedoraCheck RPM Package Build

Check RPM Package Build

For more information, consult the Fedora documentation: Creating RPM Packages.

That’s all! In this article, we have explained how to step up your Fedora system to create a simple source and binary software package. We also showed how to create a GUN Hello Word RPM package. Use the feedback form below to reach us for any questions or comments.

RedHat Enterprise Linux 6 Installation Guide with Screenshots

RedHat Enterprise Linux 6 Installation Guide with Screenshots &-8211; this Article or News was published on this date:2019-05-28 20:01:23 kindly share it with friends if you find it helpful

Update: RHEL 7.3 Released, follow Red Hat Enterprise Linux (RHEL) 7.3 Installation Guide

This is the article which will guide you step-by-step installation of Red Hat Enterprise Linux 6 (Santiago) with screenshots. Current stable version is 6.3 (mirror update 3). Red Hat Enterprise Linux is one of the best and stable Linux Operating systems.

RHEL 6 Installation GuideRHEL 6 Installation Guide

RHEL 6 Installation Guide

Red Hat Enterprise Linux is a Linux-based operating system developed by Red Hat and targeted the commercial market.

The Red Hat Enterprise Linux 6 is available on the following architectures:

Red Hat Enterprise Linux is released in server versions for x86, x86-64 for Itanium, PowerPC and IBM System z, and Desktop versions. Download center for RHEL 6 DVD/CD from https://access.redhat.com/downloads.

There are numbers of new technology and features are added; some of the important features are listed below:

  1. Ext4 a default filesystem, and the optional XFS filesystem.
  2. XEN is replaced by KVM (Kernel based Virtualization). However, XEN is supported till RHEL 5 life cycle.
  3. Supported future ready Filesystem called Btrfs pronounced “Better F S”.
  4. Upstart event driven which contains scripts that are only activated when they are needed. With Upstart, RHEL 6 has adopted a new and much faster alternative for the old System V boot procedure.

There are number of installation types such as unattended installation called Kickstart, and Text-based Installer, I’ve used Graphical Installer. And I have installed it on my testing environment. Please choose packages during installation as per your need. So, let’s get started. Boot Computer Using Red Hat 6 Installation CD/DVD.

Red Hat Enterprise Linux 6 Installation

1. Select Install or upgrade existing system options.

RHEL 6 Installation GuideSelect Install or Upgrade

Select Install or Upgrade

2. Select Language.

RHEL 6 Installation GuideSelect RHEL 6 Language

Select RHEL 6 Language

3. Select keyboard type.

RHEL 6 Installation GuideSelect RHEL 6 Keyboard

Select RHEL 6 Keyboard

4. Choose skip media test, click ok if you want to check media.

RHEL 6 Installation GuideSkip RHEL 6 media test

Skip RHEL 6 media test

5. Select storage device.

RHEL 6 Installation GuideSelect RHEL 6 Storage Device

Select RHEL 6 Storage Device

6. Type computer name or hostname.

RHEL 6 Installation GuideSet RHEL 6 Hostname

Set RHEL 6 Hostname

7. Select time zone location.

RHEL 6 Installation GuideSet RHEL 6 TimeZone

Set RHEL 6 TimeZone

8. Enter password for root user.

RHEL 6 Installation GuideSet RHEL 6 root Password

Set RHEL 6 root Password

9. Select type of installation and review partitioning layout carefully also may choose Encrypt system.

RHEL 6 Installation GuideSelect RHEL 6 Partition Layout

Select RHEL 6 Partition Layout

10. Review partitioning layout, modify if needed. I have chosen default setup with Ext4 and LVM.

RHEL 6 Installation GuideChoose RHEL 6 Filesystem type

Choose RHEL 6 Filesystem type

11. Manually configuration of LVM and RAID storage.

RHEL 6 Installation GuideConfigure RHEL 6 LVM and Raid

Configure RHEL 6 LVM and Raid

12. Creating partition and formatting filesystems.

RHEL 6 Installation GuideCreating RHEL 6 Partitions

Creating RHEL 6 Partitions

13. Configuring boot loader options, also can give boot loader password for security reason.

RHEL 6 Installation GuideSet RHEL 6 boot loader password

Set RHEL 6 boot loader password

14. Select applications to install and select customize now.

RHEL 6 Installation GuideSelect RHEL 6 Installation Packages

Select RHEL 6 Installation Packages

15. Customize package selections.

RHEL 6 Installation GuideRHEL 6 Packages Selection

RHEL 6 Packages Selection

16. Installation progress.

RHEL 6 Installation GuideRHEL 6 Installation Process

RHEL 6 Installation Process

17. Installation is completed successfully.

RHEL 6 Installation GuideRHEL 6 Installation Completed

RHEL 6 Installation Completed

18. Please reboot your computer and login with root credentials as you set in the Step -8.

RHEL 6 Installation GuideReboot RHEL 6 Installation

Reboot RHEL 6 Installation

19. Login Screen.

RHEL 6 Installation GuideRHEL 6 Login Screen

RHEL 6 Login Screen

Liked the article? Sharing is the best way to say thank you !

What is Ext2, Ext3 & Ext4 and How to Create and Convert

What is Ext2, Ext3 & Ext4 and How to Create and Convert &-8211; this Article or News was published on this date:2019-05-28 20:01:20 kindly share it with friends if you find it helpful

I have used my Fedora old system to test where I converted from ext2 to ext3, ext2 to ext4 and ext3 to ext4 file systems successfully. By following this guide anyone can convert their file systems smartly, but still I like to WARN you’ll before doing this, because the following task required skilled administrative practices and make sure you must take important backup of your files before doing this. If in case something goes wrong at least you can revert to back with your backup data.

Linux File SystemLinux File System

Linux File System

In a computer, a file system is the way in which files are named and placed logically to store, retrieve and update the data and also used to manage space on the available devices.

File system is divided in two segments called User Data and Metadata. In this article I am trying to explore how to create and convert various Linux file systems and high level difference amongst Ext2, Ext3 and Ext4 file systems. Before moving further readings, let me introduce a brief about Linux file systems.

Ext2 – Second Extended File System

  1. Ext2 file system was introduced in 1993 and Ext2 was developed by Remy Card. It was the first default file system in several Linux distro like RedHat and Debian.
  2. It was to overcome limitation of legacy Ext file system.
  3. Maximum file size is 16GB – 2TB.
  4. Journaling feature is not available.
  5. It’s being used for normally Flash based storage media like USB Flash drive, SD Card etc.

Ext3 – Third Extended File System

  1. Ext3 file system was introduced in 2001 and same was integrated in Kernel 2.4.15 with journaling feature, which is to improve reliability and eliminates need to check file system after unclean shutdown.
  2. Max file size 16GB – 2TB.
  3. Provide facility to upgrade from Ext2 to Ext3 file systems without having to back up and restore data.

Ext4 – Fourth Extended File System

  1. Ext4, the high-anticipated Ext3 successor.
  2. On October 2008, Ext4 as stable code were merged in the Kernel 2.6.28 which contains Ext4 file system.
  3. Backward compatibility.
  4. Max file size 16GB to 16TB.
  5. Ext4 file system have option to Turn Off journaling feature.
  6. Other features like Sub Directory Scalability, Multiblock Allocation, Delayed Allocation, Fast FSCK etc.

How to Determine File System Type?

To determing your linux file system type, run the following command in terminal as a root user.

- df -hT | awk '{print $1,$2,$NF}' | grep "^/dev"
/dev/sda3 ext3 /
/dev/sda1 ext3 /boot
Warning: Please take important data backup before executing below commands.

Creating an Ext2, or Ext3, or Ext4 File Systems

Once you create file system using fdisk or parted command, use mke2fs command to create either of file system and make sure you replace hdXX with your device name.

Creating Ext2 File System

- mke2fs /dev/hdXX

Creating Ext3 File System

- mke2fs –j  /dev/hdXX
OR
- mkfs.ext3  /dev/hdXX

-j option is used for journaling.

Creating Ext4 File System

- mke2fs -t ext4 /dev/hdXX
OR 
- mkfs.ext4 /dev/hdXX

-t option to specify the file system type.

Converting an Ext2, or Ext3, or Ext4 File Systems

It is always better way to unmount file system and convert. Conversion can be done without unmounting and mounting filesystem. Again replace hdXX with your device name.

Converting Ext2 to Ext3

To change an ext2 file system to ext3 enabling the journal feature, use the command.

- tune2fs -j /dev/hdXX

Converting Ext2 to Ext4

To convert from old ext2 to new ext4 file system with latest journaling feature. Run the following command.

- tune2fs -O dir_index,has_journal,uninit_bg /dev/hdXX

Next do a complete file system check with e2fsck command to fix and repair.

- e2fsck -pf /dev/hdXX

-p option automatically repairs the file system.
-f option force checking file system even it seems clean.

Converting Ext3 to Ext4

To enable the ext4 features on an existing ext3 filesystem, use the command.

- tune2fs -O extents,uninit_bg,dir_index /dev/hdXX

WARNING: You cannot revert or mount back to ext3 filesystem once you run above command.

After running this command we MUST run fsck to fix up some on-disk structures that tune2fs has modified.

- e2fsck -pf /dev/hdXX

WARNING: Please try all these above commands on your tesing Linux server.