Tuesday, October 30, 2018

Install apache-2.4.37 in linux from source with APR and APR util


From the today tutorial, we are going to discuss how to install httpd-2.4.37(Apache-2.4.37) latest Apache stable version in Linux Cent/RHEL 7 OS with APR. 

If you are bored with reading, please skip "what is apr?" part. 

Please note that this all artical related to RHEL and CENT OS system. 


What is APR?

The Apache Portable Runtime (APR) is a supporting library for the Apache web server
It provides a set of APIs that map to the underlying operating system (OS).Where the OS does not support a particular function, APR will provide an emulation. Thus programmers can use the APR to make a program truly portable across platforms.
APR originally formed a part of Apache HTTP Server, but the Apache Software Foundation spun it off into a separate project. Other applications can use it to achieve platform independence.

Implementation with apache-2.4.37


1. Download needed packages from apache foundation. Use bellow commands to download needed sorce file. Please note that,this source packages will download your current working directory.

  • wget https://www-eu.apache.org/dist//httpd/httpd-2.4.37.tar.gz

  • wget https://www-eu.apache.org/dist//apr/apr-1.6.5.tar.gz

  • https://www-eu.apache.org/dist//apr/apr-util-1.6.1.tar.gz


In here APR util is dependency libraries for APR. You should download both APR and APR util for compile apache with APR.

Finally you can see downloaded files in location as bellow.



2. Untar apache (httpd-2.4.27.tar.gz) file(Extract file for installation).
  • tar -xzvf httpd-2.4.37.tar.gz
3.Move apr and apr utils to apache's include directory.
  • mv apr-1.6.5.tar.gz apr-util-1.6.1.tar.gz /opt/software/httpd-2.4.37/srclib/
4. Now go in to httpd's srclib location
  • cd /opt/software/httpd-2.4.37/srclib/
5.Untar apr and apr utiles in /opt/software/httpd-2.4.37/srclib/ location.
  • tar -xzvf apr-1.6.5.tar.gz
  • tar -xzvf apr-util-1.6.1.tar.gz
You can see as bellow of extracted files.


6. Rename apr-1.6.5 and apr-util-1.6.1 to apr and apr-util. Detailed screenshots below.
  • mv apr-1.6.5 apr
  • mv apr-util-1.6.1 apr-util


7. Now time to run compile command. Before run bellow commnd you should come back one directory from current location.Run bellow two commands.
  • cd ../
  • ./configure --with-included-apr
(If you getting any error when you run configure comman, you need to install required gcc packages for compile since APR is developed using C language. If error occur again,please install PCRE packages.Use below command if any error occure.
  • yum install gcc*(this will install all gcc packages. This will help for future since I install all gcc libraries)
  • yum install pcre*
 After installation done re-run above command. )

If you've done configure successfully, you'll see as following screenshot.




8. Now hard part of installation done. Now need to build apache in th system. use bellow commands to build and install apache in the system.
  • make
(If you getting error with make, most probably you are not installed expat and expat-devel package. intall them using bellow command.
  • yum install expat
  • yum install expat-devel 
  • make clean
  • make distclean
  • Now do again from step 7 again.)
Successful make.




9. So now all worst cases done. Finally run bellow command to install the apache.

  • make install
Successful make install




10. Now you've almost done your apache installation. So you need to getting live Apache now.
  • /usr/local/apache2/bin/apachectl start
You can check apache running status usin bellow command.
  • ps ax | grep http
  • lsof -i :80
  • netstat -tulpn | grep 80


Now you have successfully installed and running apache with apr on your RHEL/CENTOS server. This web server running with default apache configuration. From Next tutorial, Lets see how configure and customize apache for security and functioning purpose.

Enjoy with LINUX!!!

Saturday, October 27, 2018

Container VS Container Orchestration ( Docker VS Kubernetes )





I have research couple of days regarding what is Kubernetes and Docker. 


Eventually I've been got realized there is no any competition or significant compare between Docker and Kubernetes.

Lack of knowledge regarding this two domains, people are nominate this two are enemy of each other.

When I research regarding Kubernetes and Docker, I caught two significant word called Containers and Containers Orchestration. 


Only thing you should know here is Docker is Container software and Kubernete is Container Orchestration.

It's time to compare Container and Container Orchestration now. 





Container
Container Orchestration

What is ->

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software.

Container Images become container when runtime.



Applications are typically made up of individually containerized components (often called micro services) that must be organized at the networking level in order for the application to run as intended. The process of organizing multiple containers in this manner is known as container orchestration.

Its include ->

everything needed to run an application: code, runtime, system tools, system libraries and settings.



Number of containers

Examples

Docker,MESOS,AWS ECS

Kubernet, Docker Swarm,MESOS





As a conclude, Kubernetes and Docker are not enemies they are like a brothers working as together for getting full application functioning properly with multiple containers.


Hope you understand the significant of container and container orchestration. If you have any doubt, do not be lazy, comment here.


Welcome to comparison world!!!

Tuesday, October 23, 2018

How to Reset Root Password in RHEL 7/CentOS 7 from 9 Simple steps

How to Reset Root Password in RHEL 7/CentOS 7 from 9 Simple steps

=================================================

Deeply discuss bellow points in this article with related screenshots. If you are a lazy like me simply follow following steps else you are a knowledge enthusiast you can read entire article. 😃💪💪  

1. Interrupt boot process once you are in boot loader menu.

2. Select appropriate kernel and press 'e' to shift GRUB.

3.Add 'rd.break' phase to end of linux16 line.(As a best practice use "end" key of keyboard to move end of linux16 line)

4.switch_root:/# mount -o remount,rw /sysroot/

5.switch_root:/# chroot /sysroot

6.sh-4.2# passwd

7.sh-4.2# touch /.autorelabel

8.sh-4.2# exit

9.switch_root:/# exit
=====================================================
Lets move descriptive artical for above steps. 

You should reboot your server for resetting your root password.

Once you reboot the server you will have boot loader selection screen. 

In here you can see current running kernels and kernel rescuer's there.

In my case there are two option currently running kernel and its kernel rescuer because I 

have not updated kernel yet after first installation. 

If you have upgrade kernel, you will see several numbers of kernel selections there but default is latest kernel selected. 



Once you have above screen, immediately you should interrupt booting process before moving booting process using press keyboard keys. 

Then type 'e' for editing the grub file.After press 'e' you can see a screen and you should move your courser using arrow-keys to highlighted line.(linux16 line)




Add 'rd.break'  to end of the linux 16 line(As a best practice use "end" key of your keyboard and move to end of line.You want miss the end of line with this case.).

After you've successfully added that phase press ctl + x for save grub changes and switch to sysroot.

Next you will have screen like bellow.




Now need to mount sysroot with file system.



Move to sysroot shell.




You can changed root password now using 'passwd' command. While you changed password, you will see prompt as following screenshot.



Once you successfully updated your password you need to create autorelabel file for affected changes to next boot time. 



Now we almost done the change root password of the server. Now you can exit from chroot shell.




Exit again with switch_root shell. Now you have successfully changed password.




Enjoy with Linux gyz!!!