Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

After installing maven in centos7 server I was getting following error while checking using mvn –version command.

Spend hours searching the issue but was unable to find a right fix.

Atlast realized that Instead of binary download I mistakenly downloaded from the source.

You need to download the binary file.


Install maven and integrate with jenkins in centos7

Create a directory named maven under /opt

# mkdir /opt/maven

Download maven from apache maven link in /opt/maven folder

# wget

Note : Always download from binary option. I had to spend hours to fix the issue after installing from source due to
following error while mvn –version command

Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

Extract the tar file and install maven

# sudo tar -xvzf apache-maven-3.6.2-src.tar.gz

Set the /root/.bash_profile file as follow to set maven path

# User specific environment and startup programs

Install plugin maven integration using option without restart

Configure maven path under maven configuration

Manage Jenkins >> Global Tool Configration >> Maven

Provide Maven path as /opt/maven/apache-maven-3.6.2

You need to verify maven is successfully installed using mvn –version

Install jenkins in centos7

1.sudo yum install -y epel-release
sudo yum -y update
sudo yum install -y net-tools
sudo yum install -y wget
2.sudo wget -O /etc/yum.repos.d/jenkins.repo
sudo rpm –import
sudo yum install -y jenkins
sudo yum install -y java-1.8
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-
sudo systemctl start jenkins.service
sudo systemctl enable jenkins.service

3. Login to jenkins console


username : admin

password should be copied from sudo cat /var/lib/jenkins/secrets/initialAdminPassword

4. Skip plugin installation page

5. To change admin password

admin >> configurate >> Password

6. Configure java path under jenkins configuration

Manage Jenkins >> Global Tool Configration >> JDK

We have already set JAVA_HOME path in step2

You can also find JAVA_HOME path using

$ sudo find / -name javac

7. To run a Test Job

1 Create “new item”

2 Enter an item name test

choose Freestyle project

3 Under option Build section

Execute shell : echo “test project”

4 Apply and Save

5 Build Job

6 Check Console Output

Understanding and writing ansible playbook

Ansible playbooks are written in YAML language. #vi ngix-install.yml
So create with .yml or .yaml extension

YAML files begins with —

next immediate line starts with – . Name is optional -name:

hosts expects all or group hosts: all

Do you want to become a root on target server use become become: true

what action you need to perform specify under tasks tasks:

Modules there are 500+ modules
Simple google search ansible module to install package yum:

ansible module to copy file name:ngnix
state: latest

state: started

The hosts file is inventory. That means you can create hosts file in any directory

name: nginx
start: started

To check whether yaml will work
# ansible-playbook -i hosts ngnix-install.yml –check

Create multiple vagrant machines in private network on your windows PC

I assume you have already installed vagrant and virtual box on your windows PC.

This is the vagrant file I have used to create multiple vagrant centos7 box in my private network for testing purposes.

I have used following configuration in Vagrant file

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.define “webserver1” do |vm1|
vm1.vm.hostname = “webserever1” = “bento/centos-7.6” “private_network”, ip: “”
vm1.vm.provider “virtualbox” do |vb|
vb.gui = false
vb.memory = “512”

config.vm.define “webserver2” do |vm2|
vm2.vm.hostname = “webserver2” = “bento/centos-7.6” “private_network”, ip: “”
vm2.vm.provider “virtualbox” do |vb|
vb.gui = false
vb.memory = “512”


Place this Vagrant file in your directory. Then use the command

#vagrant up

This will create 2 vagrant machines with linux centOS7 on your PC

You can ssh using following command

#vagrant ssh

After that if you install apache in webserver1 and if you access with in your browser you can see that a default apache page will be loaded.

codeigniter site inner links showing 403 forbidden access

The site was showing some error and I downgraded the PHP from 5.6 to 5.4. But only home page was loading.

Added the following code in the .htaccess file to correct the issue.

IfModule mod_rewrite.c
RewriteEngine On
#RewriteBase /your_project/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

IfModule !mod_rewrite.c
ErrorDocument 404 /index.php

After that inner links also started loading fine.

Apache: No space left on device: Couldn’t create accept lock

Within the Apache error logs, this message was appearing over and over:

[emerg] (28)No space left on device: Couldn’t create accept lock

1. Check the disk space

2. Review filesystem quotas

3. Clear out the active semaphores

# ipcs -s

If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck. Clear them out with this command:

# for i in `ipcs -s | awk ‘/httpd/ {print $2}’`; do (ipcrm -s $i); done

Now, in almost all cases, Apache should start properly. If it doesn’t, you may just be completely out of available semaphores. You may want to increase your available semaphores, and you’ll need to tickle your kernel to do so. Add this to /etc/sysctl.conf:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

And then run sysctl -p to pick up the new changes.

Logic behind AWS free usage tier

Let me explain about the AWS free usage tier.

EBS devices are block devices.

This means the service does not know how much data we actually store on them, it only knows how much storage space we have allocated.

So the result of df -h doesn’t matter. Actually we are only using 16GB of storage out of 30 GB.

The actual size of the volume is all that matters and that’s the basis for billing. This means it will calculate whole 30GB here.

Now, the free tier allows 30 gigabyte-months of EBS volume usage. You can use more than that, but this is the limit that’s provided for free. You’ll be billed for any more than this.

A gigabyte-month means 1 gigabyte of block storage space, allocated for 1 month, regardless of how you use it.

2 gigabytes of allocated storage for 15 days is 1 GB-month.

10 gigabytes of allocated storage for 3 days is 1 GB-month.

The free tier would allow

30 GB volume for 30 days

60 GB volume for 15 days or

900 GB volume for only 1 day.

To recapitulate ->

If we have a 30 GB volume for 26 days, then we have used 26 GB-months of storage, which is 86.7% of the free tier limit of 30 GB-months.

This is the logic that applies to all the services. Actually it is charged per-second basis now.

Posted in AWS