Category Archives: Linux

Discover DevOps roles and learn Linux from basics to advanced at DevOpsRoles.com. Detailed guides and in-depth articles to master Linux for DevOps careers.

How To Deploy a React Application with Nginx on Ubuntu 21.04

#Introduction

In this tutorial, how to deploy a React Application using our own Ubuntu Server and Nginx. You can quickly deploy react Applications using the default Create React App build tool.

Prerequisites

  • VPS Ubuntu 21.04. I use Linode is Cloud Hosting High-performance SSD Linux servers.
  • Nginx: Lightweight and high-performance Web server or Reverse Proxy
  • On your local machine: you will need a development environment running node.js.
  • A registered domain name. And setup DNS records for your server.
    • An A record with your_domain pointing to your server’s public IP address.
    • An A record with www.your_domain pointing to your server’s public IP address.

Deploy a React Application with Nginx on Ubuntu 21.04

Your local machine

Step 1 — Creating a React Project

npx create-react-app react-deploy
cd react-deploy
npm start

Open a browser and navigate to http://localhost:3000.

How To Deploy a React Application with Nginx on Ubuntu 21.04

Step 2: Build production

npm run build

Your VPS

Step 3: Uploading build files to VPS

Use scp command uploading build files to /var/www/your_domain/html directory on VPS.

 scp -r ./build/* username@server_ip:/var/www/your_domain/html

For example, Nginx configure

I use SSL for the website as below:

root@localhost:~# cat /etc/nginx/conf.d/your_domain.conf
server {
        listen 80;
        #listen [::]:80 ipv6only=on;

        if ($host = www.your_domain) {
        return 301 https://$host$request_uri;
        }

        if ($host = your_domain) {
        return 301 https://$host$request_uri;
        }

        server_name www.your_domain your_domain;
        return 444;
        #return 301 https://$server_name$request_uri;


}



server {
        listen 443 ssl http2 ; # managed by Certbot
        listen [::]:443 ssl http2;
        server_name www.your_domain your_domain;

        root /var/www/your_domain/html;
        index  index.html index.htm;
        access_log off;
        error_log /var/www/your_domain/logs/error.log;

        location / {
        try_files $uri $uri/ /index.html;
        #try_files $uri /index.html;
             #index index.html index.htm;
        }
        location ~ ^/(scripts.*js|styles|images) {
           gzip_static on;
           expires 1y;
           add_header Cache-Control public;
           add_header ETag "";

          break;
        }

        #End Crontab

        gzip on;
        gzip_comp_level    5;
        gzip_min_length    256;
        gzip_proxied       any;
        gzip_vary          on;
        gzip_types
        application/atom+xml
        application/javascript
        application/json
        application/ld+json
        application/manifest+json
        application/rss+xml
        application/vnd.geo+json
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/opentype
        image/bmp
        image/svg+xml
        image/x-icon
        text/cache-manifest
        text/css
        text/plain
        text/vcard
        text/vnd.rim.location.xloc
        text/vtt
        text/x-component
        text/x-cross-domain-policy;
        # text/html is always compressed by gzip module
        #add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";

        add_header X-Frame-Options DENY;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";

        ###
        # Retrict bad bot and bad referer
        ###
        # Block HTTP method not include GET,HEAD,POST
        if ($request_method !~ ^(GET|HEAD|POST)$ ) {
            return 444;
        }

        # Block bad http_referer (link contain bad word)
    if ( $http_referer ~* (adult|babes|click|diamond|forsale|girl|jewelry|love|nudit|organic|poker|porn|poweroversoftware|sex|teen|webcam|zippo|replica|onload\.pw) ) {
            return 444;
         }
    ## Block download agents ##
         if ($http_user_agent ~* (LWP::Simple|BBBike|wget) ) {
            return 444;
         }

    location = /robots.txt  {
                                allow all;
                            }
    location ~ /.well-known {
                allow all;
     }
    location = /favicon.ico { access_log off; log_not_found off; expires 30d; }
    location ~ /\.          { access_log off; log_not_found off; deny all; }
    location ~ ~$           { access_log off; log_not_found off; deny all; }
    location ~ /\.git       { access_log off; log_not_found off; deny all; }
    location = /nginx.conf  { access_log off; log_not_found off; deny all; }
    location ~* /(?:uploads|files)/.*\.php$ { access_log off; log_not_found off; deny all; }
    location ~ /(readme.html|license.txt) { deny all; }
    location ~* \.(ogg|ogv|3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|svgz|ttf|woff|otf|rss|atom|ppt|midi|bmp|rtf)$ {
           gzip_static     off;
            #add_header      Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header Cache-Control "public, no-transform";
            access_log      off;
            log_not_found   off;
            expires         max;
            break;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            #add_header      Cache-Control "public, must-revalidate, proxy-revalidate";
            add_header Cache-Control "public, no-transform";
            access_log      off;
            log_not_found   off;
            expires         30d;
            break;
    }
    ssl_dhparam /etc/letsencrypt/dhparams.pem; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/your_domain/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/your_domain/privkey.pem; # managed by Certbot

}

Conclusion

You Deploy a React Application with Nginx on Ubuntu 21.04. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Remove orphaned packages on CentOS

Introduction

Discover how to remove orphaned packages on CentOS Linux in this detailed tutorial. Orphaned packages, which are remnants not needed for package dependencies, can clutter your system.

Learn the step-by-step process to clean up these unnecessary files effectively, enhancing your CentOS system’s performance and reliability. Orphaned packages are all packages that no longer serve the purpose of package dependencies.

List of Orphaned Packages

Use the package-cleanup command below

[root@centos7 ~]# package-cleanup --leaves
Loaded plugins: fastestmirror
cryptsetup-libs-1.7.4-3.el7_4.1.x86_64
libicu-50.2-4.el7_7.x86_64
libicu62-62.2-1.el7.remi.x86_64
libmemcached-1.0.16-5.el7.x86_64
libsysfs-2.1.0-16.el7.x86_64
libtool-ltdl-2.4.2-22.el7_3.x86_64
libunwind-1.2-2.el7.x86_64
libuv-1.40.0-1.el7.x86_64
libwebp-0.3.0-7.el7.x86_64

Remove Orphaned Packages

Now, we remove Orphaned packages using the yum remove command to remove the entire list:

yum remove `package-cleanup --leaves`

The output terminal is as below:

[root@centos7 ~]# yum remove `package-cleanup --leaves`
Loaded plugins: fastestmirror
No Match for argument: Loaded
No Match for argument: plugins:
No Match for argument: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package cryptsetup-libs.x86_64 0:1.7.4-3.el7_4.1 will be erased
---> Package libicu.x86_64 0:50.2-4.el7_7 will be erased
---> Package libicu62.x86_64 0:62.2-1.el7.remi will be erased
---> Package libmemcached.x86_64 0:1.0.16-5.el7 will be erased
---> Package libsysfs.x86_64 0:2.1.0-16.el7 will be erased
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be erased
---> Package libunwind.x86_64 2:1.2-2.el7 will be erased
---> Package libuv.x86_64 1:1.40.0-1.el7 will be erased
---> Package libwebp.x86_64 0:0.3.0-7.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================
 Package                                              Arch                                        Version                                                Repository                                      Size
==============================================================================================================================================================================================================
Removing:
 cryptsetup-libs                                      x86_64                                      1.7.4-3.el7_4.1                                        @updates                                       947 k
 libicu                                               x86_64                                      50.2-4.el7_7                                           @updates                                        24 M
 libicu62                                             x86_64                                      62.2-1.el7.remi                                        installed                                       31 M
 libmemcached                                         x86_64                                      1.0.16-5.el7                                           @base                                          677 k
 libsysfs                                             x86_64                                      2.1.0-16.el7                                           @anaconda                                      146 k
 libtool-ltdl                                         x86_64                                      2.4.2-22.el7_3                                         @base                                           66 k
 libunwind                                            x86_64                                      2:1.2-2.el7                                            @base                                          150 k
 libuv                                                x86_64                                      1:1.40.0-1.el7                                         @epel                                          378 k
 libwebp                                              x86_64                                      0.3.0-7.el7                                            @base                                          371 k

Transaction Summary
==============================================================================================================================================================================================================
Remove  9 Packages

Installed size: 57 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : libmemcached-1.0.16-5.el7.x86_64                                                                                                                                                           1/9
  Erasing    : 2:libunwind-1.2-2.el7.x86_64                                                                                                                                                               2/9
  Erasing    : 1:libuv-1.40.0-1.el7.x86_64                                                                                                                                                                3/9
  Erasing    : libicu-50.2-4.el7_7.x86_64                                                                                                                                                                 4/9
  Erasing    : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                                                         5/9
  Erasing    : libicu62-62.2-1.el7.remi.x86_64                                                                                                                                                            6/9
  Erasing    : libsysfs-2.1.0-16.el7.x86_64                                                                                                                                                               7/9
  Erasing    : cryptsetup-libs-1.7.4-3.el7_4.1.x86_64                                                                                                                                                     8/9
  Erasing    : libwebp-0.3.0-7.el7.x86_64                                                                                                                                                                 9/9
  Verifying  : libwebp-0.3.0-7.el7.x86_64                                                                                                                                                                 1/9
  Verifying  : cryptsetup-libs-1.7.4-3.el7_4.1.x86_64                                                                                                                                                     2/9
  Verifying  : libsysfs-2.1.0-16.el7.x86_64                                                                                                                                                               3/9
  Verifying  : libicu62-62.2-1.el7.remi.x86_64                                                                                                                                                            4/9
  Verifying  : libtool-ltdl-2.4.2-22.el7_3.x86_64                                                                                                                                                         5/9
  Verifying  : libicu-50.2-4.el7_7.x86_64                                                                                                                                                                 6/9
  Verifying  : 1:libuv-1.40.0-1.el7.x86_64                                                                                                                                                                7/9
  Verifying  : 2:libunwind-1.2-2.el7.x86_64                                                                                                                                                               8/9
  Verifying  : libmemcached-1.0.16-5.el7.x86_64                                                                                                                                                           9/9

Removed:
  cryptsetup-libs.x86_64 0:1.7.4-3.el7_4.1        libicu.x86_64 0:50.2-4.el7_7        libicu62.x86_64 0:62.2-1.el7.remi        libmemcached.x86_64 0:1.0.16-5.el7        libsysfs.x86_64 0:2.1.0-16.el7
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3            libunwind.x86_64 2:1.2-2.el7        libuv.x86_64 1:1.40.0-1.el7              libwebp.x86_64 0:0.3.0-7.el7

Complete!
[root@centos7 ~]#

Conclusion

Remove orphaned packages from CentOS systems is an essential step in maintaining the efficiency and stability of your server. Orphaned packages are remnants left behind after uninstalling software that no longer serve any functional purpose. By eliminating these unnecessary files, you can optimize system performance and prevent potential conflicts. This guide on DevopsRoles aims to assist you in cleaning up your CentOS installation effectively. We hope you find these instructions beneficial. Thank you for choosing DevopsRoles for your technological needs and for trusting us with your system optimization tasks. Your continued support inspires us to provide helpful and practical content.

How to call git bash command from powershell

Introduction

Combining PowerShell with Git Bash can enhance your productivity by allowing you to use Unix-like commands within a Windows environment. In this guide, we’ll show you how to call Git Bash commands from PowerShell, using an example script. We’ll cover everything from basic setups to advanced configurations. In this tutorial, How to call the git bash command from Powershell. For example, git bash content to split CSV files on windows :

Setting Up Your Environment

Installing Git Bash

First, ensure you have Git Bash installed on your system. Download it from the official Git website and follow the installation instructions.

Adding Git Bash to Your System PATH

To call Git Bash command from PowerShell, add Git Bash to your system PATH:

  1. Open the Start menu, search for “Environment Variables,” and select “Edit the system environment variables.”
  2. Click the “Environment Variables” button.
  3. Under “System variables,” find and select the “Path” variable, then click “Edit.”
  4. Click “New” and add the path to the Git Bash executable, typically C:\Program Files\Git\bin.

Call the git bash command from Powershell

Save the following script as split.sh in your K:/TEST directory:

#!/bin/bash
cd $1
echo split start
date
pwd
split Filetest.CSV Filetest -l 20000000 -d
ls -l
for filename in $1/*; do
    wc -l $filename
done
date
echo split end
exit

This script performs the following tasks:

  1. Changes the directory to the one specified by the first argument.
  2. Prints a start message and the current date.
  3. Displays the current directory.
  4. Splits Filetest.CSV into smaller files with 20,000,000 lines each.
  5. Lists the files in the directory.
  6. Counts the number of lines in each file in the directory.
  7. Prints the current date and an end message.
  8. Exits the script.

PowerShell Script

Create a PowerShell script to call the split.sh script:

$TOOL_PATH = "K:/TEST"
$FOLDER_PATH = "K:/TEST/INPUT"

$COMMAND = "bash.exe " + $TOOL_PATH + "/split.sh " + $FOLDER_PATH
echo $COMMAND
Invoke-Expression $COMMAND

This PowerShell script does the following:

  1. Defines the path to the directory containing the split.sh script.
  2. Defines the path to the directory to be processed by the split.sh script.
  3. Constructs the command to call the split.sh script using bash.exe.
  4. Prints the constructed command.
  5. Executes the constructed command.

Explanation

  1. $TOOL_PATH: This variable holds the path where your split.sh script is located.
  2. $FOLDER_PATH: This variable holds the path to the directory you want to process with the split.sh script.
  3. $COMMAND: This variable constructs the full command string that calls bash.exe with the script path and the folder path as arguments.
  4. echo $COMMAND: This line prints the constructed command for verification.
  5. Invoke-Expression $COMMAND: This line executes the constructed command.

Add C:\Program Files\Git\bin into the PATH environment

OK!

Troubleshooting

Common Issues and Solutions

  • Git Bash not found: Ensure Git Bash is installed and added to your system PATH.
  • Permission denied: Make sure your script has execute permissions (chmod +x split.sh).
  • Command not recognized: Verify the syntax and ensure you’re using the correct paths.
  • Incorrect output or errors: Print debugging information in your scripts to diagnose issues.

FAQs

How do I add Git Bash to my PATH variable?

Add the path to Git Bash (e.g., C:\Program Files\Git\bin) to the system PATH environment variable.

Can I pass multiple arguments from PowerShell to Git Bash?

Yes, you can pass multiple arguments by modifying the command string in the PowerShell script.

How do I capture the output of a Git Bash command in PowerShell?

Use the following approach to capture the output:

$output = bash -c "git status"
Write-Output $output

Can I automate Git Bash scripts with PowerShell?

Yes, you can automate Git Bash scripts by scheduling PowerShell scripts or using task automation features in PowerShell.

Conclusion

By following this guide, you can easily call Git Bash command from PowerShell, enabling you to leverage the strengths of both command-line interfaces. Whether you’re performing basic operations or advanced scripting, integrating Git Bash with PowerShell can significantly enhance your workflow. Thank you for reading the DevopsRoles page!

Mastering the lsof command example:Essential for Linux System Administration

Introduction

lsof command meaning “List open files“. This command will not find CentOS7/RHEL. We will install lsof command example as below:

$ sudo yum install lsof

In the realm of Linux administration, understanding the tools at your disposal is key to effective system management. The lsof command, which stands for “List Open Files”, is an indispensable utility that provides crucial visibility into the system’s file usage. By listing information about files opened by processes, lsof helps administrators manage resources, troubleshoot system issues, and ensure secure operations. This guide aims to demystify the lsof command through practical examples, enhancing your system management toolkit.

Basic Usage

lsof

This will display a list of all open files and the processes that are using them.

lsof command examples

List open files

$ lsof -n

Kill a process running on port 8443

$ lsof -i :8443 | awk '{print $2}' | tail -n 1 | xargs kill
# or
$ lsof -i :8443  | awk 'NR > 1 {print $2}' | xargs --no-run-if-empty kill

Show the 15 Largest Open Files in Linux.

$ lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB" " " $9 " " $1 }' | sort -n -u | tail -n 15

List User-Specific Opened Files. This will display a list of all open files that are being used by the specified user.

$ lsof -u huupv

Search by PID

$ lsof -p 1

Exclude User with ^ Character

$ lsof -i -u^root

List TCP Port ranges 8000-9000

$ lsof -i TCP:8000-9000

Conclusion

The lsof command is a powerful tool in the Linux administrator’s arsenal, offering deep insights into the system’s interaction with files. From tracking down process-specific files to managing system resources, lsof facilitates a wide range of administrative tasks.

By mastering its usage through the examples provided, you enhance your capabilities in system management, contributing to the overall efficiency and security of your operations. Dive into these examples to leverage lsof effectively, ensuring your Linux systems run smoothly and securely. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Guide to Install Python 3.6 on Centos 6

Introduction

OS Centos 6 is the default Python version 2. How to Install Python 3.6 on Centos 6. Python is a powerful and flexible programming language widely used in various fields such as web development, data science, artificial intelligence, and DevOps. Python 3.6 brings many improvements and new features, enhancing performance and security.

In this article, we will guide you through the process of installing Python 3.6 on CentOS 6, one of the popular Linux operating systems for server environments. This installation will allow you to take full advantage of Python 3.6 in your projects.

Installation packages pre-requisites

sudo yum -y install gcc openssl-devel bzip2-devel wget

How to Install Python 3.6 on Centos 6

cd /tmp/
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
tar xzf Python-3.6.6.tgz
cd Python-3.6.6
./configure --enable-optimizations
sudo make altinstall

Create symbolic link

sudo ln -sfn /usr/local/bin/python3.6 /usr/bin/python3.6

Python verifying new version.

[huupv2@server1 ~]$ python -V
Python 3.6.6

The result is Python 3.6 on Centos 6.

[huupv2@server1 ~]$ cat /etc/redhat-release
CentOS release 6.5 (Final)
[huupv2@server1 ~]$ ll /usr/bin/python*
-rwxr-xr-x 2 root root 4864 Aug 18  2016 /usr/bin/python
lrwxrwxrwx 1 root root    6 Jul 19  2018 /usr/bin/python2 -> python
-rwxr-xr-x 2 root root 4864 Aug 18  2016 /usr/bin/python2.6
lrwxrwxrwx 1 root root    9 Mar  8 13:26 /usr/bin/python3 -> python3.4
-rwxr-xr-x 2 root root 6088 Oct  5  2019 /usr/bin/python3.4
-rwxr-xr-x 2 root root 6088 Oct  5  2019 /usr/bin/python3.4m
lrwxrwxrwx 1 root root   24 Mar  8 14:45 /usr/bin/python3.6 -> /usr/local/bin/python3.6

Configure alias python on .bashrc file

[huupv2@server1 ~]$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
alias python='/usr/bin/python3.6'

Check Python version 3.6 on Centos 6

[huupv2@server1 ~]$ python
Python 3.6.6 (default, Mar  8 2021, 14:41:43)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[huupv2@server1 ~]$

Conclusion

You have to install Python 3.6 on Centos 6. Installing Python 3.6 on CentOS 6 may present some challenges, but with this detailed guide, you can easily accomplish it. Python 3.6 will open up many new opportunities for your projects, from web application development to data processing and automating DevOps workflows.

We wish you success in installing and leveraging the full potential of Python 3.6 on CentOS 6. If you encounter any difficulties, don’t hesitate to contact us or refer to community support resources. I hope will this your helpful. Thank you for reading the DevopsRoles page!

JIRA installing and configure on CentOS

Introduction

How to install and configure jira on Centos. Installing and configuring JIRA on CentOS involves a series of systematic steps to set up this popular project management tool effectively. Begin by preparing your CentOS system with the necessary prerequisites, including Java. Then, download and install the JIRA software from Atlassian’s official site. Configuration involves setting up a database, typically PostgreSQL or MySQL, and adjusting the JIRA setup wizard to connect to your newly prepared database. This process ensures that JIRA runs smoothly on CentOS, providing a robust platform for managing your projects. Now, let’s proceed with the JIRA installation and configuration on CentOS.

JIRA installing

Install Java

[vagrant@DevopsRoles ~]$ sudo yum install java-1.8.0-openjdk*

Install MySQL on Centos 7

Link refers to installing MySQL here.

Create a user for installation jira.

[vagrant@DevopsRoles ~]$ sudo useradd jira
[vagrant@DevopsRoles ~]$ sudo passwd jira
[vagrant@DevopsRoles ~]$ echo "jira ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
[vagrant@DevopsRoles ~]$ su -l jira
Password:
[jira@DevopsRoles ~]$

Create a temporary install directory:

[jira@DevopsRoles ~]$ mkdir jira && cd jira

Download jira

Link download here:

[jira@DevopsRoles jira]$ wget https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.13.4-x64.bin
[jira@DevopsRoles jira]$ ls -l
total 399948
-rw-rw-r--. 1 jira jira 409545222 Feb 15 11:02 atlassian-jira-software-8.13.4-x64.bin
[jira@DevopsRoles jira]$ chmod u+x atlassian-jira-software-8.13.4-x64.bin
[jira@DevopsRoles jira]$ ./atlassian-jira-software-8.13.4-x64.bin

The result is as follows:

[jira@DevopsRoles jira]$ ./atlassian-jira-software-8.13.4-x64.bin
Unpacking JRE ...
Starting Installer ...
You do not have administrator rights to this machine and as such, some installation options will not be available. Are you sure you want to continue?
Yes [y, Enter], No [n]
y

This will install Jira Software 8.13.4 on your computer.
OK [o, Enter], Cancel [c]
o
Click Next to continue, or Cancel to exit Setup.

Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing Jira installation [3]
1

Details on where Jira Software will be installed and the settings that will be used.
Installation Directory: /home/jira/atlassian/jira
Home Directory: /home/jira/atlassian/application-data/jira
HTTP Port: 8080
RMI Port: 8005
Install as service: No
Install [i, Enter], Exit [e]
i

Extracting files ...


Please wait a few moments while Jira Software is configured.

Installation of Jira Software 8.13.4 is complete
Start Jira Software 8.13.4 now?
Yes [y, Enter], No [n]
y

Please wait a few moments while Jira Software starts up.
Launching Jira Software ...

Installation of Jira Software 8.13.4 is complete
Your installation of Jira Software 8.13.4 is now ready and can be accessed
via your browser.
Jira Software 8.13.4 can be accessed at http://localhost:8080
Finishing installation ...
[jira@DevopsRoles jira]$

JIRA’s directory structure looks like this:

[jira@DevopsRoles jira]$ cd ../
[jira@DevopsRoles ~]$ ls -l
total 0
drwxrwxr-x. 4 jira jira 42 Feb 22 14:19 atlassian
drwxrwxr-x. 2 jira jira 52 Feb 22 14:20 jira
[jira@DevopsRoles ~]$ tree -d -L 3 atlassian/
atlassian/
├── application-data
│   └── jira
│       ├── caches
│       ├── data
│       ├── export
│       ├── import
│       ├── log
│       ├── plugins
│       └── tmp
└── jira
    ├── atlassian-jira
    │   ├── aui-examples
    │   ├── decorators
    │   ├── func
    │   ├── images
    │   ├── includes
    │   ├── META-INF
    │   ├── portlets
    │   ├── secure
    │   ├── static
    │   ├── static-assets
    │   ├── styles
    │   ├── template
    │   ├── templates
    │   ├── ui
    │   ├── views
    │   └── WEB-INF
    ├── bin
    ├── conf
    │   └── Catalina
    ├── external-source
    ├── jre
    │   ├── bin
    │   ├── lib
    │   └── man
    ├── lib
    ├── licenses
    ├── logs
    ├── temp
    ├── tomcat-docs
    ├── webapps
    └── work
        └── Catalina

43 directories
[jira@DevopsRoles ~]$

Go to JIRA Installation Directory:

[jira@DevopsRoles ~]$ cd ~/atlassian/jira/
[jira@DevopsRoles jira]$ sudo ./bin/start-jira.sh

start-jira.sh and stop-jira.sh in folder bin

Check JIRA should already be running.

[jira@DevopsRoles jira]$ ps ux | grep jira | grep java | grep -v grep
jira      3184 10.8 24.0 4971344 358732 pts/0  Sl   14:20   0:29 /home/jira/atlassian/jira/jre//bin/java -Djava.util.logging.config.file=/home/jira/atlassian/jira/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms384m -Xmx2048m -XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m -Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Dorg.dom4j.factory=com.atlassian.core.xml.InterningDocumentFactory -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT -Datlassian.plugins.startup.options= -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Xloggc:/home/jira/atlassian/jira/logs/atlassian-jira-gc-%t.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20M -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCCause -XX:+ExplicitGCInvokesConcurrent -Dignore.endorsed.dirs= -classpath /home/jira/atlassian/jira/bin/bootstrap.jar:/home/jira/atlassian/jira/bin/tomcat-juli.jar -Dcatalina.base=/home/jira/atlassian/jira -Dcatalina.home=/home/jira/atlassian/jira -Djava.io.tmpdir=/home/jira/atlassian/jira/temp org.apache.catalina.startup.Bootstrap start

[vagrant@DevopsRoles ~]$ sudo netstat -nplt | grep 8080
tcp6       0      0 :::8080                 :::*                    LISTEN      3184/java

Create user MySQL

mysql -u root -p 
mysql> CREATE DATABASE jiradb CHARACTER SET utf8 COLLATE utf8_bin;
mysql> CREATE USER 'jiradb'@'localhost' IDENTIFIED BY 'Abc123!@#';
mysql> GRANT ALL PRIVILEGES ON jiradb.* TO 'jiradb'@'localhost' WITH GRANT OPTION;

we need a JDBC connector driver for MySQL

[jira@DevopsRoles ~]$ cd && mkdir tmp
[jira@DevopsRoles ~]$ cd tmp/
[jira@DevopsRoles tmp]$ wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.29.tar.gz
[jira@DevopsRoles tmp]$ tar xfp mysql-connector-java-5.1.29.tar.gz
[jira@DevopsRoles tmp]$ find mysql-connector-java-5.1.29 -name "mysql-connector-java-*-bin.jar"
mysql-connector-java-5.1.29/mysql-connector-java-5.1.29-bin.jar
[jira@DevopsRoles tmp]$ cp mysql-connector-java-5.1.29/mysql-connector-java-5.1.29-bin.jar ~/atlassian/jira/lib/
[jira@DevopsRoles tmp]$ cd

Restart JIRA

$ sudo ./atlassian/jira/bin/stop-jira.sh
$ sudo ./atlassian/jira/bin/start-jira.sh

Access Browser Jira

Conclusion

JIRA installing and configuring on CentOS. I hope will this your helpful. Thank you for reading the DevopsRoles page!

Install Apache cassandra on Centos 6

#Introduction

In this tutorial, How To Install Apache cassandra on Centos 6. Apache Cassandra is a NoSQL database for storing large amounts of data in a decentralized, high availability server cluster.

Step 1: Install Java

I will install Oracle java 7 instead of OpenJDK. Link download Oracle Java 7 here

rpm -ivh /home/huupv/jdk-7u79-linux-x64.rpm

I find both executable files – OpenJDK and Oracle:

find / -name "java" -type f

Check java version

java -version

Setting up the default JDK

alternatives --config java

Step 2: Install Apache cassandra

Cassandra will be installed from the Datastax repository. Create a repository file:/etc/yum.repos.d/datastax.repo

[datastax]
name = DataStax Repo for Apache Cassandra
baseurl = http://rpm.datastax.com/community
enabled = 1
gpgcheck = 0

Find the version

yum list dsc2*

Install

yum install dsc21

Start and add to the auto-launch:

service cassandra start
chkconfig cassandra on

Check

cqlsh
nodetool status

Conclusion

You have to Install Apache Cassandra on Centos 6. I hope will this your helpful. Thank you for reading the DevopsRoles page!

How to automatically mount a SMB/CIFS Share on CentOS

Introduction

In this tutorial, How to automatically mount a SMB/CIFS Share on CentOS.

Prerequisite

Install necessary packages

yum install samba-client samba-common

Automatically mount a SMB/CIFS Share on CentOS

Install the Automounter

yum install autofs

Create a mount point

mkdir /data/cifs_share

Add an entry to the file /etc/auto.master, as follow:

/data/cifs_share /etc/auto.cifs  --timeout=600 --ghost

create the file /etc/auto.cifs:

share_data -fstype=cifs,rw,noperm,credentials=/etc/credentials.txt
    ://<Host Name>/<Folder Name>

Create /etc/credentials.txt file

username=DOMAIN/User
password=PASSWORD

Secure the credentials.txt file

chmod 0700 /etc/credentials.txt

Restart the automounter service

/etc/init.d/autofs restart

Confirm that the mount is being accessed correctly

mount

Conclusion

You have automatically mounted an SMB/CIFS Share on CentOS. I hope will this your helpful. Thank you for reading the DevopsRoles page!

How to install let’s Encrypt SSL on CentOS 7

#Introduction

In this tutorial, How to install Let’s Encrypt SSL on CentOS 7. Let’s Encrypt is a free, automated TLS/SSL certificate web server. In the previous post, I have installed Let’s Encrypt SSL on Centos 6 here.

Prerequisite

yum install -y epel-release mod_ssl

How to install Let’s Encrypt SSL on CentOS 7

yum install -y certbot

Generate a SSL certificate

sudo certbot certonly \
--manual \
--agree-tos \
--preferred-challenges=dns \
--server https://acme-v02.api.letsencrypt.org/directory \
--email huupv@devopsroles.com \
--domains devopsroles.com

Certificated will be available under the folder: /etc/letsencrypt/live/devopsroles.com

/etc/letsencrypt/live/devopsroles.com/fullchain.pem
/etc/letsencrypt/live/devopsroles.com/privkey.pem

Create SystemD service for certbot.service. New file /etc/systemd/system/certbot.service

[Unit]
Description=Renew Let's Encrypt certificates
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --renew-hook "/bin/systemctl --no-block reload nginx" --quiet --agree-tos

Create SystemD service for certbot.timer. New file /etc/systemd/system/certbot.timer

[Unit]
Description=Daily renewal of Let's Encrypt's certificates

[Timer]
OnCalendar=daily
RandomizedDelaySec=1day
Persistent=true

[Install]
WantedBy=timers.target

Start and enable certbot.timer

systemctl daemon-reload
systemctl start certbot.timer
systemctl enable certbot.timer

List service certbot timer as follow

systemctl list-timers certbot.timer

Conclusion

You have installed Let’s Encrypt SSL on CentOS 7. I hope will this your helpful. Thank you for reading the DevopsRoles page!

How to install Let’s Encrypt SSL on CentOS 6

#Introduction

In this tutorial, How to install Let’s Encrypt SSL on CentOS 6. Let’s Encrypt is a free, automated TLS/SSL certificate web server.

Prerequisite

Your server has installed a Web server If it’s not then you can use the command to install a web server

For Nginx

# yum install nginx

For Apache

# yum install httpd mod_ssl

Install LetsEncrypt on Centos 6

curl -o /usr/local/sbin/certbot-auto https://dl.eff.org/certbot-auto
chmod a+x /usr/local/sbin/certbot-auto

Generate a SSL certificate

sudo /usr/local/sbin/certbot-auto certonly \
--manual \
--agree-tos \
--preferred-challenges=dns \
--server https://acme-v02.api.letsencrypt.org/directory \
--email huupv@devopsroles.com \
--domains devopsroles.com

certificated will be available under the folder: /etc/letsencrypt/live/devopsroles.com

/etc/letsencrypt/live/devopsroles.com/fullchain.pem
/etc/letsencrypt/live/devopsroles.com/privkey.pem

Setup a cron job for Let’s Encrypt SSL

# Setting up crontab
crontab -e

# Append the below line to the end of crontab
0 0 * * * /usr/local/sbin/certbot-auto renew --renew-hook "/sbin/service nginx reload" --quiet --agree-tos

HOW TO SETUP NGINX TO USE SSL WITH LETSENCRYPT

For example, as follow

server {
 listen 443;
 ssl on;
 server_name devopsroles.com;
 ssl_certificate /etc/letsencrypt/live/devopsroles.com/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/devopsroles.com/privkey.pem;
 root /etc/nginx/html;
 
}

Conclusion

You have installed Let’s Encrypt SSL on CentOS 6. I hope will this your helpful. Thank you for reading the DevopsRoles page!