March 2020 - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Monday, March 30, 2020

How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04 64-bit
    RAM: Minimum 2 GB RAM, 8 GB RAM recommended
    Harddisk Space: 1.5 GB hard disk space, 5 GB + at least 1 GB for caches
    CPU: 2
    screen resolution: 1024x768 minimum
    Download Size : 774MB

Offically Website of IntelliJ IDEA
https://www.jetbrains.com/idea/download/#section=linux

Offically Website of jetbrains
https://www.jetbrains.com/toolbox-app/

    IntelliJ IDEA Community Edition (Free)
    IntelliJ IDEA Ultimate Edition (Paid version with extra features)
    IntelliJ IDEA Educational (Ultimate Edition but free for students and faculty members)

Method 1
Install using the Snap
Installing IntelliJ IDEA community Edition
Step1 :- sudo snap install intellij-idea-community --classic

Installing IntelliJ IDEA Educational Edition
Step1 :- sudo snap install intellij-idea-educational --classic

Installing IntelliJ IDEA Ultimate Edition 30Day
Step1 :- sudo snap install intellij-idea-Ultimate --classic

After Successful Installation
Step2 :- intellij-idea-community

Method 2
Install using the Toolbox App
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.16.6319.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf jetbrains-toolbox-1.16.6319.tar.gz -C /opt

Need to Register in IntelliJ IDEA
  

Method 3
Using Official Package or Standalone installation of community or Ultimate Edition
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/idea/ideaIU-2019.3.4.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf ideaIU.tar.gz -C /opt

How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

Offically Website of GitHub
https://github.com/git/git

Offically Website of Git
https://git-scm.com/downloads

Method 1
Installing Git
Step1 :- sudo apt update
Step2 :- sudo apt install git  OR  sudo apt-get install git-gui

Verify
Step3 :- git --version

Method 2
Installing Git from Source
Step1 :- sudo apt update
Step2 :- sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Step3 :- cd /tmp  OR  cd /usr/src/
Step4 :- sudo wget https://github.com/git/git/archive/v2.26.0.zip -O git.zip  
      OR sudo wget https://github.com/git/git/archive/v2.26.0.tar.gz -O git.tar.gz    
Step5 :- sudo unzip git.zip
      OR sudo tar -xf git.tar.gz
Step6 :- cd git-*
Step7 :- sudo make prefix=/usr/local all
Step8 :- sudo make prefix=/usr/local install
 
ERROR
cache.h:21:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.
Makefile:2387: recipe for target 'fuzz-commit-graph.o' failed
make: *** [fuzz-commit-graph.o] Error 1

SOLUTIONS   
Step1 :- sudo apt-get install libz-dev
Step2 :- sudo apt install zlib1g-dev

Step9 :- git --version

Clone the Git
Step10 :- cd ~
Step11 :- git clone https://github.com/git/git.git  OR  git clone https://github.com/git/git
Step12 :- cd git
Step13 :- sudo make prefix=/usr/local all
Step14 :- sudo make prefix=/usr/local install

Configuring Git
Step15 :- git config --global user.name "Cloud Network"
Step16 :- git config --global user.email "itcloudnet@gmail.com"

Verify
Step17 :- git config --list

configuration file of Git
Step18 :- nano ~/.gitconfig

Sunday, March 29, 2020

How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

Officially Website
https://nodejs.org/en/download/

Stable release: 12.15.0

Offically Github
https://github.com/nvm-sh/nvm

METHOD 1
Step1 :- sudo apt-get update

Step2 :- sudo apt install nodejs

Step3 :- node -v OR node --version OR nodejs -v

Step4 :- npm -v OR npm --version

METHOD 2
Installing Using PPA
sudo apt-get update

sudo apt-get upgrade

sudo apt-get install python-software-properties

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
OR
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh

sudo apt install nodejs

node --version
nvm --version

sudo apt install build-essential

METHOD 3
Installing Using NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
nvm ls  OR nvm ls-remote
nvm install (Latest LTS)  OR nvm install --lts
nvm use (Latest LTS)
node --version
nvm ls
nvm alias default (Latest LTS)
nvm use default
nvm install node
npm install express
npm install -g express
npm link express
nvm help
nvm --version

Removing Node.js
sudo apt remove nodejs
sudo apt purge nodejs
sudo apt autoremove
sudo apt remove nodejs npm

nvm current
nvm uninstall node_version
nvm deactivate

How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

Visit the Pgadmin 4 Ubuntu download site:
https://www.pgadmin.org/download/

METHOD 1
Importing GPG key
sudo apt install wget ca-certificates

Install Pgadmin4 from Ubuntu repositories
Step1 :- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Add PostgreSQL APT repository
Step2 :- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Updating
Step3 :- sudo apt update

