Thursday 30 March 2017

Setup Apache Server on Linux Step by Step

The Apache HTTP Server is an open-source HTTP server for modern operating systems including UNIX, Microsoft Windows, Mac OS/X and Netware. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services observing the current HTTP standards. Apache has been the most popular web server on the Internet since April of 1996.

Development:

  • Programming language: C 

Apache HTTP Server 2.4.25 is available for download from:


Setup Apache Server on Linux Step by Step

-login as root or administrator
-Download the latest release from http://httpd.apache.org/download.cgi#apache24
-/dumps/apache-server

-Extracting the source from the Apache HTTP Server tarball is a simple matter of uncompressing, and then untarring:

gzip -d httpd-2.4.25.tar.gz
tar xvf httpd-2.4.25.tar
cd httpd-2.4.25

-If PREFIX is not specified, it defaults to /usr/local/apache2.
./configure --prefix=/etc/apache2

[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.
Got above error.
If you are using 2.4 than you can go to apr.apache.org and download the latest apr and apr-util. unpack them and move them into the apache source file into /srclib. make sure they are named apr and apr-util not apr.x.x.x. then you can use the --with-included-apr flag
download to "/dumps/apache-server"

tar -xvzf apr-1.5.2.tar.gz
tar -xvzf apr-util-1.5.4.tar.gz
Rename apr-1.5.2 to apr and apr-util-1.5.4 to apr-util. Move it under httpd-2.4.25/srclib/ folder.
[root@oel11 httpd-2.4.25]# pwd
/dumps/apache-server/httpd-2.4.25
[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2 --with-included-apr
[root@oel11 httpd-2.4.25]#
-Now you can build the various parts which form the Apache package by simply running the command:
make
-Now it's time to install the package under the configured installation PREFIX (see --prefix option above) by running:
make install
-Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/.
vi /etc/apache2/conf/httpd.conf
-Now you can start your Apache HTTP server by immediately running:
/etc/apache2/bin/apachectl -k start
/etc/apache2/bin/apachectl -k stop

Install Apache 2.4.25 by rpm in linux

rpmbuild -tb apr-1.5.2.tar.bz2
rpm -ivh /root/rpmbuild/RPMS/x86_64/apr*.rpm
rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr*.rpm


[root@oeldev apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
error: Failed build dependencies:
        freetds-devel is needed by apr-util-1.5.4-1.x86_64
[root@oeldev apache-server]# yum install freetd
Loaded plugins: refresh-packagekit, security
Setting up Install Process
No package freetd available.
Error: Nothing to do
[root@oeldev apache-server]# rpm -ivh freetds-0.91-2.el6.x86_64.rpm
warning: freetds-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds                ########################################### [100%]
[root@oeldev apache-server]# rpm -ivh freetds-devel-0.91-2.el6.x86_64.rpm
warning: freetds-devel-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds-devel          ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
[root@oeldev apache-server]# rpm -Uvh  /root/rpmbuild/RPMS/x86_64/apr-util*.rpm
Preparing...                ########################################### [100%]
   1:apr-util               ########################################### [  8%]
   2:apr-util-dbm           ########################################### [ 17%]
   3:apr-util-devel         ########################################### [ 25%]
   4:apr-util-freetds       ########################################### [ 33%]
   5:apr-util-ldap          ########################################### [ 42%]
   6:apr-util-mysql         ########################################### [ 50%]
   7:apr-util-nss           ########################################### [ 58%]
   8:apr-util-odbc          ########################################### [ 67%]
   9:apr-util-openssl       ########################################### [ 75%]
  10:apr-util-pgsql         ########################################### [ 83%]
  11:apr-util-sqlite        ########################################### [ 92%]
  12:apr-util-debuginfo     ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

cd /root/rpmbuild/SOURCES
wget ftp://ftp.gmd.de/…/source/SRPMS/d/distcache-1.4.5-23.src.rpm
rpmbuild --rebuild distcache-1.4.5-23.src.rpm

[root@oeldev SOURCES]# rpm -ivh /root/rpmbuild/RPMS/x86_64/distcache*.rpm
Preparing...                ########################################### [100%]
   1:distcache              ########################################### [ 33%]
   2:distcache-devel        ########################################### [ 67%]
   3:distcache-debuginfo    ########################################### [100%]
[root@oeldev SOURCES]#

[root@oeldev SOURCES]# cd /dumps/apache-server/
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

Getting Error:

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib64/httpd/modules/mod_proxy_hcheck.so

[root@oel11 apache-server]# tar xjf httpd-2.4.25.tar.bz2

Open httpd.spec file
Add
%{_libdir}/httpd/modules/mod_proxy_hcheck.so
missing in the %dir after
%{_libdir}/httpd/modules/mod_proxy_ftp.so
Save file

[root@oel11 apache-server]# tar -cjvf httpd-2.4.25.tar.bz2 httpd-2.4.25

[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2
...
...
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm


[root@oel11 apache-server]#

yum install /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm

Completed!

Linux File System

Every thing in unix and linux is a file. 
/   root
|_/bin/ - all the system binaries exists. i.e. cat, chgrp, chmod, cp, data, dd, df, dmesg, echo, false, hostname, kill, ln, login, ls, mkdir, mknod, more, mount, mv, ps, pwd, rm, rmdir, sed, sh, stty, su, synch, true, umount, uname.

|_/opt/ -  config file for add on application software.

|_/boot/ - static files of boot loader. i.e. kernel, sstem.map, vmlinuz, initrd, grub, module.info, boot.

|_/root/ -

|_/dev/ -all of the devices on the computer. i.e. mouse, keyboard, monitor etc.

|_/sbin/ -

|_/etc/ -host specific system config. csh.login, exports, fstab, ftpusers, gateways, gettydefs, group, host.conf, hosts, hosts.allow, hosts.deny, hosts.equiv, hosts.lpd, inetd.conf, inittab, issue, ls.so.conf, motd, mtab, mtools, networks, passwd, printcap, profile, protocols, resolv.conf, rpc, securetty, services, shells, syslog.conf.

|_/srv/ -

|_/home/ -

|_/tmp/ -

|_/lib/ -

|_/usr/ -sharable and readonly data.
        |_/local - local software
        |_/bin/ - most users command
        |_/include/
        |_/lib/    
        |_/sbin/

|_/media/

|_/var/
         |_/cache/
         |_/log/        
         |_/spool/
         |_/tmp/

|_/mnt/

Tuesday 28 March 2017

Linux Package Management with RPM and YUM

RPM :- Redhad Package Manager

rpm just install the single rpm file. It does not take care of dependency packages.
yum take care of denpendency packages.

ftp                 = vsftpd-2.2.2-11.el6.x86_64.rpm
apache server = httpd-2.2.15-26.0.1.el6.x86_64.rpm
telnet             = telnet-0.17-47.el6_3.1.x86_64.rpm

format:
--..rpm

RPM Features


Provides package management
  • Install
  • Remove or Uninstall
  • Query 
  • Upgrade
  • Verify   
Automatically verifies packages using GPG, MD5, SHA1SUMs
Automatically reports on unresolved dependencies. 

Find out the installed packages

rpm -qa
-q = query package
-a = all installed packages

[root@oel11 yum.repos.d]# rpm -qa vsftpd
vsftpd-2.2.2-11.el6.x86_64
[root@oel11 yum.repos.d]# rpm -qa telnet
[root@oel11 yum.repos.d]#

Here vsftp returns packages that means this is installed on our server. In second command telnet doesnt returns any row and show not installed on the server.

Search specific rpm package

[root@oel11 yum.repos.d]# rpm -qa | grep vsftp
vsftpd-2.2.2-11.el6.x86_64 

[root@oel11 etc]# rpm -qa | grep httpd
httpd-manual-2.2.15-26.0.1.el6.noarch
httpd-tools-2.2.15-26.0.1.el6.x86_64
httpd-2.2.15-26.0.1.el6.x86_64

Get information about the package

rpm -qi httpd
rpm -qi httpd-2.2.15-26.0.1.el6.x86_64

[root@oel11 etc]# rpm -qi httpd-2.2.15-26.0.1.el6.x86_64
Name        : httpd                        Relocations: (not relocatable)
Version     : 2.2.15                            Vendor: Oracle America
Release     : 26.0.1.el6                    Build Date: Sat 23 Feb 2013 01:32:52 AM IST
Install Date: Tue 28 Feb 2017 01:03:23 AM IST      Build Host: ca-build44.us.oracle.com
Group       : System Environment/Daemons    Source RPM: httpd-2.2.15-26.0.1.el6.src.rpm
Size        : 3074819                          License: ASL 2.0
Signature   : RSA/8, Sat 23 Feb 2013 01:33:03 AM IST, Key ID 72f97b74ec551f03
URL         : http://httpd.apache.org/
Summary     : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.

List all files from the package

[root@oel11 yum.repos.d]# rpm -ql vsftpd-2.2.2-11.el6.x86_64
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-2.2.2
/usr/share/doc/vsftpd-2.2.2/AUDIT
/usr/share/doc/vsftpd-2.2.2/BENCHMARKS
/usr/share/doc/vsftpd-2.2.2/BUGS
/usr/share/doc/vsftpd-2.2.2/COPYING
/usr/share/doc/vsftpd-2.2.2/Changelog
/usr/share/doc/vsftpd-2.2.2/EXAMPLE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.2.2/FAQ
/usr/share/doc/vsftpd-2.2.2/INSTALL
/usr/share/doc/vsftpd-2.2.2/LICENSE
/usr/share/doc/vsftpd-2.2.2/README
/usr/share/doc/vsftpd-2.2.2/README.security
/usr/share/doc/vsftpd-2.2.2/REWARD
/usr/share/doc/vsftpd-2.2.2/SECURITY
/usr/share/doc/vsftpd-2.2.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.2.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.2.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
/usr/share/doc/vsftpd-2.2.2/SIZE
/usr/share/doc/vsftpd-2.2.2/SPEED
/usr/share/doc/vsftpd-2.2.2/TODO
/usr/share/doc/vsftpd-2.2.2/TUNING
/usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

How to install package

rpm -ivh
-i = Install the rpm
-v = verbose 
-h = display progress

- first identify where the package exists.
- linux media contains all the packages. user can download it from internet or linux dvd.
- rpm does not install the dependency packages. for this we use yum. 

How to upgrade package

rpm -qa vsftpd
rpm -Uvh vsftpd-2.2.2-11.el6.x86_64.rpm

Erase package

rpm -e
-e = Erase the package. just give package name without ".rmp"

rpm -e vsftpd
or
rpm -e vsftpd-2.2.2-11.el6.x86_64
rpm -qa vsftpd

Check apache service status

service httpd status

Start and Enable SSH Server

chkconfig sshd on
service sshd start

Check port 22 is open

netstat -tulpn | grep :22

Start/ Stop/ Status iptables service

service iptables status
service iptables start
service iptables stop

Wednesday 22 March 2017

Web Development Tools

Front End:
=======
CSS Tools:  Precompilers: SASS / LESS / Stylus

                  CSS Framework: Bootstrap / foundation            
                  Responsive design with CSS


Task Runners: Gulp,  Grunt (https://gruntjs.com/)

Dependency Management: Browserify, Webpack

Front End Build Tools: bower/ package management, http://yeoman.io/

MV Javascript Frameworks:  React.js, Angular.js, Ember.js, Vue.js,


react.js + mobx = Observer patter. For small applications.
react.js + Flux =
react.js + Redux = For Complex data interaction. like one data store.
react.js + Relay  = Really big / huge application. like gmail etc.
react.js + create-react-app =


Unit Testing: Mocha, Jasmine, Karma, enzyme (testing react)


Back End:
========
Scripting Language: node.js (express, hapi) , Python (django, flask) ,  Ruby (ruby on rails), PHP (Laravel, Symfony2, Lumen).

Functional Languages: Elixir, Scala, Clojure, Haskell

High Performance/ Compiled Languages: Go / GoLang, Rust, Java, C#


Caching:
======
NgInx (server)
Apache (server)
Database (Redis)
In-Memory

Database:
=======
Relational: MySql, PostgreSQL, Oracle
Redis / sessions / cashing
Document: MongoDB, Couchbase, RethinkDB
Search Engine: ElasticSearch, Solr

Web Plateform:
===========
Digital Ocean
Amazon Web Services (AWS)
Azure
Rackspace
Heroku

Friday 3 March 2017

WebLogic 12c (12.2.1.2) Installation on Windows Step by Step

Softwares Required to install WebLogic Server:

1. jdk-8u121-windows-x64.exe (for development) or
    jrockit-jdk1.6.0_45-R28.2.7-4.1.0-windows-x64.exe (for production)

2. fmw_12.2.1.2.0_infrastructure.jar (For Fusion Middleware Infrastructure - It adds Fusion Middleware Control and Java Required Files (JRF) for managing Multitenant domains with multiple partitions.) or
    fmw_12.2.1.2.0_wls.jar

In this installation we have used jdk-8u121-windows-x64.exe and fmw_12.2.1.2.0_infrastructure.jar.

Download Java JDK and Install on your machine.

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html





Install Java JDK: (Installed jdk on C:\Program Files\Java\jdk1.8.0_121 in our case)





Jenkins Startup and Configuration

Steps to setup jenkins on ubuntu:- -After installation. check the jenkins services running on not on the server. sudo service jenk...