Free Cloud Hosted Redis Service

Free Cloud Hosted Redis Service

Redis Labs is a free Cloud Hosting service that provides a Redis storage hosted in different cloud platforms such as Amazon Web Service (AWS), Google Cloud Platform (GCP) and Microsoft Azure.

In this Blog, we are going to learn How to create a new account in Redis Labs, an new Subscription and an new database by using free cloud hosted service.

create a new account

To get started free, go to the Redis Labs home page, provide your Email ID and click the “GET STARTED FREE” button to create a new account in Redis Labs.

Get started

After clicked the “Get Started Free” button, you will receive an account activation email to your mail.

Account Activation email

Click the “Activate Now” button to activate an account in Redis Labs. After clicked the “Activate Now” button, request will redirect you the “Finish setting up your account” page. Provide all the details such as First Name, Last Name, Business, Country and Password click “Continue” button on this page.

Finish setting up your account

After clicked the “Continue” button, Create a new Subscription on the Redis Labs.

Create Subscription

Click the “Create your subscription” button, choose a Free 30MB plan on the Select your Plan screen.

Free 30 MB Plan

After selected the Free 30 MB plan, create a new subscription by selecting the Cloud, providing a Subscription name and choosing the Free plan 30 MB on the create subscription page.

New Subscription page

Click the “Continue” button on the New Subscription page, and create a new database by providing a Database name, and selecting the Protocol Redis on the Create database screen. Click the “Activate” button to create a new database. Since we are selected a Free plan, so data replication has been disabled and there is no Data Persistence.

Create Database

After clicked the “Activate” button, Database will be created and on the configuration page, you can find out the “Endpoint URL” to connect the database from anywhere in the world by using Redis client.

View Database – Configuration

Copy the Endpoint URL and Redis Password to connect the Redis Database by using Redis client. Use the below command syntax to connect the remote Redis database by using Redis client.

redis-cli -h <hostname> -p <portnumber>

In my case, I have connected the Redis database by using below command.

redis-cli -h redis-18772.c74.us-east-1-4.ec2.cloud.redislabs.com -p 18772
Connect Redis

After connected the remote Redis, provide the password to connect the database. Use the below command to provide the password (Copy it from the Redis Database Configuration page).

auth <password>
set authentication

Execute below Redis commands to create and get the key pair data by using Redis client.

set employee John

get employee
Redis commands

We have successfully created Free Cloud Hosted Redis and connected the Remote Redis by using the Redis client.

Advertisements

How to Install Redis on Linux Debian 9?

How to Install Redis on Linux Debian 9?

Redis is an Open Source NoSQL database. It is very popular, capable and remarkably fast In-Memory database. It stores the data in key-value pair and no doubtfully says it is a NoSQL database.

Installing Redis on Linux Debian 9, is very simple and follow the steps given below one by one to install the Redis on Linux Debian 9.

update all existing packages

Before Installing Redis, update all existing packages on the Linux Debian 9 by executing the below command.

sudo apt update
sudo apt-get update

install redis server

Install Redis Server by executing the below command on the Linux Debian 9.

sudo apt-get install redis-server

Redis will start installing on the Linux Debian 9 automatically and also starts the Redis service.

configure systemd process

There is an important configuration needs to be update after installing the Redis server. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word “supervised” and change the default value from “no” to “systemd” to manage and monitor the Redis service.

supervised process of Redis service

allow connections from anywhere