Installation pgadmin4
Step4 :- sudo apt install pgadmin4 pgadmin4-apache2 -y  OR  sudo apt-get install pgadmin4 pgadmin4-apache2

Check Status
Step :- systemctl status apache2

UFW Firewall Configured
Step :- sudo ufw allow http
Step :- sudo ufw allow https

Verify Open Browser
http://[SERVERIP OR LOCALHOST OR DOMAIN]/pgadmin4/

Login with your email address and password.
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
===================================================================================================================================

METHOD 2
Creating a New User
Step5 :- useradd -m -s /bin/bash itcloudnet
Step6 :- passwd STRONGPASSWORD

Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR  sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/{sessions,storage}
OR
Step8 :- sudo mkdir -p /var/lib/pgadmin4/sessions
Step8 :- sudo mkdir /var/lib/pgadmin4/storage

Changing the Owner of all Directory
Step9 :- sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4/ /var/lib/pgadmin4/

Install Dependencies
Step10 :- sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev -y

Install Apache2
Step11 :- sudo apt install apache2 apache2-utils libapache2-mod-wsgi libexpat1 ssl-cert python -y

Creating Virtual Env
Step11 :- su - itcloudnet
Step12 :- virtualenv pgadmin4
Step13 :- cd pgadmin4/
Step14 :- source bin/activate

Installation pgadmin4
Step15 :- wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v3.6/pip/pgadmin4-4.19-py2.py3-none-any.whl

Install Package through pip command
sudo apt-get install python-pip
Step16 :- pip install pgadmin4-4.19-py2.py3-none-any.whl

Creating New Configuration file
Step17 :- cd lib/python2.7/site-packages/pgadmin4/
Step18 :- nano config_local.py

Now Copy & Paste
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
SERVER_MODE = True

Run
Step19 :- python setup.py

Step20 :- pip install psycopg2-binary
Step21 :- sudo chown -R www-data:www-data /var/lib/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/lib/pgadmin4
Step22 :- sudo chown -R www-data:www-data /var/log/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4

Configure Apache2
Step23 :- cd /etc/apache2/sites-available/

Change the 'ServerName' with your own domain name
Step24 :- sudo nano pgadmin4.conf
          ServerName pgadmin.itcloudnet.blogspot.com

Now test the configuration and activate the pgAdmin4 virtual hosts
Step25 :- apachectl configtest
Step26 :- a2ensite pgadmin4

Restart Apache2 Service
Step27 :- systemctl restart apache2

URL Access
http://pgadmin.itcloudnet.blogspot.com

===================================================================================================================================
HOW TO CONNECT POSTGRESQL DB VIA or WITH PGADMIN4

Login with your email address and password
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD

Step28 :- "Add New Server" Button then type PostgreSQL Server or Local details and then save.

Click on General -->
Name : postgresql-local OR localhost
Server group : Servers
Comments : Local PostgreSQl Server

Click on Connection -->
Maintenance : postgres (DB host)
Username : postgres (DB name)
password : itcloudnet$123! (DB passwrod)

Save

Thats it.........

How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

March 29, 2020
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04
    RAM: 4GB
    CPU: 2
    Java: Oracle JDK 8 version

The same instructions apply for Ubuntu 17.04/16.04, Linux Mint, Debian, Kubuntu and Elementary OS

Update/upgrade
1. sudo apt update
2. sudo apt-get upgrade -y
-------------------------------------------------------
Install dependencies and java 8
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update OR sudo apt update
3. sudo apt install openjdk-8-jdk

Verify the Java
1. java -version
-------------------------------------------------------
ELASTICSEARCH

Install and configure Elasticsearch
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.2-amd64.deb
3. sudo dpkg -i elasticsearch-7.5.2-amd64.deb

Elasticsearch configuration file
1. sudo nano /etc/elasticsearch/elasticsearch.yml
network.host to [local, eth0]
nano /etc/init.d/elasticsearch

Locate the line:
# network.host: localhost

start and enable the service
1. sudo systemctl enable elasticsearch.service
2. sudo systemctl start elasticsearch.service
       sudo systemctl status elasticsearch.service
OR
/etc/init.d/elasticsearch start
3. /etc/init.d/elasticsearch status


Verify Elasticsearch
1. curl -X GET "localhost:9200/"

open web browser
1. http://server_ip:9200/ or http://localhost:9200/

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.0.0
-------------------------------------------------------
KIBANA

Now, Install and configure Kibana
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/kibana/kibana-7.5.2-amd64.deb
3. sudo dpkg -i kibana-7.5.2-amd64.deb

