Saturday 25 March 2017

How to install/upgrade openssl and compile ssl with apache.

Note: Apache httpd 2.4.x is compatible with openssl-1.0.x and not with higher.

Download OpenSSL:

https://www.openssl.org/source/openssl-1.0.2k.tar.gz

1) Install and Compile openssl source

Extract it any where you want, Follow below command to compile openssl.

--prefix=(this is to specify installation directory if not use it will install at default location)

Command: ./config --prefix=/usr --openssldir=/usr/local/openssl shared

make

make install

openssl installed sucessfully.

2) Compile openssl with apache or Install Apache with mod_ssl.

Command: ./configure --prefix=/opt/httpd --enable-ssl --enable-so

make

make install

openssl compiled with apache sucessfully.

Friday 24 March 2017

How to install Apache (httpd-2.4.25) with Source

Today we will see how to perform source apache (httpd-2.4.25) installation.

Reference:- http://httpd.apache.org/docs/2.4/install.html

Pre-Requisites:

Direct urls to download all pre-requisites

1) APR Download: http://www-eu.apache.org/dist//apr/apr-1.5.2.tar.gz
2) APR-UTIL Download: http://www-eu.apache.org/dist//apr/apr-util-1.5.4.tar.gz
3) PCRE Download: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
4) PCRE2 Download: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.23.tar.gz
5) OpenSSL Download: ftp://openssl.org/source/openssl-1.0.2k.tar.gz
6) mod_jk Download: http://www-us.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz
7) Apache httpd Download: httpd.apache.org/download.cgi

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

Follow below steps to install apache2.4.x.

1) Install C and C++ compilers using yum.

Command: yum install -y gcc*

2) Install/Compile APR. // I have used default installation directory for compilation.

Command: ./configure --prefix=/usr --with-apr=/usr --with-gdbm=/usr --with-openssl=/usr --with-crypto

make

make install  // APR is installed sucessfully..

3) Install compile APR-Util. // I have used default installation directory for compilation.

Command: ./configure --prefix=/usr --with-apr=/usr --disable-static --with-installbuilddir=/usr/share/apr-1/build

make


make install
 //APR-Util is installed sucessfully..

Note: APR and APR-Util can be compiled with apache httpd and reduce above 2nd and 3rd steps.

Command: (Apache_source)./configure --with-apr=/httpd_source_tree_root/srclib/apr

4) Install PCRE.    PCRE2 -- // This is optional and // I have used default installation directory for compilation.

Command: ./configure --prefix=/usr --docdir=/usr/share/doc/pcre-8.40 --enable-unicode-properties --enable-pcre16 --enable-pcre32 --enable-pcregrep-libz --enable-pcregrep-libbz2  --enable-pcretest-libreadline --disable-static

make

make install  //PCRE is installed sucessfully..

5) Install PCRE2    // I have used default installation directory for compilation.

Command: ./configure --prefix=/usr --docdir=/usr/share/doc/pcre2-10.23 --enable-unicode --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-pcre2test-libreadline --disable-static

make

make install // PCRE2 is installed sucessfully..

6) Apache httpd installation.

Command: ./configure --prefix=/opt/httpd/  (PREFIX can be any directory where you want to install apache).

make

make install

6) mod_jk compilation with apache:

Command: $tomcat-connectors_source/native/./configure --with-apxs=/opt/httpd/bin/apxs  //apxs is a script located in /bin directory of compiled apache 

make

make install

7) Start/Stop apache.

Command: $APACHE_HOME/bin/./apachectl -k start/stop

8) Apache installation steps and troubleshooting is recorded in video below feel free to question in comments.

Monday 10 August 2015

How to Confiure YUM server in Linux

What is yum?

The Yellowdog Updater, Modified (yum) is an open-source command-line package-management utility for Linux operating systems using the RPM Package Manager. Yum allows automatic updates, package and dependency management, on RPM-based distributions. yum works with software repositories (collections of packages), which can be accessed locally or over a network connection.

Step1: Prerequisites: Below are the rpm based packages need to be installed to continue.

vsftpd*, deltarpm*, python-deltarpm*, createrepo*

Install below packages using rpm command from /misc/cd/Server/Packages

Command: rpm -ivh vsftpd




Command: rpm -ivh deltarpm*




Command: rpm -ivh python-deltarpm*




Command: rpm -ivh createrepo*




Step2: Create directory Server under /var/ftp/pub/

Command: mkdir -p /var/ftp/pub/Server

