Jumat, 21 September 2018

Test Database Connectivity Using Php Script

1Many times, Influenza A virus subtype H5N1 organization administrator needs to seek out a connexion betwixt APP server as well as DB server. It tin mail away live required when around developer reporting upshot piece they connect to the Database server from their application. 

It is a really helpful PHP script that gives us really useful output as well as tin mail away assist inwards the troubleshooting. In this my blog, I'm going to portion a PHP script amongst around example.
Prerequisites- 

  • Database Server's HostName
  • A Database Name
  • DB user / Password
  • Another System installed PHP
Step 1- Create a PHP Script
To practise your PHP script inwards your lastly session practise a novel file using vi editors. 

$ vi db-test.php

Now, re-create the script below as well as glue inwards your file.

<?php $servername = "MySQL_Host"; $username = "MySQL_UserName"; $password = "MySQL_Password";  // Create connexion $conn = mysqli_connect($servername, $username, $password);  // Check connexion if (!$conn) {     die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?>  
$ php db-test.php  Connected successfully Establish to Database Server Name: '192.168.10.11'

Replace all the highlighted text amongst your's details.
Step 2 - Run PHP Script to seek out Database connectivity. 
There is 2 agency to run your PHP script. 
1- One yous tin mail away run from the lastly followed yesteryear this command. 

$ php db-test.php

If your connexion to DB server is successful, yous volition larn output similar this. 

2- You tin mail away house db-test.php file inwards your Apache document root folder as well as telephone telephone this script using the spider web browser. 
If your remote server has access to the DB server therefore yous Browser output volition live similar this.

You bring successfully tested Database connectivity using PHP script. 


Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 20 September 2018

How To Enable Psremoting To Execute Powershell Script From Remote Machine.


PSRemoting (PowerShell Remote execution) - PowerShell Remoting allow yous run PowerShell ascendancy or Access amount PowerShell Session on remote Windows System. In other words, it's similar to SSH for accessing remote terminals from Remote computers.

PSRemoting disabled yesteryear default, you've to enable  PSRemoting earlier using it. 
Let's follow the procedure below to enable PSRemoting.


Prerequisites- 

  • Two Windows PC amongst Admin Rights.
  • One primary PC that nosotros volition access remotely.
  • Another to Run in addition to access PS of PC1.
Step 1- Enable PSRemoting (The PC volition access Remotely) - Let's follow the steps below to enable PSRemoting.
  • Open PowerShell every bit an Administrator account.

  • In the Powershell Window, Run the next ascendancy in addition to hitting Enter key
Enable-PSRemoting -Force















This ascendancy starts the WinRM service, sets it to starting fourth dimension automatically amongst your system, in addition to creates a firewall dominion that allows incoming connections. The -Force usage of the cmdlet tells PowerShell to perform these actions without prompting yous for each step.
If you're working on Domain network that is the procedure in addition to yous are cook to execute the Powershell ascendancy from the Remote PC.

Step 2- Follow the below procedure for Workgroup environment.
While you're working on homework or workgroup network hence yous conduct keep to trust your PC to connect remotely. 
Run the ascendancy below on the PC from where yous would to similar execute the commands.
Set-Item wsman:\localhost\client\trustedhosts *
The asterisk is a wildcard symbol for all PCs. If instead yous desire to limit computers that tin connect, yous tin supplant the asterisk amongst a comma-separated listing of IP addresses or figurer names for approved PCs.

After running that command, you’ll postulate to restart the WinRM service hence your novel settings conduct keep effect. Type the next cmdlet in addition to hence hitting Enter:

Restart-Service WinRM

All done, Now, you're cook to execute PowerShell script from a Remote computer.


Thank yous really much for reading my Blog, Please comment below whatever proposition or feedback to improve my Blog.


Sumber https://linuxhowtoguide.blogspot.com/

Minggu, 09 September 2018

Git - Apply Outset Repository Together With Clone On Local Reckoner Using Git-Bash Cli

GitHub -
Github is a nigh pop cloud-based opened upward source repository system, It allows the squad to act too submit their function at a key location. 


Developer too shop too acquire by their code, equally good equally rail too command changes to their code. mainly used for source code management inwards software development. It is a Command Line Interface(CLI) tool too tin move mastered easily. 