By Default, Redis is binding to localhost. Execute the below steps to allow the connections from anywhere to access the Redis. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word bind 127.0.0.1 and make sure it is un-commented out (remove the # if it exists)

binding to localhost

configure redis password

Follow the below steps to configure the Redis password. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word “requirepass” and set the secure password to access the Redis and make sure it is un-commented out (remove the # if it exists)

Require pass for Redis

Then, Restart the Redis service now by executing the below command.

sudo systemctl restart redis 

redis client

Execute the below command on the terminal to connect the Redis server by using Redis client.

redis-cli

The Redis client terminal will open on the same console and we can start execute the Redis commands.

set authentication on the redis client

Since we have secured the password, we should set the Authentication on the Redis client before start executing the Redis commands. Use the below command to set the password on the Redis client to access the Redis server.

auth foobared
Authentication on the Redis client

ping pong command

To check the connection between Redis server and client execute the following command on the Redis client terminal.

PING

If you get the acknowledgement, “PONG” on the console, then the connection between the server and client is stable.

ping and pong with Redis client

Execute the below Redis commands on the Redis client to store the data as Key-Pair value on the Redis server.

set employee John

get employee
set and get Redis key pair data

monitor and manage the redis service

By executing below commands, we can monitor and manage the Redis service on the Linux Debian 9.

To view the current status of the Redis service.

sudo systemctl status redis

To stop the Redis service.

sudo systemctl stop redis

To start the Redis service after it got stopped.

sudo systemctl start redis 

If any Redis configuration got update, we should restart the Redis service. Execute the below command to restart the Redis service.

sudo systemctl restart redis 

By default Redis service will start when the system starts. To disable that execute the below command.

sudo systemctl disable redis

Execute the below commands to enable the Redis service once again after it got disabled.

sudo systemctl enable redis-server.service

How to Install Redis on Windows 10?

How to Install Redis on Windows 10?

Redis is an Open Source NoSQL database. It is very popular, capable and remarkably fast In-Memory database. It stores the data in key-value pair and no doubtfully says it is a NoSQL database.

installation on windows 10

We can Install Redis on windows 10 by using two ways. They are given below.

  • Zip file
  • MSI Installer

by using zip file

Download the latest and stable release of Redis on Windows 10 Zip file (Redis-x64-3.0.504.zip) from the official GitHub site of Microsoft archive. The Download URL has been given below.

https://github.com/MicrosoftArchive/redis/releases

After download the zip file, extract it on the anyone of the location in your machine. In my system, I have downloaded and extracted on the path “C:\softwares”.

Redis File Path after extract

Now go inside on the folder “Redis-x64-3.0.504” and find the redis-server.exe file.

Redis Server EXE file

Double click the “redis-server.exe” file, then Redis server will start to run on your machine with default port 6379.

Redis server console

It is time to start the Redis Client. You can find “redis-cli.exe” file on the same folder “Redis-x64-3.0.504”.

Redis client EXE file

Double click the “redis-cli.exe” file, then Redis client will start to run on your machine to execute the Redis commands.

Redis client console

Execute the following command on the Redis client console to check the connection between Redis server and client.

PING

The console will display PONG after execute the PING command on the Redis client console.

PING and PONG

Execute the following commands to store and retrieve a new Key Pair data on the Redis server by using Redis client.

set employee John

get employee
set and get command to store the data in Redis server

by using msi installer

Download the latest and stable release of Redis on Windows 10 (Redis-x64-3.0.504.msi) MSI Installer file from the below link.

https://github.com/MicrosoftArchive/redis/releases

I have downloaded the installer file and saved into the “C:\softwares” path on my machine. You can download it into the anyone of the location on your drive.

Redis installer file

After download the installer file, double click on it and start install the Redis on Windows 10 machine.

Welcome screen of Redis Windows setup.

Welcome screen of Redis Windows setup.

Click “Next” button on the welcome screen, Accept the License agreement and click “Next” button on the installation wizard.

License Agreement wizard

Click on the check box “Add the Redis Installation folder to the PATH environment variable” on the Destination folder wizard. And then click “Next” button on this screen.

Destination folder wizard

Click “Next” on the Port number and firewall exception wizard with the default port number. If you want to change port number of Redis server, then you can change it on this wizard.

Port number and Firewall exception

Click “Next” on the Memory Limit wizard. The default Memory limit is 100 MB. If you want to set the Max Memory limit, then you can change it on this wizard.

Memory Limit

Click “Install” button on the Install Redis on Windows wizard.

Redis Installation wizard

Installation is In-Progress.

Installation In-Progress window

Click “Finish” on the Redis Installation completed wizard.

Redis Installation completed wizard

After the installation completed, Redis server will be started automatically on the Windows 10 machine. You can see the Redis server status on the “Services” screen. If the Redis service is not started automatically, you can start it manually here.

Services

Now go to the Redis installation folder and double click the “redis-cli.exe” file. I have installed the Redis on the “C:\Program Files\Redis” path.

Redis installation folder

Then Redis client will start to run on your machine to execute the Redis commands.

Redis client console

Execute the following command on the Redis client console to check the connection between Redis server and client.

PING

The console will display PONG after execute the PING command on the Redis client console.

PING and PONG

Execute the following commands to store and retrieve a new Key Pair data on the Redis server by using Redis client.

set employee John

get employee
set and get command to store the data in Redis server

Redis has been installed successfully on the Windows 10 machine by using ZIP and MSI installer.

How to install MongoDB on Linux Debian 9?

How to install MongoDB on Linux Debian 9?

The MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need. It stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time. The document model maps to the objects in your application code, making data easy to work with. Ad hoc queries, indexing, and real time aggregation provide powerful ways to access and analyze your data. MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use by www.mongodb.com.

In this blog, we will install the MongoDB on Linux Debian 9. The step by step procedure has been given below to install MongoDB.

First, update all the existing packages by using below command.

sudo apt update

Then, install the MongoDB package by using apt install command.

sudo apt install -y mongodb

The above command installs the latest stable version of MongoDB and also it starts the MongoDB service automatically after the installation complete.

Now, this the time to verify the MongoDB service has been started or not on the Linux Debian 9.

Execute the below system control status command to see the status of MongoDB service.

 sudo systemctl status mongodb 

You will see the below output on the console.

Then, verify the MongoDB server connection by using diagnostic command.

mongo --eval 'db.runCommand({ connectionStatus: 1 })'

After executed the command, you will see the below output on the console with Database server version and OK attribute.

MongoDB shell version: 3.2.11
connecting to: test
{
        "authInfo" : {
                "authenticatedUsers" : [ ],
                "authenticatedUserRoles" : [ ]
        },
        "ok" : 1
}

The OK field value “1” represents, database server is running without any issues.

Below commands are used to manage the MongoDB service by using system control commands.

To view the status of the MongoDB service.

sudo systemctl status mongodb

To stop the MongoDB service.

sudo systemctl stop mongodb

To start the MongoDB service when it stopped.

sudo systemctl start mongodb

To restart the MongoDB service.

 sudo systemctl restart mongodb 

By default MongoDB service will start when the system starts. To disable that execute the below command.

sudo systemctl disable mongodb

Execute the below command to enable the MongoDB service when the system starts.

sudo systemctl enable mongodb

The MongoDB successfully installed on the Linux Debian 9.

How to run MySQL Docker container?

How to run MySQL Docker container?

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation. MySQL is a database management system. MySQL databases are relational. MySQL software is Open Source. The MySQL Database Server is very fast, reliable, scalable, and easy to use. MySQL Server works in client/server or embedded systems. A large amount of contributed MySQL software is available. – by dev.mysql.com

In Today’s world, most of the applications are depends on the databases. If you don’t want to setup a dedicated database server for your applications, then definitely you might go to the containerized platform.

For small and medium scale industries, running MySQL as a docker container is very specialized platform without spending money for any hardware based servers.

Before running MySQL as a docker container, the docker must be installed on your machine. If you want to know How to install Docker? Please refer the below link.

How to install Docker on Linux Debian 9?

pull mysql docker image

First step is, we need to pull the MySQL docker image from the docker hub repository. Execute the below command to pull the latest MySQL docker image from the docker hub repository.

docker pull mysql/mysql-server:latest
root@instance-1:~# docker pull mysql/mysql-server:latest
 latest: Pulling from mysql/mysql-server
 ad18637d63f5: Pull complete 
 3f16d3b57d84: Pull complete 
 e07cad553c93: Pull complete 
 98363e47b5bd: Pull complete 
 Digest: sha256:f9ab5082218fc9128f00f83bc707886b65b8cdfa4b9809315d18c9140655db2f
 Status: Downloaded newer image for mysql/mysql-server:latest
 docker.io/mysql/mysql-server:latest

view docker image

Execute the below command, to view the list of docker images and to make sure the MySQL docker image has been downloaded or not.

docker images
root@instance-1:~# docker images

REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE

mysql/mysql-server   latest              12a8d88596c0        8 days ago          294MB

run the mysql docker image as a container

Execute the below command to run the MySQL docker image as a container.

docker run -p 3306:3306 -d --name=mysql mysql/mysql-server:latest
root@instance-1:~# docker run -p 3307:3307 -d --name=mysql mysql/mysql-server:latest
de3bad95ad41de45e43f46da8faee8d6aaf6bb64bb099f6f9f8e62aee29bf073root@instance-1:~# 

where,

-p 3306: 3306 – represents exposing the MySQL port number

–name=mysql – represents the name of the container

mysql/mysql-server:latest – represents the name of the MySQL docker image

view mysql docker logs

After run the MySQL image as docker container, execute the below command to view logs and get the default “root” user password to login into the MySQL database.

docker logs mysql

where,

mysql – name of the docker container

You can see the following logs on the console with default “root” user password. Copy the password and keep it safe to login into the database.

root@instance-1:~# docker logs mysql
 [Entrypoint] MySQL Docker Image 8.0.17-1.1.12
 [Entrypoint] No password option specified for new database.
 [Entrypoint]   A random onetime password will be generated.
 [Entrypoint] Initializing database
 2019-07-30T17:58:29.705963Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server in progress as process 20
 2019-07-30T17:58:33.701238Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
 2019-07-30T17:58:35.487233Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.17) initializing of server has completed
 [Entrypoint] Database initialized
 2019-07-30T17:58:36.967680Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 67
 2019-07-30T17:58:37.669577Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
 2019-07-30T17:58:37.698884Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.17'  socket: '/var/lib/mysql/mysql.sock'  port: 0  MySQL Community Server - GPL.
 2019-07-30T17:58:37.767916Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock'
 Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
 Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
 Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
 Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
 Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
 [Entrypoint] GENERATED ROOT PASSWORD: om4fK@h0P&3MetAbOdHEfh@xRes
 [Entrypoint] ignoring /docker-entrypoint-initdb.d/*
 2019-07-30T17:58:39.891983Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.17).
 2019-07-30T17:58:41.714397Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.
 [Entrypoint] Server shut down
 [Entrypoint] Setting root user as expired. Password will need to be changed before database can be used.
 [Entrypoint] MySQL init process done. Ready for start up.
 [Entrypoint] Starting MySQL 8.0.17-1.1.12
 2019-07-30T17:58:42.287092Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
 2019-07-30T17:58:42.889227Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
 2019-07-30T17:58:42.922042Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.17'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.
 2019-07-30T17:58:43.064447Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060

docker exec

The docker exec command allows us to run the commands inside the docker container.

docker exec -it mysql bash

Then, execute the below command to login into the MySQL database.

mysql -uroot -p

Console will ask you the password, provide the default root user password took it from the container logs.

bash-4.2# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16Server version: 8.0.17Copyright (c) 2000, 2019, Oracle and/or its affiliates. 
All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. 
Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. 
Type '\c' to clear the current input statement.

mysql> 

Now, execute the SQL commands to access the MySQL database as a Docker container.

alter root user password

Execute the below command to alter the root user password.

ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';

Then, execute the below command to view the list of databases.

show databases;

MySQL successfully running as a docker container.

How to install MySQL on Windows 10?

How to install MySQL on Windows 10?

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation. MySQL is a database management system. MySQL databases are relational. MySQL software is Open Source. The MySQL Database Server is very fast, reliable, scalable, and easy to use. MySQL Server works in client/server or embedded systems. A large amount of contributed MySQL software is available. – by dev.mysql.com

MySQL is a very famous and popular open source relational database management system. Installing MySQL on Windows 10 is very easy and straight forward. This blog will help you the step by step procedure to install the MySQL on Windows 10.

download

We can download the MySQL latest version installer from the MySQL official site. The download page has been given below.

https://dev.mysql.com/downloads/installer/

Scroll down to the page, select the operating system “Microsoft Windows” and download the “mysql-installer-web-community-8.0.17.0.msi” installer by skipping the MySQL login.

MySQL Installer download page

After downloaded the installer, right click it and click “Install”.

Install MySQL

MySQL Installation will starts now.

MySQL Installer starts

Accept the License Agreement and click “Next”.

License Agreement

Choose the Setup Type “Full” and Click “Next”.

Setup Type

Click “Next” on Check Requirements window.

System Requirements

Click “Yes” if any confirmation screen prompted by the installer. (If the Python 3.7 is not installed).

Click “Execute” button on the Installation window.

Installation

All MySQL Products will start download and install automatically. After complete all the products then, click “Next” to continue.

Complete status

high availability

On the High Availability window, choose “Standalone MySQL Server/ Classic MySQL Replication” and click “Next” to continue.

High Availability

type and networking

On the Type and Networking window, Select your Server Config Type based on your choice.

Config Type

I have selected the Server Config Type is “Development Computer” and the default port number is 3306. If you want to run the MySQL on different port number than change it. Otherwise leave it as 3306 and click “Next” to continue.

Type and Networking

authentication method

On the Authentication method window, select the option “Use Strong Password Encryption for Authentication (RECOMMENDED)” to access the MySQL safely. Then click “Next” on the window to continue.

Authentication Method

account and roles

On the Account and Roles window, provide the password for “root” user and click “Check” button to validate the password and then click “Next” button to continue.

Account and Roles

windows service

On the windows service screen, Check the option “Configure MySQL Server as a Windows Service”, then provide the Windows the Service Name “MYSQL80”, then check the option “Start the MySQL Server at System Startup”, then check the option “Standard System Account” to run Windows Service as and then click “Next” button to continue.

Windows Service

apply configuration

Click “Execute” button to apply the MySQL configuration.

Apply Configuration

After applied the configuration for MySQL and then click “Finish” button to continue.

Apply Configuration – Finish

product configuration (Optional)

On the Product Configuration window, click “Next” button to configure the MySQL Router, Sample and Examples.

Product Configuration

Click “Finish” button to continue with default options on the MySQL Router configuration window.

MySQL Router Configuration

Click “Next” on the Product Configuration window to configure the Samples and Examples.

Samples and Examples

Provide the root password to check the connection and then click “Next” button to continue.

Connect to Server

Click “Execute” button to apply the configuration and run the sample and examples SQL scripts.

Apply Configuration

Click “Finish” on the Apply Configuration window, click “Next” on the Product Configuration and click “Finish” on the Installation complete window.

Installation complete

mysql workbench

MySQL Workbench will open automatically after clicked the “Finish” button.

MySQL Workbench

Click “Local Instance MySQL 55” and provide the password and click “OK” to connect the server.

Connect MySQL server

Execute the “show databases” command on the SQL editor to view the list of databases.

show databases

MySQL 8.0 has been installed successfully on windows 10.

How to install MySQL on Linux Debian 9?

How to install MySQL on Linux Debian 9?

MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation. MySQL is a database management system. MySQL databases are relational. MySQL software is Open Source. The MySQL Database Server is very fast, reliable, scalable, and easy to use. MySQL Server works in client/server or embedded systems. A large amount of contributed MySQL software is available. – by dev.mysql.com

MySQL is a very famous and popular open source relational database management system. Installing MySQL on Linux Debian 9 is very easy and straight forward. This blog will help you the step by step procedure to install the MySQL on Linux Debian 9.

change directory

Execute the below command to change the directory to “/tmp”.

cd /tmp

download MySQL PPA

The MySQL PPA for Debian Linux is available on the MySQL official site. Execute the below commands to download the MySQL PPA.

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config* 

During the installation of MySQL apt config package will prompt you to select the MySQL version to install. Select the MySQL 5.8 or 5.7 option to install on your system.

MySQL server & cluster
MySQL version

Select “OK” on package confirmation screen.

OK screen

Install MySQL

Update the existing packages once again and start to install the MySQL by executing the below commands.

sudo apt update 
sudo apt install mysql-server

Enter the root password to login into the MySQL as a root user.

Enter root password

Re-enter root password once again.

Re-enter root password

Select “Strong Password Encryption” on the screen for safe.

Strong Password Encryption

check the system control status

By executing the below command to check the MySQL running status on system control.

sudo systemctl status mysql
MySQL system control status

secure mysql

By executing the below command to secure your MySQL.

mysql_secure_installation

You should answer the questions prompted on the screen to secure your MySQL installation.

Would you like to setup VALIDATE PASSWORD component?
 Press y|Y for Yes, any other key for No: n
 Using existing password for root.
 Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
 … skipping.
 By default, a MySQL installation has an anonymous user,
 allowing anyone to log into MySQL without having to have
 a user account created for them. This is intended only for
 testing, and to make the installation go a bit smoother.
 You should remove them before moving into a production
 environment.
 Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
 Success.
 Normally, root should only be allowed to connect from
 'localhost'. This ensures that someone cannot guess at
 the root password from the network.
 Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
 Success.
 By default, MySQL comes with a database named 'test' that
 anyone can access. This is also intended only for testing,
 and should be removed before moving into a production
 environment.
 Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n
 … skipping.
 Reloading the privilege tables will ensure that all changes
 made so far will take effect immediately.
 Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
 Success.
 All done! 

test mysql

Execute below command to test the MySQL and check the version.

mysqladmin -u root -p version
MySQL version

MySQL has been successfully installed on Linux Debian 9.

How to install Apache Ant on Linux Debian 9?

How to install Apache Ant on Linux Debian 9?

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks. – by ant.apache.org

PREREQUISITES

  1. JDK

DOWNLOAD

We can download the Apache Ant from the official site of Apache Ant. The download link has been given below.

https://ant.apache.org/bindownload.cgi

CHANGE DIRECTORY

Execute the following command to change the directory into “/usr/local” in your Linux Debian machine.

cd /usr/local  

WGET

By using WGET command, we can download the latest Apache Ant from the official site. The WGET command is given below.

sudo wget https://www-eu.apache.org/dist//ant/binaries/apache-ant-1.9.14-bin.tar.gz

EXTRACT THE FILE

By using below commands to extract the downloaded Apache Ant file.

sudo tar xzf apache-ant-1.9.14-bin.tar.gz 
sudo ln -s  apache-ant-1.9.14 apache-ant 

SET ENVIRONMENT VARIABLE

Use the below command to set the environment variable by using vi editor.

sudo vi /etc/profile.d/apache-ant.sh

Add the following lines to set the environment path for Apache Ant.

export ANT_HOME=/usr/local/apache-ant
export PATH=${ANT_HOME}/bin:${PATH}

LOAD THE ENVIRONMENT PATH

To load the environment path, execute the below source command.

source /etc/profile.d/apache-ant.sh 

CHECK ant VERSION

Execute the following command to check the Apache Ant version.

ant -version
Apache Ant version

Apache Ant 1.9.14 has been installed successfully on Linux Debian 9.

How to install Apache Ant on Windows 10?

How to install Apache Ant on Windows 10?

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks. – by ant.apache.org

PREREQUISITES

  1. JDK

download

We can download the Apache Ant from the official site of Apache Ant. The download link has been given below.

https://ant.apache.org/bindownload.cgi

I have downloaded the Apache ant 1.9.14 version zip file and saved into my machine.

Apache Ant Zip file

Extract the downloaded zip file now. The extraction may take time depending the file size.

Apache Ant extracted file

SET ENVIRONMENT VARIABLE

Follow the below steps to set the environment variable for Apache Ant. The steps are given below .

#1. Go to the My Computer –> Properties

This image has an empty alt attribute; its file name is image-4.png
My Computer –> Properties

#2. Open the Environment Variable window by clicking the Advanced System Settings –> System Properties –> Environment Variables…

This image has an empty alt attribute; its file name is image-53.png
Environment variables

#3. Select the System variable “Path” and click the “Edit” button.

This image has an empty alt attribute; its file name is image-54.png
System variables

#4. Click the “New” button on the edit environment variable window and the add the Apache Ant extracted file location up to the bin folder and then click “OK” button. In my system, I have downloaded and extracted the Apache Ant zip file on the following location up to bin folder.

C:\softwares\apache-ant-1.9.14\bin
Apache Ant Environment Path

ANT_HOME

To set the ANT_HOME environment variable follow the below steps.

#1. Click “New” button on the System variable window and provide the variable name is “ANT_HOME” and variable value is Apache Ant zip file extracted path. In my system, I have download and extracted the zip file on the following location.

C:\softwares\apache-ant-1.9.14
ANT_HOME path

#2. Click “OK” button on all opened windows and open the new command prompt to execute the following command to check the Apache Ant version. The Apache Ant version should be 1.9.14.

ant -version
Apache ant version

Apache Ant installation has been done on Windows 10.

How to install Docker on Linux Debian 9?

How to install Docker on Linux Debian 9?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code. – by opensource.com

steps

First, update all existing packages list.

sudo apt update

Install prerequisites packages which supports “apt” use packages over HTTPS.

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

Add the GPG Key from the official Docker repository site to your system.

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

Add the Docker repository to APT sources.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable"

Update the packages once again with the Docker packages.

sudo apt update 

Execute the below command to make sure installing the docker from official docker repository instead of default one from your Linux Debian.

apt-cache policy docker-ce

You will get the below message in your console about the Docker.

docker-ce:
   Installed: (none)
   Candidate: 5:19.03.0~3-0~debian-stretch
   Version table:
      5:19.03.0~3-0~debian-stretch 500
         500 https://download.docker.com/linux/debian stretch/stable amd64 Packages
      5:18.09.8~3-0~debian-stretch 500
         500 https://download.docker.com/linux/debian stretch/stable amd64 Packages

Now this is the time to install the Docker. Execute the below command to install Docker in your Linux Debian 9.

sudo apt install docker-ce

After docker installation, check the daemon started and the docker process is enabled to start on boot.

sudo systemctl status docker

You will get the below message on the console and showing that service is started and running.

docker.service - Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Active: active (running) since Thu 2019-07-25 15:08:26 UTC; 52s ago
      Docs: https://docs.docker.com
  Main PID: 10170 (dockerd)
    CGroup: /system.slice/docker.service
            └─10170 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.843745232Z" level=warning msg="Your kernel does not support swap memory limit"
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.844505558Z" level=warning msg="Your kernel does not support cgroup rt period"
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.845028493Z" level=warning msg="Your kernel does not support cgroup rt runtime"
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.845611976Z" level=info msg="Loading containers: start."
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.922639398Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.958337077Z" level=info msg="Loading containers: done."
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.984441997Z" level=info msg="Docker daemon" commit=aeac9490dc graphdriver(s)=overlay2 version=19.03.0
 Jul 25 15:08:25 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:25.985341692Z" level=info msg="Daemon has completed initialization"
 Jul 25 15:08:26 my-blog-vm systemd[1]: Started Docker Application Container Engine.
 Jul 25 15:08:26 my-blog-vm dockerd[10170]: time="2019-07-25T15:08:26.024181113Z" level=info msg="API listen on /var/run/docker.sock"

Now execute the below commands to run Hello World in docker by login as root user. Otherwise, add the “sudo” before the docker commands.

docker run hello-world

You will get the following output on the console.

Unable to find image 'hello-world:latest' locally
 latest: Pulling from library/hello-world
 1b930d010525: Pull complete 
 Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
 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:
 The Docker client contacted the Docker daemon.
 The Docker daemon pulled the "hello-world" image from the Docker Hub.
 (amd64)
 The Docker daemon created a new container from that image which runs the
 executable that produces the output you are currently reading.
 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/get-started/
 …

Execute few more docker commands and play with it.

To view the list of docker running containers.

docker ps

To view the list of docker images.

docker images

Docker has been installed successfully on the Linux Debian 9.