Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, April 4, 2023

How to clone VMs on VMware ESXi

In This blog we will learn how to clone VMs or Servers in VMware ESXi.If we don't have vCenter, VMware ESXi allow us to clone VMs / Servers on its web-interface.

 In this process it will take a little time to copy and clone the VMss.

 Note: Before processing further, Please take the snapshot backup and turn off the target VM / Server.

1. Access vSphere web-client, Click Storage in the left side, and then click Datastore browser.


2. In popup Click on create a folder for example: "dev-clone" and provide any name to copy the data there.

3. Folder is created, Now we will copy the data,

4. Select the folder which you want to clone the VM and select the .vmx file and .vmdk file and click on copy tab and copy it in to newly created folder dev-clone.

Complete this copy process one by one .vmx file and .vmdk file

It will take little time to copy depends on your data size.


If successfully copied now we can move next process to created clone VM.

Now we will created VM from copied folder.

5. On dashboard Click Virtual Machine and Click Create/ Register VM.


6. On select Creation type page, select Register an existing virtual machine, and Click Next.


7. Now on select VMs for registration, click Select one or more virtual machines, a datastore or a directory. 
Select the newly created folder dev-clone where we have copied the data. Click Next and Finish.


8. 
Back to Virtual Machines, now you can see there is one newly Created VM with the same name as the old one. That’s because the name comes from the .vmx file. You can right-click the VM and Rename it.
9. Now you can power on the newly created VM. while you powering on there will be a popup window select I copied  click Finish/Answer.

We have successfully clone VM in VMware ESXi on web Client.

Thanks for the reading my Blog.





Monday, March 27, 2023

Let’s Encrypt SSL Certificate in Linux Nginx.



Let’s Encrypt is a free and open certificate authority developed by the Internet Security Research Group (ISRG). Certificates issued by Let’s Encrypt are trusted by almost all browsers today.

Prerequisites.

  1. You have a domain name pointing to your public server IP. In this tutorial, we will use nazitech.com.
  2. You have enabled the EPEL repository and installed Nginx.

Step-1 Install Certbot.

To install the certbot package form the EPEL repository run.

Before installing certboat install python and python-pip.

sudo apt-get install python
sudo apt-get install python-pip
sudo apt-get install certbot

Now install certbot Nginx plugin.

python3.6 -m pip install certbot-nginx
or
apt-get install python-certbot-nginx

You can now run Certbot with the Webroot plugin and obtain the SSL certificate files for your domain by issuing:

certbot --nginx -d nazitech.com -d www.nazitech.com

If the SSL certificate is successfully obtained, certbot will print the following message:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/nazitech.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/nazitech.com/privkey.pem
   Your cert will expire on 2018-06-11. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:
   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF: https://eff.org/donate-le

Now that you have the certificate files. You can edit your Nginx conf file.

/etc/nginx/nginx.conf

server {
    listen 80;
    server_name www.example.com example.com;
}
server {
     listen 443 ssl http2;
     server_name  172.16.0.36;
     ssl_certificate /etc/letsencrypt/live/nazitech.com/fullchain.pem;
     ssl_certificate_key /etc/letsencrypt/live/nazitech.com/privkey.pem;
     ssl_trusted_certificate /etc/letsencrypt/nazitech.com/chain.pem;
     ssl_dhparam /etc/ssl/certs/dhparam.pem;
location / {
     proxy_pass http://ywebsite.co.in;
     proxy_http_version 1.1;
       }
}

Don’t forget to add Proxy_HTTP_version in the location line.

Restart Nginx service and check.

sudo systemctl restart nginx

Thnaks..!!

Thursday, November 17, 2022

Nginx Error 413, Request Entity Too Large

What is 413 Error?

413 HTTP error occurs when the size of a client’s request exceeds the server’s file size limit. This happens when a client attempts to upload a large file to a Nginx server.


Let's fix this.

The directive which determines what the allowable HTTP request size can be is client_max_body_size. You can add that directive in either an http, server, or location block in nginx.conf file located at /etc/nginx/nginx.conf.

server {
    client_max_body_size 100M; #As much as you can set according to your use case.
    ...
}

Wednesday, September 7, 2022

How to Install and Configure Nginx proxy pass on centos



Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. The software was created by Igor Sysoev and first publicly released in 2004.

This tutorial will teach you how to install and start Nginx on your CentOS server.

Step-1 Add Nginx Repository.

$sudo yum install epel-release

Step-2 Install Nginx.

$sudo yum install nginx

Step-3 Start Nginx service.

After installation Nginx, use the below commands to start and enable the Nginx service.

$sudo systemctl start nginx

$sudo systemctl enable nginx

Check the status of the Nginx service with the following command.

$sudo systemctl status nginx

The output should look something like this.

nginx.service - The nginx HTTP and reverse proxy server

  Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)

  Active: active (running) since Mon 2018-03-12 16:12:48 UTC; 2s ago

  Process: 1677 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)

  Process: 1675 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)

  Process: 1673 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Main PID: 1680 (nginx)

  CGroup: /system.slice/nginx.service

          ├─1680 nginx: master process /usr/sbin/nginx

          └─1681 nginx: worker process


