Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, September 17, 2018

How To Install OpenCV In Ubuntu Linux

How To Install OpenCV In Ubuntu Linux



Today, I'm going to show you how to install OpenCV in Ubuntu Linux (I'm using Ubuntu 18.04 for this tutorial)

First Download OpenCV and opencv_contrib

git clone https://github.com/opencv/opencv.git --depth=1

and

git clone https://github.com/opencv/opencv_contrib.git --depth=1

After completing the download extract the zip files and navigate to opencv directory

Then, create the directory named build inside the opencv directory and navigate to that newly created one..

cd opencv && mkdir build && cd build

Now run the cmake command from build directory...

cmake ../

It will take some time.. Please be patient... :)
At this time the output will look like this...

root@10a4bdccb67a:~/opencv/build# cmake ../ -- The CXX compiler identification is GNU 7.3.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7") -- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.6") -- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.4") -- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.2") -- Looking for ccache - not found -- Performing Test HAVE_CXX_FSIGNED_CHAR -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success -- Performing Test HAVE_C_FSIGNED_CHAR -- Performing Test HAVE_C_FSIGNED_CHAR - Success -- Performing Test HAVE_CXX_W -- Performing Test HAVE_CXX_W - Success -- Performing Test HAVE_C_W -- Performing Test HAVE_C_W - Success -- Performing Test HAVE_CXX_WALL -- Performing Test HAVE_CXX_WALL - Success -- Performing Test HAVE_C_WALL -- Performing Test HAVE_C_WALL - Success ......

Then run the make command..

make

The above commands output will looks like..

