2020 - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Monday, November 2, 2020

How to share printer with particular host in cups in RHEL?

November 02, 2020
How to share printer with particular host in cups in RHEL?

 1. First Install CUPS

yum install cups
 
2. Service Start and Stops 
systemctl enable cups
systemctl start cups 
 
3. Edit the Configuration file
sudo nano /etc/cups/cupsd.conf
Listen localhost:631

to

Listen *:631

grep -v '#' /etc/cups/cupsd.conf 

RHEL 7 uses system temp files to

November 02, 2020
RHEL 7 uses system temp files to

 

Managing temporary files with systemd-tmpfiles on Red Hat

Why the files in /tmp directory gets deleted periodically

 

For CentOS/RHEL7

cd /usr/lib/tmpfiles.d/tmp.conf

# cat /usr/lib/tmpfiles.d/tmp.conf
# Clear tmp directories separately, to make them easier to override
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d

# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
X /tmp/systemd-private-%b-*/tmp
x /var/tmp/systemd-private-%b-*
X /var/tmp/systemd-private-%b-*/tmp
 

For CentOS/RHEL6

cd /etc/cron.daily/tmpwatch

# cat /etc/cron.daily/tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
	-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
	-X '/tmp/hsperfdata_*' -X '/tmp/.hdb*lock' -X '/tmp/.sapstartsrv*.log' \
	-X '/tmp/pymp-*' 10d /tmp
 
# man tmpwatch 

 

How do we access different apps on Ubuntu system?

November 02, 2020
How do we access different apps on Ubuntu system?

How Ubuntu used in government sector?

November 02, 2020
How Ubuntu used in government sector?

Is 700mb DVD sufficient to burn ubuntu in it?

November 02, 2020
Is 700mb DVD sufficient to burn ubuntu in it?

Wednesday, September 2, 2020

How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

September 02, 2020
How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

 Requirment 

1. docker should be installed

2. docker-compose also be installed


Installation of docker

1.  sudo apt-get install docker.io or sudo apt  install docker.io

2. docker --version

3. sudo apt-get install docker-compose

 

Creating a Configuration files of prometheus

1. create a new file prometheus.yml and copy paste below

sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml

# prometheus.yml
global:
 scrape_interval: 5s
 external_labels:
   monitor: 'my-monitor'
rule_files:
 - 'alert.rules'
scrape_configs:
 - job_name: 'prometheus'
   static_configs:
     - targets: ['your_server_ip:9090']

2. create a new file docker-compose.yml and copy paste below

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

# docker-compose.yml
version: '2'
services:
  prometheus:
     image: prom/prometheus:latest
     volumes:
       - ./prometheus.yml:/etc/prometheus/prometheus.yml            
     command:
       - '--config.file=/etc/prometheus/prometheus.yml'
     ports:
       - '9090:9090'

 3. Run the docker compose file

cd /etc/prometheus/ or sudo ~/docker-compose up

sudo docker-compose up

 4. Open browser

http://your_server_ip:9090

 5. Install Node exporter

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml
 
copy paste at last line
node-exporter:
     image: prom/node-exporter
     ports:
       - '9100:9100'
 sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml
 
copy paste at last line 
- job_name: 'node-exporter'
   static_configs:
     - targets: ['node-exporter:9100'] 

 6. Restart docker-composer

cd /etc/prometheus/ or sudo ~/docker-compose restart

sudo docker-compose restart

7. Install Grafana

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

copy paste at last line  

grafana:
     image: grafana/grafana
     user: "0" #[ Execute  id -u in terminal to find the user id from where you are invoking docker compose]
     volumes:
       - ./grafana_db:/var/lib/grafana
     environment:
       - GF_SECURITY_ADMIN_PASSWORD=yourpass
     depends_on:
       - prometheus
     ports:
       - '3000:3000'

 4. Open browser

http://your_server_ip:3000

 

 

Tuesday, September 1, 2020

How to Install Prometheus using Docker on Ubuntu 18.04

September 01, 2020
How to Install Prometheus using Docker on Ubuntu 18.04

1. Create a new file 

sudo nano ~/prometheus.yml
 Add below lines or copy paste into prometheus file
 
# A scrape configuration scraping a Node Exporter and the Prometheus server
# itself.
scrape_configs:
  # Scrape Prometheus itself every 5 seconds.
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

  # Scrape the Node Exporter every 5 seconds.
  - job_name: 'node'
    scrape_interval: 5s
    static_configs:
      - targets: ['your_server_ip:9100']
 
2. docker run -d -p 9090:9090 -v ~/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus
3. docker ps
4. http://your_server_ip:9090/status
 
ERROR :- state : UNKNOWN
SOLUTION :- remove  -storage.local.memory-chunks=10000
  
 

Tuesday, June 16, 2020

How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04/20.04, Debi...

June 16, 2020
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04/20.04, Debi...

Wednesday, June 10, 2020

How to solve command could not be located because '/bin' is not included in the path environment variable

