Posts

Showing posts with the label ubuntu

Install Elastic search 5.x in ubuntu 20, 18, 16

Look for OpenJDK in APT sudo apt search openjdk Install OpenJDK 8 sudo apt-get install openjdk-8-jdk Add the proper GPG key for ElasticSearch wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - Make sure to install/update transport sudo apt-get install apt-transport-https Save the repo definition echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list Update APT and install ElasticSearch from APT sudo apt-get update && sudo apt-get install elasticsearch Reload the daemon sudo /bin/systemctl daemon-reload Allow ElasticSearch to start on boot sudo /bin/systemctl enable elasticsearch.service Lets fire up ElasticSearch... sudo systemctl start elasticsearch.service Lets see if we have some logs sudo ls -la /var/log/elasticsearch/ Have a look at the logs and make sure that ElasticSearch has properly initiated sudo cat /var/log/elasticsearch/elasticsearch.

Some important and unknown(least used) ruby methods.

 1) inject or reduce      When called, the inject method will pass each element and accumulate each sequentially.     ex:         [1,2,3].inject(:+)    => ((1+2)+3))   //we have can any operator here i.e +,-,*,/,%         OR         [1,2,3].inject{|sum, value| sum + value } => 1 iteration:  (1 + 2)                                                                                             =>  2 iteration: (3(1st iteration sum)+3)            we  can also pass it a default value or base value for the accumulator.     ex:          [1,2,3].inject(0, :+)    => (0+(1+2)+3)) //so here initial value for sum is 0.          We can also use inject menthods for building hash's from the array's     ex:           [[:book, "data structure"], [:price, "400rs"]].inject({}) do |result, element|               result[element.first] = element.last               result           end            #=> {:book=>"data structure", :price=>"400rs&qu

How to Access RabbitMQ Management Plugin rabbitmqadmin Command Line

1) Enable rabbitmq_management   sudo rabbitmq-plugins enable rabbitmq_management 2) Restart rabbitmq-server sudo service rabbitmq-server restart 3) Access GUI http://rabbitmq-server-ip:15672/ username:guest password:guest //you can check ip sudo service rabbitmq-server status command 4) Access  rabbitmqadmin Command Line http://rabbitmq-server-ip:15672/cli a) Download  rabbitmqadmin script wget http://rabbitmq-server-ip:15672/cli/rabbitmqadmin b) Change permission chmod +x rabbitmqadmin 5) rabbitmqadmin Commands a) Help ./rabbitmqadmin --help b)List all exchanges ./rabbitmqadmin -u guest -p cloud -H localhost list exchanges -u : username -p : password c) List all queues   ./rabbitmqadmin -u guest -p cloud -H localhost list queues d) Get help of subcommands ./rabbitmqadmin help subcommands ./rabbitmqadmin help subcommands | grep queue ./rabbitmqadmin help subcommands | grep exchnage ./rabbitmqadmin help subcommands | grep binding

How to Install or Uninstall Redis on Ubuntu 18.04

Step 1 – Open the terminal step 2. Update APT Repository Cache   (1)check the version table on your operating system     The package you are searching for is named redis-server. You can check its package info with apt show redis-server sudo apt-cache policy redis-server or sudo apt show redis-server The dataset is stored entirely in memory and periodically flushed to disk. (2)add PPA repository to your OS: sudo add-apt-repository ppa:chris-lea/redis-server (3)In order to install Redis, you first need to update the APT repository cache of your Ubuntu. You can do that with the following command: Update the apt-get packages index files and also update existing packages to the newest versions by using the following commands: sudo apt-get update  sudo apt-get upgrade step 2. Install Redis on Ubuntu Using the APT Command sudo apt-get install redis-server step 3. Check Redis Version redis-cli --version step 4:check if the Redis is running. Once t

unable to install ruby 2.2 in ubuntu 18.04

Try with this commands 1) Install rvm following instructions for Ubuntu on  https://github.com/rvm/ubuntu_rvm 2) rvm install ruby 2.2.10 3) rvm install ruby 2.2.10 --with-gcc=gcc if its not work then try with this  1. sudo apt purge libssl-dev && sudo apt install libssl1.0-dev 2. rvm install 2.3.5 --autolibs=disable

How to exit vim editor in Ubuntu || How to set default editor Ubuntu

Image
Set Default editor in ubuntu sudo update-alternatives --config editor Type 2 and hit enter nano will be set as default editor

install wine in ubuntu

Step 1 – Setup PPA sudo dpkg --add-architecture i386 wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - ###  Ubuntu 18.10  sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ cosmic main' ###  Ubuntu 18.04  sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' ###  Ubuntu 16.04  sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main' Step 2 – Install Wine on Ubuntu sudo apt-get update sudo apt-get install --install-recommends winehq-stable sudo apt-get install aptitude sudo aptitude install winehq-stable Step 3 – Check Wine Version wine --version wine-4.0 How to Use Wine (Optional)? wine full_file_full_specified_name.exe