[ 0%] Generate opencv.pc [ 0%] Built target gen-pkgconfig Scanning dependencies of target zlib [ 0%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/adler32.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/compress.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/crc32.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/deflate.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzclose.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzlib.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzread.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/gzwrite.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inflate.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/infback.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inftrees.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/inffast.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/trees.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/uncompr.c.o [ 1%] Building C object 3rdparty/zlib/CMakeFiles/zlib.dir/zutil.c.o [ 2%] Linking C static library ../lib/libzlib.a [ 2%] Built target zlib Scanning dependencies of target libjpeg-turbo [ 2%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapimin.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapistd.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jccoefct.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jccolor.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcdctmgr.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jchuff.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcinit.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcmainct.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcmarker.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcmaster.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcomapi.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcparam.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcphuff.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcprepct.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcsample.c.o [ 3%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jctrans.c.o [ 4%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jdapimin.c.o [ 4%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jdapistd.c.o ..... [100%] Linking CXX executable ../../bin/opencv_annotation [100%] Built target opencv_annotation Scanning dependencies of target opencv_visualisation [100%] Building CXX object apps/visualisation/CMakeFiles/opencv_visualisation.dir/opencv_visualisation.cpp.o [100%] Linking CXX executable ../../bin/opencv_visualisation [100%] Built target opencv_visualisation Scanning dependencies of target opencv_interactive-calibration [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/calibController.cpp.o [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/calibPipeline.cpp.o [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/frameProcessor.cpp.o [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/main.cpp.o [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/parametersController.cpp.o [100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/rotationConverters.cpp.o [100%] Linking CXX executable ../../bin/opencv_interactive-calibration [100%] Built target opencv_interactive-calibration Scanning dependencies of target opencv_version [100%] Building CXX object apps/version/CMakeFiles/opencv_version.dir/opencv_version.cpp.o [100%] Linking CXX executable ../../bin/opencv_version [100%] Built target opencv_version

After this.. run make install with sudo..

sudo make install

The output will look like below one..

root@10a4bdccb67a:~/opencv/build# make install [ 0%] Built target gen-pkgconfig [ 2%] Built target zlib [ 6%] Built target libjpeg-turbo [ 9%] Built target libtiff [ 17%] Built target libwebp [ 19%] Built target libjasper [ 20%] Built target libpng [ 25%] Built target IlmImf [ 27%] Built target ippiw [ 32%] Built target libprotobuf [ 32%] Built target ittnotify [ 32%] Built target opencv_test_core_pch_dephelp [ 32%] Built target opencv_core_pch_dephelp [ 32%] Built target opencv_ts_pch_dephelp [ 32%] Built target pch_Generate_opencv_ts [ 32%] Built target pch_Generate_opencv_core [ 38%] Built target opencv_core [ 39%] Built target opencv_imgproc_pch_dephelp [ 39%] Built target pch_Generate_opencv_imgproc [ 43%] Built target opencv_imgproc [ 43%] Built target opencv_imgcodecs_pch_dephelp [ 43%] Built target pch_Generate_opencv_imgcodecs [ 45%] Built target opencv_imgcodecs [ 45%] Built target opencv_videoio_pch_dephelp [ 45%] Built target pch_Generate_opencv_videoio [ 46%] Built target opencv_videoio [ 46%] Built target opencv_highgui_pch_dephelp [ 46%] Built target pch_Generate_opencv_highgui [ 46%] Built target opencv_highgui [ 47%] Built target opencv_ts [ 47%] Built target pch_Generate_opencv_test_core [ 49%] Built target opencv_test_core ...... -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_licence_plate_rus_16stages.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_lowerbody.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_profileface.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_russian_plate_number.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_smile.xml -- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_upperbody.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalcatface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalface_improved.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_profileface.xml -- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_silverware.xml -- Installing: /usr/local/bin/opencv_traincascade -- Installing: /usr/local/bin/opencv_createsamples -- Installing: /usr/local/bin/opencv_annotation -- Installing: /usr/local/bin/opencv_visualisation -- Installing: /usr/local/bin/opencv_interactive-calibration -- Installing: /usr/local/bin/opencv_version root@10a4bdccb67a:~/opencv/build#

One more step.. just link and cache the required files with following commands

sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig

Now you can check the installation by running below command.. it will print out the version of opencv in stdout

pkg-config --modversion opencv

Here's the small shell script to automate the process... :)

That's it for now.. If you like.. don't forget to share it guys.. You can follow us on fb.com/opensourceinside and also subscribe our channel on Youtube..


Saturday, September 15, 2018

Getting Started With RabbitMQ in 10 Minutes (On Ubuntu)

Getting Started With RabbitMQ in 10 Minutes



RabbitMQ is one of the most popular opensource message broker/Queuing engine available in the market.. It has been used as communication(Message Oriented) bridge in many software architectures.. Communication between Microservices is one of the obvious use case where we can use MQ to make things simple .. RabbitMQ makes communication between services easy with it's simple messaging system.. Rabbit MQ supports multiple protocols like AMQP

In one of our projects, We've used it to delegate the heavy processing things to worker process written in python form single threaded NodeJs process.. thus it makes easy to scale our services and opened the doors to polyglot architecture for our services... we enjoyed it a lot.. So I thought to write a simple article which will help people to get start with RabbitMQ in 10 minutes..

Installing RabbitMQ (In Ubuntu based systems)

First update source-list and add signing key

sudo apt update wget -O - 'https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc' | sudo apt-key add -

Now add repository to source list

echo "deb https://dl.bintray.com/rabbitmq/debian $(lsb_release -cs) main erlang" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list

Now update the source list and install the RabbitMQ ....

sudo apt update sudo apt install rabbitmq-server -y

The server is started as a daemon by default when the RabbitMQ is installed.

Verify the installation.. with the following command...

sudo systemctl status rabbitmq-server.service
shivaraj@shivaraj-Aspire-A315-21:~$ sudo systemctl status rabbitmq-server.service [sudo] password for shivaraj: ● rabbitmq-server.service - RabbitMQ broker Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-09-15 15:25:31 IST; 1h 29min ago Main PID: 1217 (beam.smp) Status: "Initialized" Tasks: 86 (limit: 4486) CGroup: /system.slice/rabbitmq-server.service ├─1217 /usr/lib/erlang/erts-9.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 1280000 -K true -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -p ├─1333 /usr/lib/erlang/erts-9.2/bin/epmd -daemon ├─1572 erl_child_setup 1024 ├─1624 inet_gethost 4 └─1625 inet_gethost 4 Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: ## ## Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: ## ## RabbitMQ 3.7.7. Copyright (C) 2007-2018 Pivotal Software, Inc. Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: ########## Licensed under the MPL. See http://www.rabbitmq.com/ Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: ###### ## Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: ########## Logs: /var/log/rabbitmq/rabbit@shivaraj-Aspire-A315-21.log Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: /var/log/rabbitmq/rabbit@shivaraj-Aspire-A315-21_upgrade.log Sep 15 15:25:26 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: Starting broker... Sep 15 15:25:31 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: systemd unit for activation check: "rabbitmq-server.service" Sep 15 15:25:31 shivaraj-Aspire-A315-21 systemd[1]: Started RabbitMQ broker. Sep 15 15:25:32 shivaraj-Aspire-A315-21 rabbitmq-server[1217]: completed with 3 plugins. shivaraj@shivaraj-Aspire-A315-21:~$

And also I'll show you small how to with NodeJS and RabbitMQ.. for this you need to have Node installed in your system.. If you haven't installed NodeJs you can check the instructions here..

First you need to install amqplib.. it's RabbitMQ client for NodeJs..

npm install amqplib

Then create two files named.. sender.js and receiver.js

Now you can run the receiver.js and and publisher.js and you can see the output like one shown below...

node sender.js
shivaraj@shivaraj-Aspire-A315-21:~/mqtest$ node sender.js Connected Published New Task Published New Task Published New Task
node receiver.js
shivaraj@shivaraj-Aspire-A315-21:~/mqtest$ node receiver.js Connected Do Something.... Do Something.... Do Something.... Do Something.... Do Something....

If you want to use it with other languages.. please check official guide.. https://www.rabbitmq.com/getstarted.html

That's it for now.. If you like.. don't forget to share it guys.. You can follow us on fb.com/opensourceinside and also subscribe our channel on Youtube..


Friday, August 31, 2018

How TO Install Docker On Ubuntu 18.04/16.04

How To Install Docker In Ubuntu Linux 14.04, 16.04 And 18.04



I'm going to show you how to install and run Docker in Ubuntu Linux

First update source-list

sudo apt update

Install required dependencies..

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then.. Add docker's official GPG key with following command..

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

The above commands output will looks like..

shivaraj@shivaraj-Aspire-A315-21:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - OK shivaraj@shivaraj-Aspire-A315-21:~$

Now add Docker Community Edition's repository to list..

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
shivaraj@shivaraj-Aspire-A315-21:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease Hit:2 http://packages.microsoft.com/repos/vscode stable InRelease Ign:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease Get:4 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB] Hit:5 http://dl.google.com/linux/chrome/deb stable Release Hit:6 http://in.archive.ubuntu.com/ubuntu bionic InRelease Hit:7 https://deb.opera.com/opera-stable stable InRelease Get:8 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB] Get:9 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Hit:10 http://archive.canonical.com/ubuntu bionic InRelease Hit:11 http://linux.teamviewer.com/deb stable InRelease Hit:12 http://linux.teamviewer.com/deb preview InRelease Hit:13 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release Hit:15 https://repo.skype.com/deb stable InRelease Get:16 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:17 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [1,708 B] Hit:18 https://download.sublimetext.com apt/stable/ InRelease Fetched 313 kB in 2s (128 kB/s) Reading package lists... Done shivaraj@shivaraj-Aspire-A315-21:~$

Now update the package index once again..

sudo apt update

Now Install the docker..

sudo apt install docker-ce
shivaraj@shivaraj-Aspire-A315-21:~$ sudo apt install docker-ce Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: aufs-tools cgroupfs-mount pigz The following NEW packages will be installed: aufs-tools cgroupfs-mount docker-ce pigz 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 40.4 MB of archives. After this operation, 198 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce amd64 18.06.1~ce~3-0~ubuntu [40.2 MB] Get:2 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 pigz amd64 2.4-1 [57.4 kB] Get:3 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 aufs-tools amd64 1:4.9+20170918-1ubuntu1 [104 kB] Get:4 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6,320 B] Fetched 40.4 MB in 12s (3,510 kB/s) Selecting previously unselected package pigz. (Reading database ... 273749 files and directories currently installed.) Preparing to unpack .../archives/pigz_2.4-1_amd64.deb ... Unpacking pigz (2.4-1) ... Selecting previously unselected package aufs-tools. Preparing to unpack .../aufs-tools_1%3a4.9+20170918-1ubuntu1_amd64.deb ... Unpacking aufs-tools (1:4.9+20170918-1ubuntu1) ... Selecting previously unselected package cgroupfs-mount. Preparing to unpack .../cgroupfs-mount_1.4_all.deb ... Unpacking cgroupfs-mount (1.4) ... Selecting previously unselected package docker-ce. Preparing to unpack .../docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb ... Unpacking docker-ce (18.06.1~ce~3-0~ubuntu) ... Setting up aufs-tools (1:4.9+20170918-1ubuntu1) ... Setting up docker-ce (18.06.1~ce~3-0~ubuntu) ... Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service. Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket. Processing triggers for ureadahead (0.100.0-20) ... ureadahead will be reprofiled on next reboot Setting up cgroupfs-mount (1.4) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... Processing triggers for systemd (237-3ubuntu10.3) ... Processing triggers for man-db (2.8.3-2) ... Setting up pigz (2.4-1) ... Processing triggers for ureadahead (0.100.0-20) ... shivaraj@shivaraj-Aspire-A315-21:~$

The Docker daemon starts automatically.

Verify the installation.. with the following command...

sudo docker run hello-world
shivaraj@shivaraj-Aspire-A315-21:~$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 9db2ca6ccae0: Pull complete Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/ shivaraj@shivaraj-Aspire-A315-21:~$

Here is the video version of above tutorial..

That's it for now.. If you like.. don't forget to share it guys.. You can follow us on fb.com/opensourceinside and also subscribe our channel on Youtube..


Sunday, May 6, 2018

Finding Application / Process Running On Particular Port In Linux Systems

Finding Application / Process Running On Particular Port In Linux Systems



Today, I'm going to show you how to find application / process running on particular port in Linux Systems.

We can use lsof command to find the process running on particular port. The syntax of lsof command to find the application running on particular port looks like following..

lsof -i :port

Summary of above code...
lsof command is used to list open files.. and the argument -i is used to list files whose ip address / port matched to specified ip address / port.

Note: If you ignore ip address / port after -i then the above command will lists processes for all ip addresses...

For example to find the process / application listening on port 80, run the following code..

lsof -i :80

The output will looks like following..

shivaraj@shivaraj-A14RM0E:~$ lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME plugin_ho 3981 shivaraj 20u IPv4 420822 0t0 TCP 192.168.0.117:33104->45.55.41.223:http (CLOSE_WAIT) shivaraj@shivaraj-A14RM0E:~$

If you omit port value... lsof -i the output will looks like following one..

shivaraj@shivaraj-A14RM0E:~$ lsof -i COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME plugin_ho 3981 shivaraj 20u IPv4 420822 0t0 TCP 192.168.0.117:33104->45.55.41.223:http (CLOSE_WAIT) node 4165 shivaraj 12u IPv4 509873 0t0 TCP *:http-alt (LISTEN) firefox 4178 shivaraj 114u IPv4 7216095 0t0 TCP 192.168.0.117:42436->server-54-230-190-100.maa3.r.cloudfront.net:https (ESTABLISHED) shivaraj@shivaraj-A14RM0E:~$

By specifying -t for lsof command we can get pid of process listening on particular port... Look at the below command signature..

lsof -t -i :port

If you want to find out pid of process listening on port 80, run the following code..

lsof -t -i :80

The above commands output will looks like..

shivaraj@shivaraj-A14RM0E:~$ lsof -t -i :80 3981 shivaraj@shivaraj-A14RM0E:~$
How to find and kill the process running on particular port..

That's it for now.. If you like don't forget to share it guys.. You can follow us on fb.com/opensourceinside and also subscribe our channel on Youtube..


Thursday, February 1, 2018

How To Install Linux Kernel 4.15 (Includes Patches for Meltdown and Spectre) In Ubuntu Linux And Its Derivatives

How To Install Linux Kernel 4.15 (Includes Patches for Meltdown and Spectre) In Ubuntu Linux And Its Derivatives


As usual, Sunday (28, JAN 2018), Linux creator Linus Torvalds officially announced the final release of Linux Kernel 4.15, Which includes patches for two critical bugs Meltdown and Spectre. Apart from patches for Meltdown and Spectre bugs there also some other inresting things comes with Linux 4.15, such as support for the RISC-V architecture, support for AMD Secure Encrypted Virtualization, as well as support for the User-Mode Instruction Prevention feature on Intel CPUs..

As Soon as it was released, immediately it will be available for rolling release distros such as Arch Linux, Solus, or even openSUSE. Soon it will be available for Fedora users also.. But for Ubuntu, you have to manually install Linux 4.15, if you want to upgrade your current Linux kernel installed in your system. Here I am going to show you how to install Linux 4.15 in Ubuntu Linux and It's derivatives.

Warning : The Linux kernel is a critical element of the system. To do the upgrade costs when one of your hardware devices is not working properly, and the new kernel may fix this problem. But at the same time installing a new kernel unnecessarily can lead to undesirable regressions, such as: no network connection, no sound or even the inability to boot the system, so install a new kernel on your own risk.

Installation Steps :

Before starting... Update your system package source list and upgrade all installed packages to latest version by running following commands..

sudo apt-get update; sudo apt-get upgrade

Now make a new folder/directory to download and store required binaries files...

mkdir linux4.15 && cd linux4.15

Now download required files with following command..

For 64 bit:

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb; wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb; wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb;

For 32 bit:

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb; wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_i386.deb; wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_i386.deb;

Or if you want to download manually.. you can download from here.. and put them in one directory.
if you are downloading manually.. download correct binaries for your architecture...
If you are not sure about your OS architecture.. Run getconf LONG_BIT command.. This will tell you whether the kernel is 64 bit or 32 bit..
See More On Finding System Architecture..

Now Install Downloaded Packages..

sudo dpkg -i *.deb

Now Reboot the system and enjoy.. :)

Here's the video version of above tutorial ...

That's all for now.. Don't Like us on fb.com/opensourceinside


Wednesday, February 8, 2017

Disabling/Changing Drum Beat Sound On Ubuntu Startup

Disabling/Changing Drum Beat Sound On Ubuntu Startup


Ubuntu would always play, Drum Beat sound on Ubuntu system startup, But some people may find this is annoying and want to disable or want to change it with their own custom alert sound... Unfortunately, Ubuntu haven't provided a simpler GUI way to disable/customize the startup sound (so far I know..).

However, it's not that much hard to disable/change the startup sound. In this post I will show you how to change/disable startup sound in Ubuntu.

Mostly, All sounds which generally used by Ubuntu are .ogg format sound files and they are located in /usr/share/sounds/ubuntu/. We can disable or change the startup sounds just by renaming/replacing the corresponding sound file...

Disable Startup Sound :

To disable startup sound we just have to rename the file named system-ready.ogg which is located in /usr/share/sounds/ubuntu/stereo/. Just run the below command to disable the startup drum beat in your Ubuntu system..

sudo mv /usr/share/sounds/ubuntu/stereo/system-ready.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg.old

Changing The Startup Sound With One You Like To Hear..

We can change/customize our startup sound just by replacing existing system-ready.ogg with our own sound file (should be in .ogg format) with existing name (system-ready.ogg)..

I have already mentioned that Ubuntu use .ogg file format for its alert sounds.. So your new sound file also should be in that format.. Don't worry, If you don't have your sound file in .ogg format.. You can just convert your sound file from current format to .ogg .. There are many tools available to do that for you.. Even you can convert it in online... media.io is one of such kind of web site where you can freely convert your sound file to .ogg format..

Now, if you have your new sound file with .ogg format in your hands.. Then... Just disable existing sound by running following commands..

sudo mv /usr/share/sounds/ubuntu/stereo/system-ready.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg.old sudo cp /PATH_TO_YOUR_NEW_SOUND_FILE/ /usr/share/sounds/ubuntu/stereo/system-ready.ogg
Please, Don't forget to replace /PATH_TO_YOUR_NEW_SOUND_FILE/ with your files path..

For Example..

If you have your new file named beep.ogg in your Downloads directory.. Then you have to execute following command....

sudo cp ~/Downloads/beep.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg
I have tested it in my Ubuntu Linux 16.04 LTS and Hope will work in other versions too...

That's it.. Now just restart your system and see the change... Follow us on facebook.


Friday, December 30, 2016

How To Get Rid Of "N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension" Warning Message In Ubuntu 16.04

How To Get Rid Of
"N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension"
Warning Message In Ubuntu 16.04

shivaraj@shivaraj-A14RM0E:~$ sudo apt upgrade [sudo] password for shivaraj: Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension shivaraj@shivaraj-A14RM0E:~$

As usual, today morning, I ran sudo apt-get -y upgrade in my Ubuntu Linux box.. But at the end of the upgrade I got "N: Ignoring file '20auto-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension".... I googled about it to find the reason for this kind of nasty warnings...

Finally, found the reason and solution for this issue from Ask Ubuntu...

According to AskUbuntu, The reason for this warning message is, the update contains a new version of configuration file.. but if you choose system package manager to keep old one itself... then the new config file would just exists there, along with old configuration file...

So every time we use package manager, it is printing file with invalid extension warning message... However, it will not cause any issues.. We can just ignore it... But if you want to get rid of this warning message.. Just follow the bellow instructions...

We can get rid of this message by removing redundant new configuration file which came with updates..
Just execute bellow command to remove the new redundant configuration file.. So that we can get rid of warning message..

sudo rm -f /etc/apt/apt.conf.d/20auto-upgrades.ucf-dist

Now run sudo apt upgrade... This time you wouldn't get warning message..

shivaraj@shivaraj-A14RM0E:~$ sudo rm -f /etc/apt/apt.conf.d/20auto-upgrades.ucf-dist shivaraj@shivaraj-A14RM0E:~$ sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. shivaraj@shivaraj-A14RM0E:~$

Thats all... Follow us on facebook fb.com/opensourceinside..


Sunday, October 30, 2016

Installing Rust On Ubuntu 16.04 and 14.04

Installing Rust On Ubuntu 16.04 and 14.04


Rust Programming Logo

Rust, also known as Rust-Lang, is a new programming language which aims safety, speed and concurrency... It's designed to create highly concurrent and secure Applications/Systems by having more a number of compile-time safety checks that produce no runtime overhead, while eliminating all data races.... According to documentation, Rust also aims to achieve ‘zero-cost abstractions’ even though some of these abstractions feel like those of a high-level language.

Here.. We are going to see how to install and getting start with rust on Ubuntu Linux 16.04 & 14.04

Step 1: Update Source(Package) List

Open terminal and run the following commands to ensure that package source list is upto date and also install curl...

For Ubuntu 16.04

sudo apt update && sudo apt -y install curl

For Ubuntu 14.04

sudo apt-get update && sudo apt-get -y install curl

Step 2: Install Rust

Now run the following command which download and runs a script that will install rust on your Linux box..

wget -O - https://static.rust-lang.org/rustup.sh | sh

Or If you have curl installed..

curl -sSf https://static.rust-lang.org/rustup.sh | sh

Rust packages are available in three different release channels namely stable, beta and nightly... The above command will install current stable version of rust on your system..

If you want to install beta version(A preview of the upcoming stable release, intended for testing) of rust, run the following command..

wget -O - https://static.rust-lang.org/rustup.sh | sh -s -- --channel=beta

Or

curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=beta

If you want to enjoy features that are not available in stable and beta channels, install rust from nightly release channel.. (Be aware, Features which are available in nightly channel are unstable may change anytime before they get into beta channel)

wget -O - https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly

Or

curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly

Step 3: Verify The Installation

You can verify the successful installation of rust in your System by running rustc -V . You will get output similar to output shown below..

shivaraj@shivaraj-A14RM0E:~$ rustc -V rustc 1.12.1 (d4f39402a 2016-10-19)

Get start with rust..

If you see output similar to above.. that means your installation was successful.. So now here i am going to show how to write a hello world program in rust and run it..

Create file named main.rs, open it with your favorite text-editor, then copy and paste the following code in that file and save it...

fn main() { println!("Hello, World"); }

Now compile it with rustc main.rs, you will get executable file named main .... execute it by running ./main .. You will see.. "Hello, World" text on your screen..

shivaraj@shivaraj-A14RM0E:~$ ./main Hello, World shivaraj@shivaraj-A14RM0E:~$

Here, You Can Learn Rust Programming..


Here is the video for above tutorial...



Happy Coding !!

Friday, September 16, 2016

Installing phpMyAdmin in Ubuntu 16.04

Installing phpMyAdmin in Ubuntu 16.04


phpMyAdmin is an open source tool used for the administration/management of MySQL or MariaDB with the use of a web browser. In addition to offering the capability to perform administration tasks such as creating, editing, or deleting databases, and managing users and permissions, phpMyAdmin provides a graphical user interface to do all of these tasks and more. Here, we are going to see how to install, up and run phpMyAdmin on Ubuntu 16.04.

Install phpMyAdmin

Before you start installing phpmyadmin, install PHP, apache and MySql or similar Db..

Then.. Run following command .. to install phpMyadmin on your Ubuntu installation...

sudo apt -y update && sudo apt install phpmyadmin

Continue with typing Y once the installation prompts you with Do you want to continue [Y/n]? Like in the image below.


Now we are prompted with dialog selecting our web server, in our case we are selecting apache2 like shown below.


Select <Yes> as we just want a basic installation like shown below.


Now provide a password for phpMyAdmin to use. So that it can register with the MySQL database itself. (Need not to be the same as the MySQL root user)


Enter in the phpMyAdmin password you created in last step to confirm it as follows.


phpMyAdmin is now installed, but, still we have a few more things to do.

Testing phpMyAdmin

Now we will test phpMyAdmin! Open your favorite Web Browser..
and Navigate to http://localhost/phpmyadmin/

If you end up with a page that looks like one shown below... means, phpMyadmin was installed successfully on your system..


Now lets login, the default username for phpMyAdmin is root and the password is what you have entered while installing phpMyadmin... Enter as follows.

Username: root

Password: What you selected earlier

Select Go to login.

When you log in, you'll see the user interface, which will look something like this:


Hi friends, If you found any issue or typo error, please feel free to report it.. You can report it on our Facebook Page via message (www.fb.com/opensourceinside) .

Wednesday, August 31, 2016

Installing ElasticSearch On ubuntu 16.04 and 14.04

Installing ElasticSearch On ubuntu 16.04 and 14.04



Updated On DEC 2016: Installation Script In Method 2 updated for installation of elastic search 5.x

Elasticsearch is a highly scalable open-source full-text search and analytics engine build on top of Apache Lucene(A free and open-source information retrieval software library). It allows you to store, search, and analyze big volumes of data quickly and in near real time. It is generally used as the underlying engine/technology that powers applications that have complex search features and requirements.

Here we are going to see, How to install and setup elasticsearch on Ubuntu Linux 16.04 and 14.04..
Here I am going to show you two ways to install elasticsearch on Ubuntu Linux..

The first one is manual installation of elasticsearch.. You have to follow instructions one by one ..
The second one is an easy way, there we use shell-script to install the elasticsearch as it would take care of all things.. The script will install and setup elasticsearch for you..

Installation :

Method 1 :

First things first, Before we start to install elasticsearch, we need to install Java Runtime Environment (JRE).. because Elasticsearch itself written in the Java. (Elasticsearch requires Java 7 or higher).
This step shows you how to install OpenJDK-8.
First, update the list of available packages by running apt-get update.

sudo apt-get update

Then, install OpenJDK with the command:

For Ubuntu 16.04 :

sudo apt-get -y install openjdk-8-jdk openjdk-8-jre

For Ubuntu 14.04 :

sudo add-apt-repository -y ppa:openjdk-r/ppa && sudo apt-get update && sudo apt-get -y install openjdk-8-jdk openjdk-8-jre

To verify your JRE is installed and can be used, run the command: java -version

The result should look like this:

openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
If You Have Already Installed Version of JAVA in Your System.. Please Set OpenJDK 8 as Default Version.. Otherwise you may encounter problems while starting elasticsearch.. You can configure multiple versions of java by running following command.. sudo update-alternatives --config java Now, select apropriate version of JAVA..
to verify the java version run.. java -version

Download and Install Elasticsearch :

Elasticsearch can be downloaded directly from official site as zip, tar.gz and deb

I will recommend.. Installing from zip or tar archive.. Because as far as I knew it is the best way to get Elasticsearch on Ubuntu ... from my experience the another way (installing from .deb) is very worst... has many nasty issues(tried on Ubuntu 16.04)..

Download the archive

cd && wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.3.5/elasticsearch-2.3.5.zip

The above command downloads the zip archive, make sure that you have unzip installed in your system... if don't have installed unzip in your system.. run the following command.. to install unzip

sudo apt-get install unzip

Now unzip/decompress the downloaded archive.. you can do this with command given below..

unzip elasticsearch-2.3.5.zip

Move Extracted/unzipped directory to /opt :

We don't want to pollute our home folder and make it ugly with too many folders apart from default one.. and moving elasticsearch to /opt directory will also make it available to other users in your system too..

If you already have directory named elasticsearch-* in your /opt directory you will/may encounter problems while trying to move our newly extracted folder into /opt . so better remove them before you move our new elasticsearch folder into /opt. to do this run following command.... sudo rm -r /opt/elasticsearch-2*

Now move newly extracted elasticsearch directory to /opt with following command..

sudo mv elasticsearch-2.3.5/ /opt/

Now your elasticsearch is ready to use, You can run it with following command..

/opt/elasticsearch-2.3.5/bin/elasticsearch

But it's so convenient, if we can able to start it from commandline.. by simply typing 'elasticsearch' .. just like normal system commands.. to do so.. we have to create a symbolic link for elasticsearch in /bin folder.. Run following commands....

First remove symbolic link if one already exists..

sudo rm /bin/elasticsearch

now.. create new symbolic link ...

sudo ln -s /opt/elasticsearch-2.3.5/bin/elasticsearch /bin/

That's it .. now you can start elasticsearch just by typing "elasticsearch" in your terminal window..

Now the other method (method 2) show you the easiest way of getting elasticsearch up and running on your Ubuntu installation..

Method 2 :

In this method ... You just need to run the following code ... the script will take care of remaining things..

wget -O - https://raw.githubusercontent.com/shivarajnaidu/UV-Shell-Scripts/master/ElasticSearch-Installation-Scripts/elasticsearch-installation-script-for-ubuntu.sh | bash -s

Update :

The installation script is updated to support installation of elasticsearch v5.x. If you want to install elasticsearch 5.x, just run above command with argument '5' (with out quotes).

wget -O - https://raw.githubusercontent.com/shivarajnaidu/UV-Shell-Scripts/master/ElasticSearch-Installation-Scripts/elasticsearch-installation-script-for-ubuntu.sh | bash -s 5

Test your Elasticsearch installation

Start elasticsearch by typing "elasticsearch" on your command-line..
Let's ensure that everything is working well... open terminal and Run following..

elasticsearch
Elasticsearch should now be running on port 9200. Do note that Elasticsearch takes some time to fully start, so running the curl command below or checking from browser immediately might fail. It shouldn't take longer than ten seconds to start responding, so if the below command fails, something else is likely wrong. Ensure the server is started by running

To test elasticsearch run following command in terminal..

curl -X GET 'http://localhost:9200'

or even you can check from your web browser by visiting http://localhost:9200

if elasticsearch works well.. You should see the following response..

shivaraj@shivaraj-A14RM0E:~$ curl -X GET 'http://localhost:9200' { "name" : "Suicide", "cluster_name" : "elasticsearch", "version" : { "number" : "2.3.5", "build_hash" : "90f439ff60a3c0f497f91663701e64ccd01edbb4", "build_timestamp" : "2016-07-27T10:36:52Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }, "tagline" : "You Know, for Search" } shivaraj@shivaraj-A14RM0E:~$
Hi friends, If you found any issue or typo error, please feel free to report it.. You can either open an issue on github or you can also report it on our Facebook Page via message (www.fb.com/opensourceinside) .