Friday, April 13, 2018

How can I enable root ssh access in EC2

My requirement is, I need to disable the key authentication and I need to enable root ssh access to my AWS EC2 server.

How can I do that?

Login to your EC2 server with key authentication first
vim /etc/ssh/sshd_config
Disable - PermitRootLogin forced-commands-only and update the same with PermitRootLogin yes
Disable - #PermitEmptyPasswords no and update the same with PasswordAuthentication yes

/etc/init.d/sshd restart

Give root a good password.

Try to login with SSH and given root password.

Wednesday, April 11, 2018

Jenkins Error:ERROR: Error cloning remote repo 'origin'

In my Jenkins job, I am getting the following error

ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /home/ec2-user/local-jenkins/workspace/vpc_terraform
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(
 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$
 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$
 at hudson.remoting.UserRequest.perform(
 at hudson.remoting.UserRequest.perform(
 at hudson.remoting.Request$
 at hudson.remoting.InterceptingExecutorService$
 at java.util.concurrent.ThreadPoolExecutor.runWorker(
 at java.util.concurrent.ThreadPoolExecutor$
I was trying to checkout/download a repository from gitlab. I have given the repo name, credentials and branch.


Go to the node where it is going to run (Slave node configuration)
Under Check Tool Locations under Node Properties 
Select Git and input the location of git (which git)
Save and reconnect the slave again.


Monday, April 2, 2018

mysql daemon failed to start in amazon linux

mysql daemon failed to start in amazon linux.

I could see that all the configurations and everything is fine and it was working fine.


Issue was with there is not free swap memory on the server. You need to add manually a swap file to fix the issue.

Login to the server

# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
# chown root:root /swapfile1
# chmod 0600 /swapfile1
# mkswap /swapfile1
# swapon /swapfile1
# vi /etc/fstab
Add the following at the last
/swapfile1 none swap sw 0 0
Save the file
$ free -m

Now try to start mysqld service.

Saturday, March 31, 2018

No valid instance types found

When I try to launch an instance from a private AMI, I am getting the error

"No valid instance types found" 

The image was created from a snapshot.

Solution : 

Virtualization type by default is Paravirtual, you need to change that type to Hardware-assisted virtualization while creating image from EBS. This will help to fix that error.

authorization failed in subversion

Error : authorization failed in subversion, when checkout the repo.

Login to svn server
Open svnserve.conf
Uncomment the line "authz-db=authz"

Now check, it should work.

Monday, February 26, 2018

Error: Package: php-gd-5.4.45-13.el6.remi.x86_64 (remi)

Error : Package: php-gd-5.4.45-13.el6.remi.x86_64 (remi)

The error happen after I upgraded PHP from 5.3 to 5.6. Then when i tried to install php-gd I am seeing this error.


yum --enablerepo=remi,remi-php56 install php-gd

The above end up in another error:

Error: Package: gd-last-2.2.5-1.el6.remi.x86_64 (remi)
Request: () (64bit)


It seems that you are requesting libwebp, so just install libwebp from epel

If you have not installed epel yet,

yum install epel-release -y
yum update

Install libwebp

yum install libwebp --enablerepo=epel -y

Install php-gd

yum install php-gd  --enableablepo=remi 

It will works!


How to Upgrade PHP 5.3 to PHP 5.6 on CentOS

Here we are upgrading PHP 5.3 to PHP 5.6 on CentOS.

 1. Confirm the current version: php -v

PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

 2. Install the Remi and EPEL RPM repositories

If you haven’t already done so, install the Remi and EPEL repositories

wget && rpm -Uvh epel-release-latest-6.noarch.rpm

wget && rpm -Uvh remi-release-6*.rpm

3. Enable the REMI repository globally:

vi /etc/yum.repos.d/remi.repo

Under the section that looks like [remi] and [remi-php56] change the following

enabled=0 to enabled=1

4. Upgrade PHP 5.3 to PHP 5.6

yum -y upgrade php*

let’s verify that you have PHP 5.6 installed:

 php -v

PHP 5.6.14 (cli) (built: Sep 30 2015 14:07:43)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Thursday, February 22, 2018

Error when starting Docker from Jenkins


Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.27/images/json: dial unix /var/run/docker.sock: connect: permission denied

I am running jenkins as a user 'myuser'

Solution :

usermod -a -G root myuser
service jenkins restart


Tuesday, February 20, 2018

Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Docker Error : Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

[root@sv23 ~]# docker build -t my-apache2 .
Sending build context to Docker daemon 64.16 MB
Step 1/1 : FROM httpd:2.4
Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
[root@sv23 ~]# 

When I build a dockerfile, I am getting the above error.

How we can fix this?

1. Login to host.
2. mkdir -p /etc/systemd/system/docker.service.d
3. /etc/systemd/system/docker.service.d/http-proxy.conf
4. Add the following line
5. systemctl daemon-reload
6. systemctl restart docker
7. systemctl show --property=Environment docker

Try the build now, it will works!

[root@sv23 ~]#  docker build -t my-apache2 .
Sending build context to Docker daemon 64.16 MB
Step 1/1 : FROM httpd:2.4
2.4: Pulling from library/httpd
4176fe04cefe: Pull complete
d6c01cf91b98: Pull complete
b7066921647a: Pull complete
643378aaba88: Pull complete
3c51f6dc6a3b: Pull complete
4f25e420c4cc: Pull complete
ccdbe37da15c: Pull complete
Digest: sha256:6e61d60e4142ea44e8e69b22f1e739d89e1dc8a2764182d7eecc83a5bb31181e
Status: Downloaded newer image for httpd:2.4
 ---> 01154c38b473
Successfully built 01154c38b473
[root@sv23 ~]#


Tuesday, January 2, 2018

Starting frontend GLOBAL: cannot bind UNIX socket [/var/run/haproxy/admin.sock]

Haproxy Error: 
 [WARNING] 000/231555 (73783) : Can't open server state file '/var/state/haproxy/global': No such file or directory
Starting frontend GLOBAL: cannot bind UNIX socket [/var/run/haproxy/admin.sock]

How to fix this:

Login to the server
mkdir -p  /var/run/haproxy/
Start haproxy service

It works.  

Haproxy needs to write to /var/run/haproxy/admin.sock but it wont create the directory for you. Create the directory /var/run/haproxy