June 10, 2020
How to solve command could not be located because '/bin' is not included in the path environment variable
ERROR
command could not be located because '/bin' is not included in the path environment variable


SOLUTION 1
cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

ls -l /etc/environment
-rw-r--r-- 1 root root 79 2010-03-16 14:44 /etc/environment

JUST TYPE
export PATH=/usr/bin:/bin

=========================================
SOLUTION 2
sudo nano ~/.bashrc
CP & PST AT LAST LINE OR BOTTOM
export PATH=/usr/bin:$PATH

source ~/.bashrc
==========================================




Saturday, May 9, 2020

How to Install Virtual Box v(6.1.6) on Ubuntu 20.04 LTS | Install Latest...

May 09, 2020
How to Install Virtual Box v(6.1.6) on Ubuntu 20.04 LTS | Install Latest...

Sunday, April 26, 2020

How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Install Ubuntu 20.04 LTS Desktop https://youtu.be/5VWsjJhQkJw

April 26, 2020
How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Install Ubuntu 20.04 LTS Desktop https://youtu.be/5VWsjJhQkJw

How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Install Ubuntu 20.04 LTS Desktop https://youtu.be/5VWsjJhQkJw

April 26, 2020
How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Install Ubuntu 20.04 LTS Desktop https://youtu.be/5VWsjJhQkJw

How to Enable Hidden Notification LED Light in Poco X2 | Notification LED in POCO X2 https://youtu.be/MlH-8UOodr0

April 26, 2020
How to Enable Hidden Notification LED Light in Poco X2 | Notification LED in POCO X2 https://youtu.be/MlH-8UOodr0

How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Insta...

April 26, 2020
How to Install New Ubuntu 20.04 LTS (Focal Fossa) in Dell Laptop | Insta...

Sunday, April 19, 2020

How to Reset Root/User Password on CentOS 8 | Resetting a Forgotten Root Password in CentOS 8 - 2020 https://www.youtube.com/watch?v=Kh3cAX_KzVw

April 19, 2020
How to Reset Root/User Password on CentOS 8 | Resetting a Forgotten Root Password in CentOS 8 - 2020 https://www.youtube.com/watch?v=Kh3cAX_KzVw

How to Reset Root/User Password on CentOS 8 | Resetting a Forgotten Root Password in CentOS 8 - 2020 https://www.youtube.com/watch?v=U1nQaZ

April 19, 2020
How to Reset Root/User Password on CentOS 8 | Resetting a Forgotten Root Password in CentOS 8 - 2020 https://www.youtube.com/watch?v=U1nQaZ

How to Reset Root/User Password on CentOS 7 | Resetting a Forgotten Root Password - 2020 https://www.youtube.com/watch?v=x-ISSCyZXo8

April 19, 2020
How to Reset Root/User Password on CentOS 7 | Resetting a Forgotten Root Password - 2020 https://www.youtube.com/watch?v=x-ISSCyZXo8

How to Download and Install Oracle Java (JDK) 8 on Ubuntu 18.04 and How to Uninstall (JDK) 8 - 2020 https://www.youtube.com/watch?v=U1nQaZzV5sk

April 19, 2020
How to Download and Install Oracle Java (JDK) 8 on Ubuntu 18.04 and How to Uninstall (JDK) 8 - 2020 https://www.youtube.com/watch?v=U1nQaZzV5sk

How to Install Visual Studio Code v1.43.2 on Ubuntu 18.04, Debian and Linux Mint https://www.youtube.com/watch?v=ygBfvZIzVPo

April 19, 2020
How to Install Visual Studio Code v1.43.2 on Ubuntu 18.04, Debian and Linux Mint https://www.youtube.com/watch?v=ygBfvZIzVPo

How to Install CentOS Linux 8 Minimal on Virtual Box | Install CentOS Li...

April 19, 2020
How to Install CentOS Linux 8 Minimal on Virtual Box | Install CentOS Li...

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

Wednesday, February 26, 2020

How to Install Android Studio 3.6 Latest Version on Ubuntu 18.04 LTS Through Terminal & Ubuntu Software

February 26, 2020
How to Install Android Studio 3.6 Latest Version on Ubuntu 18.04 LTS Through Terminal & Ubuntu Software

Tuesday, February 11, 2020

How to Secure Copy Files or Directory From One Machine(Ubuntu) to Anothe...

February 11, 2020
How to Secure Copy Files or Directory From One Machine(Ubuntu) to Anothe...

Wednesday, January 29, 2020

How to Make Pendrive Bootable in Ubuntu 18.04 Command line, UNetbootin a...

January 29, 2020
How to Make Pendrive Bootable in Ubuntu 18.04 Command line, UNetbootin a...

How to Make Pendrive Bootable in Ubuntu 18.04 Command line, UNetbootin a...

January 29, 2020
How to Make Pendrive Bootable in Ubuntu 18.04 Command line, UNetbootin a...

How to Install Putty in Ubuntu 18.04 LTS

January 29, 2020
How to Install Putty in Ubuntu 18.04 LTS