Step3: Now move to /misc/cd/ and copy all the content to /var/ftp/pub/Server/

Command: cp -avr * /var/ftp/pub/Server

Step4: Now run createrepo command to compile all packaged together.

Command: createrepo /var/ftp/pub/Server

Step5: Restart the vsftpd service and make the service persistence post reboot.

Command: service vsftpd restart

Command: chkconfig --level 35 vsftpd on

Step6: Now create a yum repository configuration file called /etc/yum.repos.d/local.repo with the following contents:

Command: vi /etc/yum.repos.d/local.repo

[local]
name=my local repo
baseurl=ftp://192.168.0.200/pub/Server/Packages
enabled=1
gpgcheck=0

Step7: Test the configurations using below commands or try installing any package you wish to install:

Command: yum repolist


How to install java and set environment variables in linux

What is JAVA?

Java is a programming language designed for use in the distributed environment of the Internet. Java can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network. It can also be used to build a small application module or applet for use as part of a Web page. Applets make it possible for a Web page user to interact with the page.

Both jdk x64 and x86 installation are same

Step1: Go to oracle website and download Linux jdk (eg: jdk-7u79-linux-i586.gz)

Step2: Extract it to /opt/app/ (or any where you want to be install)

Command: tar -xvf jdk-7u79-linux-i586.gz

After you extract you will see: "jdk1.7.0_79"

/opt/app/jdk1.7.0_79

Create a softlink:

Command: ln -s jdk1.7.0_79 jdk

After you create a softlink you will see: "jdk -> jdk1.7.0_79"

/opt/app/jdk -> jdk1.7.0_79

Step3: Setting environment path globally

create a file jdk.sh with below commands:

Command: vi /etc/profile.d/jdk.sh

Add the below lines and save the file:

export JAVA_HOME=/opt/app/jdk
export PATH=$JAVA_HOME/bin:$PATH

Now source the jdk.sh to use the new jdk

Command: source /etc/profile.d/jdk.sh

confirm jdk installed and environment setup properly:

Command: which java

/opt/app/jdk/bin/java

Command: java -version

java version  "1.7.0_79"

Command: javac -version

javac 1.7.0_79

Note: Softlink helps to avoide making changes to jdk.sh while upgrading jdk to higher version jdk-xxx-linux-i586.gz.

Video Tutorial On How to Install java on Linux



How to install Apache http with Source

What is Apache http server?

Apache Web Server is an open source Web server, Apache Web Server have the ability to host one or more HTTP-based websites.

Step1: Apache Installation source: The source apache for linux can be downloaded from http://httpd.apache.org/download.cgi

Step2: Prerequisites: apache source (httpd-2.4.12.tar.gz), apr, apr-util, pcre, gcc.

Download the apache source /opt/apps/httpd-2.4.12.tar.gz (you can place any where you want to install)

Command: tar xvf httpd-2.4.12.tar.gz

/opt/apps/httpd-2.4.12

Step3: Go to https://apr.apache.org/download.cgi and download:

  • Unix Source: apr-1.5.2.tar.gz [PGP] [MD5]
  • Unix Source: apr-util-1.5.4.tar.gz [PGP] [MD5]

Rename apr-1.5.2.tar.gz to apr and Rename apr-util-1.5.4.tar.gz to apr-util

Step4: copy apr and apr-util to /opt/apps/httpd-2.4.12/srclib/

Step5: Install GCC, gcc can be installed by source or by yum package manager

Command: yum install -y gcc

Step6: Install PCRE and pcre-devel.

Command: yum install -y pcre*

OR download the source and intall:

Command: ./configure --prefix=/usr/local/pcre

Step7: Now move to /opt/apps/httpd-2.4.12/

Command: ./configure --prefix=/opt/apps/apache24 --enable-so

--prefix=/opt/apps/apache24 (Prefix is used to set the installation path and directory)

Command: make

Command: make install

Step8: . /opt/apps/apache24/bin/apachectl -k start ( you can user parameters as: start, stop, status)

How to mount windows system drive/folder in Linux

Temporary mount and unmout:-

Note: create a mount point first:

mkdir /ncm

mount -t cifs -rw -o username=vfshoadmin,password=pass@123 //10.98.130.164/D$ /ncm

umount /ncm

Permanent mount:

vi /etc/fstab

//10.98.130.164/D$ /ncm cifs username=vfshoadmin,password=pass@123,dir_mode=0755,file_mode=0755,uid=500,gid=500 0 0

Verify the same:
mount -a

df -h