Showing posts from 2018

How to enable directory listing in Nginx

Enabling the Nginx Directory Index Listing

If you are using Nginx web server and you want to display folder in Nginx by web you need to change "autoindex on; in your conf file", By default we can't open directory from Nginx web. 

Enable Directory listing : Open your nginx conf file and change.

server {         listen 80 default_server;         listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; autoindex on; #for enable directory listing          server_name _;
        location / { try_files $uri $uri/ =404;         }

Converting Your Private Keys Linux

How to generate .ppk file from .pem Linux command line.

Install puttygen command line tool to convert file.
$ apt-get install putty-tools  

After install puttygen, you need to run below command.
$ puttygen pemKey.pem -o ppkKey.ppk -O private

Run the puttygen command to convert a .ppk file into a .pem file.$ puttygen ppkkey.ppk -O private-openssh -o pemkey.pem

How to find kubernetes cluster token

Welcome to Linux guru, In this article i will explain you how to get kubernetes cluster token and certificate information by commands.

Connect your kubernetes cluster using glocud command to your local machine.

$ gcloud container clusters get-credentials clustername  --zone \ europe-west1-d --project projectname

Once your kubernetes cluster connected to your local machine, lets find out token and other information. You will need to find out secret first.

$ kubectl get secret
NAME                  TYPE                                  DATA      AGE

default-token-7Dghp   3         3d

Now, we will get token information using that secret which we got from above command.
$ kubectl -o json get secret default-token-7Dghp | jq -r \ '.data.token' | base64 -d
(Replace your secret in above command).
Token Output :  sdklwksdKLJJDKASKLFkljfasjflaskfjasjflasjflkjasdfjasjfklasfjasfasfjskjfjslfkjkljfaksjfkljfklasjfkjskfjlakflassjfakfjkKLJAKFJKAJjlkJAKLFJASLFJLSJ…

Install kubectl in linux

Kubectl is a kubernetes command line tool. You can deploy and manage application in kubernetes using kubectl.Using kubectl, you can inspect cluster resources; create, delete, and update components. Install Kubectl ubuntu/debian :sudo apt-get update && sudo apt-get install -y apt-transport-https curl -s | sudo apt-key add - echo "deb kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt-get update sudo apt-get install -y kubectl Install kubectl on Centos / Fedora :cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl= enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey= EOF yum install -y kubectl Install with snap on Ubuntu :$sudo snap install kubec…

How to reset gitlab root password

Login in your server with root access, then start ruby on rail consol and login.

Start Rubi consol using below command : 

gitlab-rails console production Wait until the console has loaded, you can search for email or username.
user = User.where(id: 1).first or
user = User.find_by(email: '')
You can change your password from below commands :
user.password = 'secret_pass'user.password_confirmation = 'secret_pass'
It’s important that you change both password and password_confirmation to make it work.
Don’t forget to save the changes.! Exit the console and try to login with your new password.

Create Cockroach DB database and user

Cockroach DB useful commands.
Here are some useful cockroach DB commands and steps to create a cockroach DB database and uses of cockroach DB database.
Create CockroachDB database :CREATE DATABASE cockroachdb; Create CockroachDB Database User :CREATE USER cockroachdb WITH PASSWORD 'vishal'; Grant Privileges on CockroachDB Databases :GRANT ALL ON DATABASE cockroachdb TO cockroachuser; GRANT ALL ON TABLE cockroachdb.* TO cockroachuser; Change cockroach db user password :ALTER USER vishal WITH PASSWORD 'newpassword'; Login to kubernetes deploy cockroach :psql 'postgresql://username@ip:26257?sslmode=allow' Import Cockroach db Dump :psql -p 26257 -h host -d database -U vishal < database.sql

Install Helm On Ubuntu

Helm is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources.

Here is the steps to install helm in Ubuntu 16.04 machine.

Download helm : 
$ wget

Untar the package : 
$ tar -xvf helm-v2.11.0-linux-amd64.tar.gz

Find "helm" from the directory and move it to given path.
$ mv linux-amd64/helm /usr/local/bin/helm

Verify helm version : 
$ helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}

Configure Zabbix Server and Agent

Zabbix is an open source software, where you can monitor your network and server infra. You can monitor your remote host with zabbix agent. In this article we will install and configure zabbix server and zabbix host on remote server and monitor it. We will use Ubuntu 16.04 for this project.
Install Apache, MysQl and PHP.

You will have to install LAMP in your Zabbix server. So first we will install Apache, Php and MysQl in zabbix server.
apt-get update apt-get install apache2 apt-get install mysql-server apt-get install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql
After install php we will have to change and configure local timezon in php configuration file.

vim /etc/php/PHP_VERSION/apache2/php.ini

[Date] ; date.timezone = 'Asia/Kolkata'
We will have to enable require APT repository to install Zabbix.

For Ubuntu 16.04 LTS:


dpkg -i zabbix-re…

Deploy Static Website using docker container

In this article we will learn how to deploy static website using docker container. we will use nginx for web server testing.

Create docker file : To deploy static website we will have to create one docker file to run website. in docker file we will add some text to perform tasks. copy the content below and paste in your docker file. Create directory called docker [you can create any]mkdir /docker Create docker file in to docker directory and add below context.vim dockerfile FROM nginx:alpine COPY . /usr/share/nginx/html save file. 1. it will download nginx latest from docker hub. 2. copy all context from working directory to /usr/share/nginx/html.touch index.html <h1>Hellow this is my website</h1> and save the file. Now we will build the docker image. from the build command it will execute each instruction which we have added in docker file. docker build -t mywebserver:v1 . Sending build context to Docker daemon 3.072 kB Step 1/2 : FROM nginx:alpine alpine: Pulling from…