If you are running a firewall, allow HTTP “80” and HTTPS “443” traffic, run the below commands.

$sudo firewall-cmd --permanent --zone=public --add-service=http 

$sudo firewall-cmd --permanent --zone=public --add-service=https

$sudo firewall-cmd --reload

Step-4 Verify installation.

To verifying the Nginx installation open your browser and type http://YOUR_SERVER_IP 

You will see the default Nginx welcome page as shown in the image below.


Configure the reverse proxy Nginx.

Open Nginx configuration file in your choice editor.

$sudo vim /etc/nginx/nginx.conf

Configure your setting as an example given below and save & exit.

server {

      listen 443 ssl http2;

      server_name  172.16.x.x #Domain name or IP

location / {

       proxy_pass http://bizdirect-coupons-async.172.16.1.0.nip.io; #Where you want to redirect your request localy. 

             proxy_http_version 1.1;

        }

}

server {

      listen 80;

      server_name  172.16.x.x; # Put Domain name or IP here.

location / {

       proxy_pass http://bizdirect-coupons-async172.16.1.0.nip.io; #Where you want to redirect your request localy.

             proxy_http_version 1.1;

        }

}

Restart Nginx service.

$sudo systemctl restart nginx

Conclusion.

Congratulations, you have successfully installed Nginx on your CentOS server.

You’re now ready to start deploying your applications and use Nginx as a web or proxy server.

Wednesday, June 29, 2022

Jenkins, Backup server setup. If master crash.

 

In this blog we will restore Jenkins backup in a new Jenkins server. where you can restore you previous or existing Jenkins backup in to a new Jenkins server. 

To complete this process you should have Jenkins backup with you.


>> Let's start.<< 

First we need to setup a new server and install Jenkins on it.


Now restore the old Jenkins backup to the new server under /$JENKINS_HOME folder /var/lib/Jenkins.

Create SSH secret file in Jenkins home directory with command ssh-keygen

Put SSH public key “id_rsa.pub” key into GitLab ssh-key-access settings.

And also put the public key “id_rsa.pub” key into the deployment server for communication between the Jenkins server to the deployment server.

Note: White list the new Jenkins server public IP for Gitlab server and deployment servers on AWS or respective cloud.



Wednesday, February 17, 2021

Update Centos Kernel 3.10 to 5.13 or latest

 Update Centos Kernel 3.10 to 5.13 or latest

In this tutorial, I will show you how to upgrade the CentOS 7 kernel to the latest version. We will use a precompiled kernel from the ELRepo repository. By default CentOS 7 uses kernel 3.10. In this manual, we will install the latest stable kernel version 5.0.11.

What we will do:

  1. Update and Upgrade CentOS 7
  2. Checking the Kernel Version
  3. Add ELRepo Repository
  4. Install New Kernel Version
  5. Configure Grub2

Step 1 — Update and Upgrade CentOS 7 and install the plugin


#yum -y update
#yum -y install yum-plugin-fastestmirror

Step 2 — Checking the Kernel Version

We will use CentOS 7.6 with default kernel 3.10. Check your CentOS version with commands below.

#cat /etc/redhat-release
#cat /etc/os-release
#uname -snr

Step 3 — Add ELRepo Repository


Before installing the new kernel version, we need to add a new repository — the ELRepo repository.

Add ELRepo gpg key to the system.

#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
#rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

When it’s complete, check all repository enabled on the system, and make sure ELRepo is on the list.

#yum repolist

Step 4 — Install New CentOS Kernel Version

In this step, we will install a new latest kernel from ELRepo repository, kernel version 5.0.11 — the Latest stable version on kernel.org.

Install the ELRepo kernel version with the yum command below.

#yum --enablerepo=elrepo-kernel install kernel-ml


Step 5 — Configure Grub2 on CentOS 7

At step 4, we’ve already installed a new kernel 5.0.11 to the system. Now, I will show you how to configure the default kernel version to load when the system is starting.

Check all available kernel versions in the Grub2 with awk command below.


#awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

You see that we have two kernel versions — 3.10 and 5.0.11.

Now we want to configure the default kernel that will run when the system is starting. We will use kernel 5.0 as our default, so you can use the command below to set it up.

#sudo grub2-set-default 0

0 — it’s from the awk command on the top. Kernel 5.0.11 = 0, and Kernel 3.10 = 1. When you want to back to the old kernel, you can change the value of the grub2-set-default command to 1.

Next, generate the grub2 config with ‘gurb2-mkconfig’ command, then reboot the server.

#sudo grub2-mkconfig -o /boot/grub2/grub.cfg
#sudo reboot

Login to the server again, and check current kernel version.

#uname -snr

DONE….!!!

What is DevOps? DevOps Kya hai?

DevOps is not a tool or a software. DevOps simply is a hassle free process to implement, develop and deliver the product to client. It'...