Category Archives: Linux

How to check if the port is opened

Case 1. To check whether port 80 is opened on server1 and monitored by some app there:

Case2. If no app listens the port  on server, we need to start some monitoring tool first and then try telnet:

Start listening on server:

Try to connect from client:

ECDSA host key differs from the key for the IP address

Ssh connection to the server gives the warning below:

Fix: remove entry for this IP

or for specific user

Change hostname on ubuntu 16.04 xenial

All operations from sudo user sudo su

1. Replace old name with new name in files:

/etc/hostname
/etc/hosts

2. Run commands in  terminal:

3. Recreate ssh keys on the machine:

After reboot machine should be accessed by new name

Install R forecast package

Attempted to install forecast package in R 3.2 version, on Ubuntu 16.04 LTS Xenial Xerus:

but when installing dependent packages tseries, quadprod, RcppArmadillo, it produced an error:
/usr/bin/ld: cannot find -lblas, cannot find -llalapack

Solution: install these libs in linux terminal:

and  install.packages("forecast") will work in R console

Find jar with class

This helped me to resolve java.lang.ClassNotFoundException.  Bash command scans jar files in the folder and prints who contains given class.

 

See Linux version in terminal

I always, always forget this command. I search it in internet again and again, every time when I need to determine my Linux version. I am going to stop it now – I memorize the command in my notes:

The  lsb_release command provides certain LSB (Linux Standard Base) and
distribution-specific information. The key -a means all possible info, it is not much.

Docker on Ubuntu quickstart

Short tips how to install and use Docker on Ubuntu Server 16.04

Install Docker engine

Check installation

Continue reading

Connect by ssh without password

How to configure server and client for SSH authentication without password.

  1. On client generate a new key

    You will be asked to enter passphrase and key file name. I entered empty passphrase and dmitry key name
  2. On client copy generated key to ~/.ssh folder
  3. On client use ssh-copy-id command for adding generated pub key to server’s authorized keys.
  4. On client edit ~/.ssh/config or create if not exists. Add following lines:
  5. On server, if you need to connect as root without password too, edit /etc/ssh/sshd_config, say yes to PermitRootLogin

    Then restart ssh

    Run visudo and edit line, starting from %sudo
  6. Now you can connect server without password