Configuration file Kibana
1. sudo nano /etc/kibana/kibana.yml

    Locate the following lines:
#server.host: "localhost"
#elasticsearch.url: "http://localhost:9200"
to
Change those lines to:
server.host: "SERVER_IP"
elasticsearch.hosts: "http://SERVER_IP:9200"

1. sudo sysctl -w vm.max_map_count=262144

start and enable the service
1. sudo systemctl enable kibana.service
2. sudo systemctl start kibana.service
3. sudo systemctl status kibana.service

open web browser
1. http://server_ip:5601/ or ip_address:5601
-------------------------------------------------------

LOGSTASH

Now, Install and configure Logstash
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/logstash/logstash-7.5.2.deb
3. sudo dpkg -i logstash-7.5.2.deb

Configuration file logstash
1. sudo nano /etc/logstash/logstash.yml

Locate the line:
# http.host: "127.0.0.1"

start and enable the service
1. sudo systemctl enable logstash.service
2. sudo systemctl start logstash.service
3. sudo systemctl status logstash.service

Friday, March 27, 2020

How to Install and Configure PostgreSQL v12.2 on Ubuntu 18.04, Debian and Linux Mint

March 27, 2020
How to Install and Configure PostgreSQL v12.2 on Ubuntu 18.04, Debian and Linux Mint

Visit the PostgreSQL Ubuntu download site:
https://www.postgresql.org/download/linux/ubuntu/

First check PostgreSQL Verison Available in Ubuntu
apt show postgresql

Install PostgreSQL from Ubuntu repositories

Updating
Step1 :- sudo apt update

Installation
Step2 :- sudo apt install postgresql postgresql-contrib

Verify
sudo -u postgres psql -c "SELECT version();"

Login into Useraccount
Postgres Account or Login
Step4 :- sudo -i -u postgres  
Step4 :- sudo su - postgres

Exit
Step5 :- \q

Login into Database
Without Switching Accounts
Step6 :- sudo -u postgres psql

Exit
Step7 :- \q

Creating New PostgreSQL Role

Inside the Postgres
Step8 :- createuser --interactive
OR
Outside the Postgres
Step9 :- sudo -u postgres createuser --interactive
OR
Step9 :- sudo su - postgres -c "createuser itcloudnet"

For More Information
man createuser

Creating New PostgreSQL Database

Inside Postgres
Step10 :- createdb itcloudnet
OR
Outside Postgres
Step11 :- sudo -u postgres createdb itcloudnet
OR
Step11 :- sudo su - postgres -c "createdb itcloudnetdb"

Grant Permission
Step12 :- sudo -u postgres psql
Step13 :- grant all privileges on database itcloudnetdb to itcloudnet;

Opening with New Role
Step12 :- sudo adduser itcloudnet

New Database Connect
Step13 :- sudo -i -u itcloudnet 
OR
Step13 :- sudo -u itcloudnet psql
Step14 :- psql

To Connect Different Database
Step15 :- psql -d postgres

To Check Connection Information
Step16 :- \conninfo

Creating and Deleting Tables
Step17 :- CREATE TABLE cloudnetwork (
    equip_id serial PRIMARY KEY,
    type varchar (50) NOT NULL,
    color varchar (25) NOT NULL,
    location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
    install_date date
);

Output with Sequence
Step18 :- \d

Without Sequence
Step19 :- \dt

Adding, Querying and Deleting Data in Table
Step20 :-
INSERT INTO cloudnetwork (type, color, location, install_date) VALUES ('slide', 'blue', 'south', '2020-04-20');
INSERT INTO cloudnetwork (type, color, location, install_date) VALUES ('swing', 'yellow', 'northwest', '2019-08-16');


Step21 :- SELECT * FROM cloudnetwork;

Step22 :- DELETE FROM cloudnetwork WHERE type = 'slide';


Adding and Deleting Columns from a Table
Step23 :- ALTER TABLE cloudnetwork ADD last_maint date;

Step24 :- SELECT * FROM cloudnetwork;

Step25 :- ALTER TABLE cloudnetwork DROP last_maint;

Updating Data in a Table
Step26 :- UPDATE cloudnetwork SET color = 'red' WHERE type = 'swing';

Step27 :- SELECT * FROM cloudnetwork;

TO RESET PASSWORD
ALTER USER postgres WITH PASSWORD 'itcloudnet$123!';

Enable remote access to PostgreSQL server
sudo nano /etc/postgresql/10/main/postgresql.conf
listen_addresses = '*'

sudo service postgresql restart
ss -nlt | grep 5432

sudo nano /etc/postgresql/10/main/pg_hba.conf
i case of 10 it can be 11 version
Replace with peer ---> md5
sudo service postgresql restart