Prerequisites -

  • One Github delineate organisation human relationship - You tin ready your gratis delineate organisation human relationship (if don't have).
  • One Windows Machine amongst installed Git software.
Step 1- Download too install Git Software -
You tin download the latest version of Git from its official's site - https://git-scm.com/downloads
Once terminal the download, You tin start the installation past times double click on file - Git-2.18.0-64-bit.exe. It's real slow installation simply follow the steps.

Step 2- Create First Repository on GitHub:
Let's follow the steps below to produce your get-go Github repository -
  • Log on to your GitHub delineate organisation human relationship - https://github.com/login
  • Create your get-go Repo on the login page click on New Repository
  • On the side past times side shroud come inwards your repository name (myfirstrepo) > cheque on Public > click Initialize this repository amongst Readme  > Click on Create Repository.
Your Repository has created too initialized. Your side past times side shroud should move similar this.


Step 3- Setup SSH key 
In this case, we already initialized our repository spell nosotros ready it on GitHub delineate organisation human relationship too hence no necessitate to initialized here. 
Now, Open Git Bash on your local calculator too follow the steps below-
  • On the Git Bash command type command below too striking the come inwards push clit to generate SSH key.
$ ssh-keygen -t rsa -C "asingh@domain.com" 
You volition acquire output similar inwards below image.
  • Now opened upward /C/Users/amar/.ssh/id_rsa.pub file inwards your favourite editor too re-create the SSH key. You tin respect your file path inwards the electrical flow user's habitation directory within folder .ssh.

$ vi /c/Users/amar/.ssh/id_rsa.pub  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDyph6mttPuEnUOWJFTuRmFNp7WS4xe1x4WPTzlanMf5PnTv1TQxWbchaITQQMGCqF+3/6/r8JTip5yuC0vaku+0CmFPCVfk3w8dmqew3n8b3/ki98ieei8OnPuALDC7+lrcknstl+MnF3WDsyi0ZEfvABaj6m3BUIGfwawG18+wcvgpaYYoPnKEXvYLY1D05ZlBW/9EQuHLHNimXGiwRqLFBI5qYSBC9pRXLA6X10gbaFORKuYJSQkpP4dKj7F8aD1tIASW55DtDtVrEWf2avyRh5Hca6Y0cO3+HvKnCSie3sUyZ+8A9gJmQ7sv629uIGNmpZrJGE9hfrv72zKgkH6f asingh@gmail.com 
  • Copy inwards a higher house ssh key too glue into your GitHub account.
  • Go into Git Hub delineate organisation human relationship settings -
  • Now, click on SSH too GPG key push clit on left side > NewSSH key as inwards below picture.

  • Now re-create your SSH key inwards the box. Copy SSH key from local organisation path -/C/Users/amar/.ssh/id_rsa.pub
Once you lot glue the SSH key click on Add SSH key button.

Step 4- Clone repository to your local system.
After successfully added SSH key, Your Git Bash is produce to clone your get-go Repository.
  • Log on to your GitHub delineate organisation human relationship too re-create Repository URL equally inwards the flick below - Change clone type to SSH earlier you lot re-create the URL


  • Once you lot re-create the repository URL type below command at your Git Bash shell.
$ git clone git@github.com:amars1986/myfirstrepo.git
  • Now become to your cloning path 
$ cd myfirstrepo/
  • Check the Repository condition using the git status command.
$ git condition  On branch master copy Your branch is upward to appointment amongst 'origin/master'.  zip to commit, working tree clean 
Your Git repository master copy branch is up-to-date. 

Your get-go cloning completed successfully, In my side past times side spider web log nosotros volition larn how to create, add, commit too force newly added file too folder to out Git repository


Sumber https://linuxhowtoguide.blogspot.com/

Rabu, 29 Agustus 2018

How To Transfer Putty Saved Session To Around Other Windows Machine.

Putty Session Transfer - Putty is a final emulator application which acts equally a customer for SSH connecter in addition to to command router in addition to switches remotely. 

Though, sometime an information technology administrator may require to transfer their saved putty session to around other windows machine. 



Default registry place for saved Putty session equally follows:
HKEY_CURRENT_USER\Software\SimonTatham
Step 1- Export Putty session on source Windows:
In social club to transfer putty session first, y'all take away to export all the saved session on source windows machine. Let's follow the steps below to export.

  •  Open CMD equally administrator:

Step 2- use this command in addition to press the larn into key. It volition salve exported .reg file on the electrical flow user's desktop.
regedit /e "%userprofile%\desktop\putty-registry.reg" HKEY_CURRENT_USER\Software\Simontatham
Verify the file using the command below:
C:\Windows\system32> dir "%userprofile%\desktop"
Successfully exported saved Putty session to electrical flow user's desktop in addition to file cite - putty_registory.reg

Step 3- Transfer exported file to around other windows machine.
After successfully file export, delight transfer the export file to the remote computer. either y'all tin transfer file using USB or over the network. In my case, my both estimator are on the same network in addition to I did transfer over the network.

Step 4- Import the .reg file to the finish machine.
On the finish arrangement larn to the folder where y'all copied exported file name- putty_registry.reg 
Now, correct click on the file in addition to click on the merge alternative equally inward below picture. subsequently successful import of the file opened upward your Putty software in addition to y'all volition abide by all the exported session there.

Now y'all convey successfully exported your session to around other windows machine.


Optional- If y'all convey around saved session using.PPK file, In such Case please transfer yours.PPK file to the finish estimator inward the same folder hierarchy 

Example- 
Source machine structure-
D:\project_name\SSH_Key
Destination machine Structure 
D:\project_name\SSH_Key
After transferring all the .PPK file, yours all putty session volition hold upward successfully.


Thanks for reading my blog, delight comment in addition to advise to larn inward better

Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 19 Juli 2018

How To Install Jenkins On Windows Machine.

Jenkins-  Jenkins offers a unproblematic agency to laid upward a continuous integration together with continuous delivery environs for virtually whatsoever combination of linguistic communication together with source code repositories using pipelines, besides equally automating other tasks.


Jenkins Installation - Jenkins installation is rattling easy, Simple run the installer file together with follow the steps to consummate the installation. 

Step 1- Download installer file from the official Jenkins website - http://mirrors.jenkins-ci.org/windows-stable/latest

Once download finish, Run the installer file together with follow the steps. 
Press Next to halt the installation

Afte halt the installation, let's follow the steps below to setup initial settings.
Step 2- Initial setup configuration.
You Will hold upward redirected to the next page. 
Step 3- Enter default Admin password.
Get the electrical flow administrator password from this place together with glue at the start when windows when asked.
C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword
Paste the password together with click on adjacent to continue.
On the adjacent windows, guide install suggested plugins
Let's accept a loving cup of tea until suggested plugins installation gets finished.
Step 4- Create start Admin account.
Enter the user's details, Click relieve together with continue
Step 5- Configure Jenkins default URL-
Enter the desired domain cite or IP address to setup Jenkins URL.
Click on SAVE together with Finish.
Over adjacent page, click start using Jenkins. Jenkins Windows event installation together with initial configuration business office completed successfully. 


Jenkins is develop to laid upward jobs together with automate your work.


Sumber https://linuxhowtoguide.blogspot.com/

Rabu, 14 Maret 2018

How To Proceed Parse Server Dashboard Running Or Initiatory Of All At Organization Boot

Parse-Dashboard-

By-Default parse dashboard industrial plant until your final is active, in i lawsuit your connectedness intermission parse dashboard volition non endure available.
We tin move ii methods to proceed dashboard running always.

Method 1- Use nohup command.


Step 1- move nohup ascendence amongst parse dashboard
 Use nohup command to proceed running parse dashboard inwards the background. move the ascendence below.
Go to the parse dashboard directory-
 root@Server16: #  cd /opt/parse-dashboard
use nohup "parse command" &


root@Server16:/opt/parse-dashboard# nohup parse-dashboard --config parse-dashboard-config.json --allowInsecureHTTP imitation &

nohup ascendence volition proceed running parse dashboard inwards the background


Step 2- setup this ascendence to run at organization boot.
above ascendence volition aid us to run parse dashboard inwards the background but inwards illustration our server gets the reboot or crashed due to ability failure or other reason. In such case, nosotros postulate to brand certain to run our parse dashboard at organization kick up. follow the steps below to run dashboard at organization boot.

open in addition to edit rc.local file
root@Server16: # vi /etc/rc.local
Append the parse dashboard path in addition to then ascendence to offset parse dashboard. Add the ruby-red highlighted trace of piece of occupation to your rc.local, brand certain y'all are adding both the trace of piece of occupation earlier exit 0.
# In gild to enable or disable this script only alter the execution # bits. # # By default this script does nothing. #path of parse dashboard cd /opt/parse-dashboard # Command to offset parse dashboard inwards the backgroupnd nohup parse-dashboard --config parse-dashboard-config.json --allowInsecureHTTP imitation & exit 0 
Your file should endure similar to a higher identify inwards the screenshot

Method 2- Use PM2 npm module to offset parse dashboard.

We can  PM2 ascendence to start, halt in addition to banking concern fit the condition of parse dashboard. The wages is nosotros tin stop, offset in addition to banking concern fit the condition of our dashboard anytime. Follow the steps below to brand PM2 ascendence available inwards your environment.
Step 1- Install PM2
To install PM2 on your Linux machine move ascendence below.
sudo npm install -g pm2
Once pm2 installed, 
Step 2- Create parse-dashboard.json file.
create a script to brand parse dashboard available globally at Linux shell.
Create a parse-dashboard.json file using vim editor.
root@Server16: # vi parse-dashboard.json
Append the follow lines in addition to alter the highlighted trace of piece of occupation amongst your path
{   "apps" : [{     "name"        : "parse-dashboard-wrapper",     "script"      : "/usr/bin/parse-dashboard",     "watch"       : true,     "merge_logs"  : true,     "cwd"         : "/opt/parse-dashboard",     "args"         : "--config /opt/parse-dashboard/parse-dashboard-config.json --allowInsecureHTTP=1"   }] } 
Save in addition to driblet dead from the editor.
Step 3- Start parse dashboard.
root@Server16: # pm2 offset parse-deshboard.json
Parse dashboard is upward in addition to running.
Step 4- Check status:
root@Server16: # pm2 condition parse-deshboard.json
Step 4-Check condition of specific pm2 ID
To banking concern fit the item of ascendence move ID of running app
root@Server16: # pm2 demonstrate 0
In the screenshot below y'all volition detect Script path in addition to executed command.

Step 5- Mark pm2 ascendence execute during organization boot.
Your application volition endure available until the system is upward in i lawsuit your organization kick upward y'all in i lawsuit again postulate to run this ascendence to brand available your dashboard.
Let's laid upward our ascendence to execute during organization boot.
open in addition to edit rc.local file
root@Server16: # vi /etc/rc.local
Add the next trace of piece of occupation earlier exit 0 line
# bits. # # By default this script does nothing. #Start parse dashboard at organization kick upward pm2 offset /home/amar/parse-deshboard.json exit 0  
Save in addition to driblet dead from the file.

Now, your parse dashboard volition endure available if your organization gets the reboot.



Sumber https://linuxhowtoguide.blogspot.com/

Sabtu, 10 Maret 2018

Mongodb Basic Direction Command- Exercise Db, Exercise User, Assign Permission, Restrain Access

MongoDB:
MongoDB is an open-source document database that provides high performance, high availability, as well as automatic scaling. MongoDB obviates the involve for an Object Relational Mapping (ORM) to facilitate development.


  • Basic MongoDB admin related commands:
1- Check MongoDB server version:
Run below ascendance mongo to banking company gibe mongodb version
root@US16: # mongo MongoDB crunch version v3.6.0 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.0 
2-List all the database: To listing all the DBs hitting ascendance show dbs;
> show dbs; admin   0.000GB config  0.000GB local   0.000GB > 
3-Enable MongoDB authentication:
By default, mongodb installation convey opened upwards access to the shell. that hateful anyone tin forcefulness out run the ascendance as well as modify the dbs.

Let's enable authentication : Follow the steps below
3A-Create a user amongst total privileges: Run the next command 
use admin db.createUser({user:"admin", pwd:"redhat", roles:[{role:"root", db:"admin"}]})
Command output would hold upwards similar this:
source document database that provides high functioning Mongodb basic direction command- Create DB, Create User, Assign Permission, trammel access

Now leave of absence from the mongo shell- type ascendance exit
3B- Stop mongod service
root@US16: # systemctl halt mongod.service
3C-Modify /lib/systemd/system/mongod.service :

root@US16: # vi /lib/systemd/system/mongod.service
Append --quiet --auth syntax inwards trouble starting fourth dimension with 
ExecStart=/usr/bin/mongod --quiet --auth --config /etc/mongod.conf
[Service] User=mongodb Group=mongodb ExecStart=/usr/bin/mongod --quiet --auth --config /etc/mongod.conf # file size LimitFSIZE=infinity 
Your ExecStart trouble should hold upwards like 

Save as well as Exit from the file
4- Reload service daemon: Run the ascendance below
root@US16: # systemctl daemon-reload
5- Start mongo service:Run the ascendance below
root@US16: # systemctl starting fourth dimension mongod.service
6- Check mongo service status: We involve to validate mongo service afterward applied the changes let's banking company gibe mongo service condition using below command.
root@US16: # systemctl condition mongod.service
7- Everything hold off adept as well as mongo service is dorsum authentication has enabled, allow validate access.
7A- Access mongo crunch amongst authentication 
root@US16: # mongo -u root -p
We are successfully able to login amongst username as well as password!
8- List all users: Login to mongo crunch amongst admin user
select database admin
> utilisation admin
Execute the next ascendance show users; to listing users
> demo users; {         "_id" : "test.admin",         "user" : "admin",         "db" : "test",         "roles" : [                 {                         "role" : "root",                         "db" : "admin"                 }         ] } {         "_id" : "test.amar",         "user" : "amar",         "db" : "test",         "roles" : [                 {                         "role" : "root",                         "db" : "admin"                 }         ] } >  
In the higher upwards out at that spot are 2 user available highlighted inwards cerise color 
9- Check electrical flow selected database:
To banking company gibe electrical flow choose database utilisation ascendance db

> db admin > 
10- Check electrical flow selected database's collection:
 To banking company gibe electrical flow choose database's collection utilisation ascendance show collections

> demo collections system.users system.version > 
11- Update password for existing user:
Use the next ascendance to update existing user's password

> utilisation admin switched to db admin > db.changeUserPassword("amar", "newpassword") > 
Where "use admin" ascendance to choose database as well as db.changeUserPassword("username","Newpassword")



Sumber https://linuxhowtoguide.blogspot.com/