Kuberty.io
  • blog
Kuberty.io

Ubuntu

Home / Ubuntu
09May

How to Install Rancher on Ubuntu?

May 9, 2022 admin Ubuntu

Since its inception, Kubernetes has resolved innumerable issues regarding effective management tactics for their cloud cluster storage. Due to its huge user base, the Kubernetes market should expand by over 4.3 billion USD by next year. Such an expansion would make it more than 2x as regards to its present value.

These numbers and the growth potential shows how much people are fond of the K8s technology. But sometimes, it becomes tricky to pick the right Kubernetes solution. That’s where Rancher comes in. It is, no doubt, one of the best open-source tools among the leading Kubernetes (K8s) solutions today. This article aims to discuss with you all the essential steps to install Rancher on Ubuntu with relative ease.

What Exactly is Rancher?

Before explaining the steps you have to follow to install Rancher on Ubuntu, let’s first understand what Rancher is. Well, Rancher is a wonderful invention arising out of the rapid growth of technology. Released in 2016, it is a great open-source tool for empowering companies for running containers in production. With Rancher coming to their aid, companies can ditch the need for manually constructing a container services platform. Rancher provides users with the complete software stack that they can utilize for managing their containers in production.

Let us now shift our focus to its four chief components:

1. Infrastructure orchestration

The first of its quartet of the major components is infrastructure orchestration. Rancher grasps raw computing resources from a public/private cloud. These resources come as Linux hosts. Each of such Linux hosts can either be a virtual or a physical apparatus. Plus, Rancher is also not very demanding. All it takes from the hosts is their CPU power, memory, and network connections. For Rancher, virtual machine (VM) instances of cloud service providers and bare-metal servers situated at the colocation sites are self-same.

The software also utilizes a portable infrastructure services layer specifically intended for powering containerized apps. A user gets infrastructure services like storage, DNS, networking, security, and so on from Rancher. These services get deployed as self-sufficient containers themselves, enabling them to run on all Linux hosts, regardless of the cloud.

2. Container orchestration and scheduling

The next component is the mechanism to orchestrate and schedule containers. A shedload of individuals prefers to run containerized apps via a container orchestration and scheduling foundation. For such users, Rancher incorporates an allocation of all the well-known container orchestration and scheduling frameworks out there. These include Mesos and Kubernetes among others. A single user can generate numerous Mesos or Kubernetes clusters. Rancher empowers its users to utilize their native Mesos or Kubernetes tools for managing their containerized apps.

Besides supporting Mesos, Kubernetes, etc., Rancher gives its users the ability to use a homegrown container orchestration and scheduling system known as Cattle. While initially Cattle was intended to be a Docker Swarm extension, today, it has become its own independent entity. It occurred as a result of the rapid development of Swarm and its digression from Cattle in the following years. Cattle helps Rancher immensely to configure, manage, and upgrade Mesos, Kubernetes, and Docker Swarm cultures.

3. App catalog

The third among Rancher components is its app catalog. The application catalog enables Rancher users to deploy any of their multi-container clustered apps with a single click. Just imagine how convenient and effortless that is. Users also become capable of managing the apps they’ve deployed and put them through auto-upgrades whenever a new edition of an app is out. Rancher offers a public catalog comprising all the famed apps the Rancher community has shared. Nonetheless, one is free to make their own private catalog if they want to.

4. Enterprise-grade control

The fourth and last component of Rancher is its enterprise-grade control. The software suits many user-authentication plug-ins. Plus, it has its own inbuilt authentication integration equipped with GitHub, Lightweight Directory Access Protocol, and AD. It also provides support for RBAC at its environment levels, enabling individuals and teams to give/decline ingress to deployment environments such as production and development.

Why Should You Install Rancher on Ubuntu Anyway?

Now you might think about what is the need for installing Rancher. Well, Rancher is known for offering several benefits to its users with some of them mentioned as follows:

  • Rancher’s foremost perk is its cross-host networking. No matter what your environment is, Rancher will construct a relevant private network described by software. This, in turn, leads to a safe interaction between different containers residing on different clouds/hosts.
  • The next benefit that Rancher has to offer is its container load balancing. The Rancher software provides every user with a coalescent and flexible load balancing service that functions on numerous clouds. This service helps them to dispense traffic across services/containers with ease.
  • Service discovery is yet another benefit offered by Rancher. It incorporates an inbuilt DNS-based service discovery feature equipped with a health checkup facility. This function empowers containers for auto-enrolling themselves as services. Plus, it enables those services to find other similar services on the network.
  • Effective resource management is also a stronghold of Rancher. The software provides support for Docker Machine. As some of you might know, Docker Machine is an amazing tool to perform host provisioning from CSP, ditching the need for a go-between. After the completion of the said provisioning, Rancher starts focusing on host resource overseeing and container deployment management.
  • As we said earlier, Rancher supports a plethora of container orchestration engines, including Mesos and Kubernetes. Besides that, it has its own orchestration engine, namely Cattle. The facility of using an engine of choice allows users to pick the popular orchestration engines out there. Plus, it also opens the door for enhancing Rancher features such as storage technologies, app catalog, and many more.
  • The Rancher software offers an effortless upgrade facility for the container services they possess via service cloning permission and service request diversion. Consequently, it helps to ensure the validation of the upgraded services by utilizing their dependencies prior to directing live traffic to those services.

Steps to Install Rancher on Ubuntu

In this section, we will discuss the steps that you need to follow for installing Rancher on your Ubuntu OS machine. But before talking about the steps, let’s take a look at the prerequisites for ensuring the successful installation of Rancher on Ubuntu OS.

Prerequisites

  • Two Ubuntu-installed servers
  • Two valid static IP addresses configured on each of the Rancher server and the client
  • A root password configured on both servers

Step 1: Update both servers

Before proceeding further, you have to update both of your Ubuntu-installed servers to their latest editions. Updating them is easy. Just execute the following command and that’s it:

apt-get update -y

apt-get upgrade -y

Once the update is finished, reboot both servers to implement your modifications.

Step 2: Install Docker CE

Next, you have to install Docker Community Edition (CE) on both of your servers. Typically, you won’t be able to find the latest version of Docker CE in your Ubuntu default repository. That’s why you need to add the necessary repository yourself.

For doing so, you must allow APT for utilizing a repository on HTTPS by installing some packages. Run the following commands in the terminal:

apt-get install apt-transport-https ca-certificates curl

software-properties-common -y

After that, download the GPG key for Docker Community Edition and affix it using the below command:

wget https://download.docker.com/linux/ubuntu/gpg

apt-key add gpg

After completion, join APT and the Docker CE repository together with the following command:

nano /etc/apt/sources.list.d/docker.list

Next, add this:

deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable

Once you’re done adding the above line, save the file and quit.

Now, you got to update your repository using the below command:

apt-get update -y

Upon completion, the repository will receive an update.

Next, install Docker Community Edition/CE:

apt-get install docker-ce -y

After installing Docker CE, you’d be capable of verifying the status of your Docker service using this command:

systemctl status docker

If everything went correctly, you should receive the below output:

docker.service – Docker Application Container Engine

Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)

Active: active (running) since Tue 2019-06-06 21:16:14 IST; 1min 0s ago

Docs: https://docs.docker.com

Main PID: 14498 (dockerd)

CGroup: /system.slice/docker.service

└─14498 /usr/bin/dockerd -H unix://

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=warning msg=”Your kernel does not support swap memory

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=warning msg=”Your kernel does not support cgroup rt pe

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=warning msg=”Your kernel does not support cgroup rt ru

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”Loading containers: start.”

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”Default bridge (docker0) is assigned with an

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”Loading containers: done.”

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”Docker daemon” commit=4d60db4 graphdriver(s)

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”Daemon has completed initialization”

Jun 06 21:16:14 rancher systemd[1]: Started Docker Application Container Engine.

Jun 06 21:16:14 rancher dockerd[14498]: time=”2019-06-06T21:16:14.456058066+05:30″

level=info msg=”API listen on /var/run/docker.sock”

With your Docker CE now up and running, it’s time to install the Rancher container.

Step 3: Install the Rancher container

This step is all about installing the Rancher container in the right way. First, you have to install the Rancher image. You can obtain this image from the Docker Hub repositories. Download your Rancher container and initialize it using this command:

docker run -d –restart=unless-stopped -p 8080:8080 rancher/server:stable

Upon successful installation, you will receive the following output:

Unable to find image ‘rancher/server:stable’ locally

stable: Pulling from rancher/server

bae382666908: Pull complete

29ede3c02ff2: Pull complete

da4e69f33106: Pull complete

8d43e5f5d27f: Pull complete

b0de1abb17d6: Pull complete

422f47db4517: Pull complete

79d37de643ce: Pull complete

69d13e08a4fe: Pull complete

2ddfd3c6a2b7: Pull complete

bc433fed3823: Pull complete

b82e188df556: Pull complete

dae2802428a4: Pull complete

effdbd93afcb: Pull complete

a4fcc35085ad: Pull complete

e8234323b6c4: Pull complete

d3f751a5d9cc: Pull complete

d4b24e84b43b: Pull complete

da9d7264902d: Pull complete

df2b31306256: Pull complete

c2238fcf71c2: Pull complete

10c7c4a52421: Pull complete

Digest: sha256:290e94536b32665d0ff537c2b947804faeed2768cd8652f0088a0d7e1acced75

Status: Downloaded newer image for rancher/server:stable

d209e25452fecc8c77cb276855bb7875c137c8b5d6ed6ba1c461c44ac877f6c7

Your Rancher server is currently about to begin and listen on port 8080. Nonetheless, you can freely change the port if you want to.

Next, launch a web browser, navigate to its URL bar, and type http://[your server IP]:[your port number]. Provided that you didn’t modify your port number, enter 8080.

Doing so will open a page. Launch the ‘ADMIN’ menu and then click ‘Access Control’. It will help you set up your Rancher Access Control. Next, navigate to ‘LOCAL’, furnish all the required info, followed by an ‘Enable Local Auth’ button click. Now, you’ve enabled your local authentication.

Step 4: Set up your Rancher client

The last step is to navigate to the Rancher server dashboard and open the ‘INFRASTRUCTURE’ menu, followed by ‘Hosts.’

After that, press the ‘Add Host’ key. This will allow you to view your Host Registration URL. ‘Save’ it. On the next page, enter your Rancher Client IP address and specify your custom host type. Next, you will receive a command that you have to paste in a designated field after signing in to your Rancher client system. The command will look something like this:

docker run -e CATTLE_AGENT_IP=”192.168.0.103″ –rm –privileged -v

/var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher

rancher/agent:v1.2.11 http://192.168.0.100:8080/v1/scripts/A7694D846BE6239EC650:

1546214400000:XOdj1phkwWhDH556B6Jb1Le2E

Once your command gets executed successfully, you will get this output:

Unable to find image ‘rancher/agent:v1.2.11’ locally

v1.2.11: Pulling from rancher/agent

b3e1c725a85f: Pull complete

6a710864a9fc: Pull complete

d0ac3b234321: Pull complete

87f567b5cf58: Pull complete

063e24b217c4: Pull complete

d0a3f58caef0: Pull complete

16914729cfd3: Pull complete

bbad862633b9: Pull complete

3cf9849d7f3c: Pull complete

Digest: sha256:0fba3fb10108f7821596dc5ad4bfa30e93426d034cd3471f6ccd3afb5f87a963

Status: Downloaded newer image for rancher/agent:v1.2.11

INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.0.100:8080/v1

INFO: Attempting to connect to: http://192.168.0.100:8080/v1

INFO: http://192.168.0.100:8080/v1 is accessible

INFO: Configured Host Registration URL info: CATTLE_URL=http://192.168.0.100:8080/v1

ENV_URL=http://192.168.0.100:8080/v1

INFO: Inspecting host capabilities

INFO: Boot2Docker: false

INFO: Host writable: true

INFO: Token: xxxxxxxx

INFO: Running registration

INFO: Printing Environment

INFO: ENV: CATTLE_ACCESS_KEY=C6CB8593B0FDB118728B

INFO: ENV: CATTLE_AGENT_IP=192.168.0.100

INFO: ENV: CATTLE_HOME=/var/lib/cattle

INFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationToken

INFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxx

INFO: ENV: CATTLE_SECRET_KEY=xxxxxxx

INFO: ENV: CATTLE_URL=http://192.168.0.100:8080/v1

INFO: ENV: DETECTED_CATTLE_AGENT_IP=192.168.0.103

INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.11

INFO: Launched Rancher Agent: b8816fa492af46e02fb7da53096c829d2b834375fb533f5586c7ebc

6c906ab77

Now, press the ‘close’ button after navigating to your Rancher server dashboard. The following page will display your Rancher client.

And that’s all. You have successfully installed Rancher on your Ubuntu machine.

Conclusion

As you can see, Kubernetes cluster management is a pretty difficult job. Ensuring the safety and security of your containerized apps is difficult as well. However, technology has progressed a great deal since its modest origins. Consequently, handy software/tools like Rancher have arisen as lifesavers to Kubernetes users. By utilizing Rancher, constructing and managing containers and containerized applications become a lot easier.

Through this article, we have discussed with you all the steps required to install Rancher on Ubuntu. The steps are quite limited in number and are easy to comprehend. Each step, right from updating your Ubuntu-installed servers to configuring your Rancher client, has to be followed properly to make sure that Rancher gets installed successfully. All the best!

Read more
30Apr

How to Install Yarn on Ubuntu 20.04?

April 30, 2022 admin Ubuntu

As the most reliable, fast, and secure JavaScript packet manager, yarn is preferred over npm.

It automates the whole process of installing, configuring, updating, and removing npm packages.

In this blog, you will learn about ways to install Yarn on Ubuntu 20.04. But before we get into the technical side of the process, let’s learn more about Yarn and its advantages over other packet managers.

What is Yarn?

As stated in the beginning, Yarn is a packet manager for JavaScript codes which also acts as a project manager. It was released in 2016 by Facebook to overcome shortcomings of performance and security faced while using npm (Node Package Manager).

As soon as Yarn was released, it gave npm a neck-to-neck competition and made its developers make necessary improvements to fix inefficiencies.

In regards to its functionality, it allows easy sharing and use of JavaScript code residing in different parts of the world. Due to the easy accessibility, you can connect to other developers sitting far from you and use their solutions to existing problems arising during software development.

Start Installing the Yarn on Ubuntu

Note: The installation process will need Node.js on your system. Therefore, before you start with anything else, install Node.js first.

Once you have downloaded and installed Node.js, move further with the systematic guide given below. Here, you will get to learn about three different installation processes using PPA, NPM, and Script.

So, without much ado, let’s get started.

1. Method 1 – Using PPA

The method of installing Yarn on Ubuntu 20.04 using PPA

When it comes to its own repository, Yarn doesn’t have one. Instead, it uses several others, including those from its rivals, such as npm. You will learn about that as well, but before that, let’s get started with PPA installation.

You can accurately install Yarn globally on the system with the help of PPA. Hence, every user could get access to Yarn with ease.

Step 1: Import GPG key

This is the first step of this installation process. Before the installation process, first import the GPG key to verify the package.

For this, use the command;

$ curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add –

Step 2: Enable repository

After the verification, enable the repository of the package manager by typing the command;

$ echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list

Step 3: Install Yarn

Once the repository is enabled, move forward with Yarn installation by running the command;

$ sudo apt update && sudo apt install yarn

Step 4: Check the current version of the installed Yarn

Your installation will be complete with this step. You have to check the installed version. To do so, use the command;

$ Yarn –version

2. Method 2 – Using NPM

The method of installing Yarn on Ubuntu 20.04 using NPM

In this method of installation, you will use the npm repository to install Yarn. Start the execution with this command;

$ npm install -g yarn

Note: -g here will help you install the Yarn globally on your Linux system. You’ll have access to your systems and projects from anywhere in the world.

3. Method 3 – Using Script

The method of installing Yarn on Ubuntu 20.04 using Script

This method is one of the third options, however, it is not as viable as compared with the other two. Using Script, you will be able to install Yarn, but its access will be limited to the current user only. It will not acquire global access functionality.

To get started with the installation process, use the shell script;

$ sudo apt install curl -y

$ curl -o- -L https://yarnpkg.com/install.sh | bash

This script will download the Yarn archive on your home directory and extract it unthe der .yarn directory.

The script will set the variable for the path environment.

These are the three popular methods for Yarn installation. You can use them according to your usability and system demands.

Once you are done, you will need knowledge of some often-used commands. Let’s do a quick go-through.

Benefits of Yarn Package Manager over npm

As you have chosen to install the Yarn package manager, you already have an idea that it is an indispensable developer tool. It works in the direction of unifying the development process and simplifying it for the greater good.

However, much remains to be understood and known. For a brief period of time, npm remained a leader among other JavaScript managers. In terms of code package management, it is designated as the gold standard. It does, however, have a few shortcomings; those shortcomings led to the development and release of Yarn by Facebook.

Here are the benefits of Yarn over npm;

  • Makes CLI output easy-to-read
  • Enables reinstallation with the help of offline mode in the absence of internet connectivity
  • Helps in retiring failed requests and improving the network resilience
  • Eliminates duplicates by resolving mismatched versions
  • Has an independent and unified structure for installation
  • Enables users to restrict licenses of already installed modules
  • Supports bower and npm workflows; allows mixing of registries

How did Yarn manage to overcome the shortcomings of npm?

Although npm and Yarn perform identical functions, yet one of them is better and the other is not. The efficiency depends upon factors like Security, Reliability, and Speed.

Security

Yarn package manager verifies the integrity of each installed package via checksums before it is executed.

Reliability

Yarn works in the direction of ensuring the baseline installation across all associated systems. It uses a lockfile format for the installation processes.

Speed

As Yarn maximizes concurrent processes and resource utilization, it ensures faster installations. It also creates a cache of every package downloaded so that they can be accessed in need without re-downloading them.

How does Yarn differ from npm with regards to common commands?

Both Yarn and npm perform the same functions and thus have a few common commands. The commands, however, differ a great deal from one another. Let’s find out how;

For installing code packages

  • npm: npm install react
  • Yarn: Yarn add react

For installing dev packages

  • npm: npm install -D
  • Yarn: Yarn add –dev webpack

For installing dependencies

  • npm: npm install
  • Yarn: Yarn

For running npm scripts

  • npm: npm run build
  • Yarn: yarn build

Conclusion

Yarn offers a number of advantages over npm and is highly compatible with code. It has maintained the repo and has been giving neck-to-neck competition to npm. There is no doubt that it is one of the best options for web developers, whether they are working on small or big projects. To reap the benefits of Yarn, follow this guide and install it.

Read more
28Apr

How to Install Deb Files (Packages) On Ubuntu?

April 28, 2022 admin Ubuntu

Users of GUI-based operating systems, such as Windows, often have a hard time adjusting to command-line systems. Linux still remains a popular choice for users, be they beginners, programmers, or developers. The first-time users of Ubuntu will find it different from Windows in several ways.

Although the primary version of Ubuntu employs GNOME, a mixture of GUI and command-line interface, many beginners have several questions regarding the operations. One of those questions is how to install Deb files (packages) on Ubuntu.

Honestly, it is not difficult at all, and there are several ways to do so. The best, quickest, and easiest way is to install the application from the Software Center. But all of the applications are not available in Ubuntu repositories, and you may need to download them manually.

While Software Center allows you to install several applications, some applications are contained in Deb packages with .deb extension. You can consider it as the .exe files in Windows.

This guide contains several ways of installing as well as removing deb files on Ubuntu. The guide answers all your questions concerning how to install Deb files (packages) on Ubuntu.

Installing Deb Files (Packages) on Ubuntu

There is no one way of installing Deb files on Ubuntu. You can install it in the following ways-

  1. Using Software Centre
  2. Using dpkg In Command-Line
  3. Using Gdebi Tool
  4. Using apt in Command-Line

Using Software Centre

Of all the ways to install deb files, this one is the easiest.

  1. As the first step, install the deb package for the required application.
  2. Navigate to the folder where the downloaded file is located.
  3. Double-click the file and open up the Software Center. There is the green install button.
  4. Click to start installation.
  5. Authenticate it by entering your password.
  6. Your deb package will be installed.

It is possible that as you double-click the downloaded deb file, it doesn’t take you to the Software Center. In Ubuntu 20.04, it sometimes happens that it guides you to the archive manager. In this case, right-click on the file and click on the “Open With” option. Then click on Software Install to make it your default choice by clicking on “Set as Default” on the bottom-right of the box to finish installation.

Using dpkg in Command Line

The dpkg is a command-line tool that is used under apt command. It is a low-level package manager which uses the (-i) or (–install) option.

You can install the deb file with dpkg with the below-mentioned command.

sudo dpkg -i path_to_deb_file

Instead of path-to-deb-file, use the name of the downloaded deb file.

Dpkg manager does not resolve dependency errors. It would be best if you used apt or gdebi tools for it.

Using Gdebi tool

Often, you choose to install an application in the easiest manner from Software Center, but it shows a dependency error. It happens due to a lack of software which is required for running the application but it is not present on your Ubuntu system. In such a case, you need a tool, which installs the dependencies along with the application.

The tool is the Gdebi tool. It is a GUI tool specially designed to install deb packages. So, when you install a deb package by using the Gdebi tool, it automatically installs all the dependencies required to run that application.

You can install the deb package on Ubuntu in a very simple manner with the given command.

sudo apt install gdebi

That’s it.

Using apt In Command-Line

Apt is a very popular command-line tool and you can use it to install, remove and manage Deb packages. You can use it for installing deb files on Debian, Ubuntu, and other Linux distributions.

Using the command below, you can install deb files on Ubuntu using apt-

sudo apt install path_to_deb_file

Replace path_to_deb_file with the file name of your deb file.

See, it is very easy to get deb files for Ubuntu. Hope, it has answered your question, how to install Deb file (packages) on Ubuntu. But what if you want to remove a deb file?

Removing a Deb File On Ubuntu

If you don’t need an application anymore and want to get rid of it, you can do so. The process is as simple as installing these packages. Once again, by using the Apt and Dpkg command, you can remove deb file packages. Just follow the commands, and remove the Deb files easily. And don’t worry, there is no need for the original deb file to remove the package.

1. Removing deb Files With Apt Command

First of all, if you want to remove a deb file using the Apt command, you need the program name. Now, how to learn the program name is the question? But it is easy to answer. The Grep command will find the exact program name for you.

Say you had installed Teamviewer, and now you want to remove it. You can search its program name by using the grep command in the following manner.

sudo apt list – -installed | grep team

It will return the name of all the packages that have “team” in their name. You can get the program name for the Teamviewer application and then use it in the Apt command to remove the Deb package.

sudo apt remove program_name

2. Removing Deb Files Using Dpkg Command

Once again, you need the program name. Use the grep command as used in the previous method and get the exact program name. Use it in the command given below-

dpkg –r program_name

That’s it.

Final Words

Even the simplest operations can seem impossible when you are just beginning and still in the learning process. If you are used to a GUI-based OS like Windows, switching to a semi-GUI, command-line-based OS like Ubuntu can be challenging. You need the right guide during these times.

Installing deb packages on Ubuntu is easy if you are nimble with the command line. But even if you are not, these simple commands mentioned above will make things easier. This guide will make not only installing but removing the deb package also a cakewalk.

This guide contains different methods using different tools to install and remove Deb files. Using apt, gdebi, dpkg, etc may sound overwhelming at first, but they are popular tools for installing Deb files. You can install your applications in any of the ways mentioned above.

No doubt, this guide has all the answers to your question on how to install deb files (packages) on Ubuntu. So, try these commands, install your application and enjoy Ubuntu.

Read more
18Apr

How to Install Docker on Ubuntu 18.04?

April 18, 2022 admin Docker, Ubuntu

If you’re a part of the ever-growing IT realm, you must have heard words like containerization and Docker. It’s a known fact that many IT personnel have begun opting for Docker today. Docker is an awesome tool for developing, deploying and managing apps with ease. In fact, it makes the bothersome process of container deployment pretty effortless. Many industry biggies like Spotify, ING, The New York Times, PayPal, The Washington Post, and many others, have embraced Docker wholeheartedly because of the increased convenience it offers. You, too, can install Docker on Ubuntu 18.04 for personal use. Fret not if you aren’t informed about the installation steps. This tutorial seeks to handle that aspect. Read on.

Why Install Docker on Ubuntu 18.04?

Now, you might be pondering about the need for installing Docker on your Ubuntu PC. Well, here are some of Docker’s amazingly cool features. Check them out:

  • Return on Investment (ROI) is perhaps its foremost feature. This leads to Docker being capable of cutting costs and efficiently boosting profits. All companies strive to generate steady profits over a long period. Docker can be their solution in this regard.
  • Docker makes its users capable of constructing a container image (CI) and utilizing it anywhere and anytime during the deployment process. Thus, it enables users to isolate non-dependent steps and execute them side by side.
  • Another great feature of Docker is its facility of rapid deployment. It can reduce the deployment time drastically. This happens because Docker tends to generate a spate container for each process and ditches OS boots. Hence, one can build or demolish info without the fear of reintroducing it at a greater cost than what’s considered reasonable.
  • Docker supports multiple platforms. Such multi-platform support leads to increased portability. Users can run Docker containers on Rackspace, Amazon (ECC) Elastic Cloud Computing, DigitalOcean, Google Compute Engine, Microsoft Azure, and many others. So, a container running on one platform can be ported to another. For instance, one could port a container running on Rackspace to Amazon ECC and vice-versa.

Steps to Install Docker on Ubuntu 18.04

Now, let’s focus on our foremost concern, that is, installing Docker on our Ubuntu 18.04 computer. Here we’re taking Docker Community Edition. But first, we need to accomplish a few prerequisites.

Prerequisites

  • A Ubuntu 18.04-installed server
  • A valid Docker Hub account

Step 1. Install Docker CE

While installing the Docker software, many people’s first instinct is to install it from the official Ubuntu repository. But we suggest you ditch that practice. Why? Because most of the time, the Docker installation package you get from there wouldn’t be the latest edition. So to make sure your Docker software is the latest, you have to install it from the Docker repository. For that purpose, you must attach a new package source and verify the validity of downloads by attaching a GPG key from Docker. Only after that should you proceed to install it.

So, first, you got to update your current package list:

sudo apt update

Next, install a few essential packages which will allow apt employ packages on HTTPS:

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

Then, you have to attach the GPG key we talked about earlier to the Docker repository:

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

Now, attach the Docker repository to apt sources:

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”

After doing so, you need to update the package DB from the repository you just attached:

sudo apt update

Like we said earlier, ensure the successful installation of packages from the Docker repository instead of the official Ubuntu repository:

apt-cache policy docker-ce

Once finished, you should see an output as given below:

docker-ce:

Installed: (none)

Candidate: 18.03.1~ce~3-0~ubuntu

Version table:

18.03.1~ce~3-0~ubuntu 500

500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

Here, you’d find the Docker CE file isn’t installed yet. It’s a confirmation of the fact that the installation contender comes from the Docker repository.

Now, you got to install the Docker CE file:

sudo apt install docker-ce

It will install Docker CE on your local machine with daemon enabled. Also, the service will now start with each reboot. You may verify its status by executing this command:

sudo systemctl status docker

If everything is fine, you will receive this output stating that the service is up and running:

docker.service – Docker Application Container Engine

Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)

Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago

Docs: https://docs.docker.com

Main PID: 10096 (dockerd)

Tasks: 16

CGroup: /system.slice/docker.service

├─10096 /usr/bin/dockerd -H fd://

└─10113 docker-containerd –config /var/run/docker/containerd/container.to ml

Now that you’ve installed Docker, you get both the daemon as well as the Docker client. Later in this tutorial, we will teach you about utilizing this command. For now, proceed to the next step.

Step 2 (optional). Execute the Docker Command Minus the sudo

Typically, one can run the docker command only if they possess root access or are a part of the docker group. This group gets constructed while you’re installing the Docker tool. Now, in case you try to run this docker command without fulfilling either of these two conditions, you’re bound to receive an output like this:

docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.

See ‘docker run –help’.

So what to do? Well, to ditch the need of typing sudo every time you attempt at running the docker command, execute the below-given command to specify your username to your docker group:

sudo usermod -aG docker ${USER}

To finalize your group initiation process, you got to sign out of your server and run this command:

su – ${USER}

After doing that, you’d be asked to provide your user password before you can proceed further.

You need to authenticate the addition of your user to the docker group. For doing so, use this command:

id -nG

Suppose you plan on adding a user to your Docker group that’s not a part of it. Then, you got to define the concerned username using the below command:

sudo usermod -aG docker username

We will proceed, presuming that you’re running the docker command as a Docker group member from now on.

So, that being said, let us now delve deep into the docker command.

Step 3. Utilize the Docker Command

The docker command utilization comprises a series of commands, options, and arguments. The syntax could usually be found in the following form:

sudo usermod -aG docker username

By utilizing the command below, you can see all your accessible subcommands:

docker

As of now, the list of available subcommands is as follows:

attach Attach local standard input, output, and error streams to a running container

build Build an image from a Dockerfile

commit Create a new image from a container’s changes

cp Copy files/folders between a container and the local filesystem

create Create a new container

diff Inspect changes to files or directories on a container’s filesystem

events Get real time events from the server

exec Run a command in a running container

export Export a container’s filesystem as a tar archive

history Show the history of an image

images List images

import Import the contents from a tarball to create a filesystem image

info Display system-wide information

inspect Return low-level information on Docker objects

kill Kill one or more running containers

load Load an image from a tar archive or STDIN

login Log in to a Docker registry

logout Log out from a Docker registry

logs Fetch the logs of a container

pause Pause all processes within one or more containers

port List port mappings or a specific mapping for the container

ps List containers

pull Pull an image or a repository from a registry

push Push an image or a repository to a registry

rename Rename a container

restart Restart one or more containers

rm Remove one or more containers

rmi Remove one or more images

run Run a command in a new container

save Save one or more images to a tar archive (streamed to STDOUT by default)

search Search the Docker Hub for images

start Start one or more stopped containers

stats Display a live stream of container(s) resource usage statistics

stop Stop one or more running containers

tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

top Display the running processes of a container

unpause Unpause all processes within one or more containers

update Update configuration of one or more containers

version Show the Docker version information

wait Block until one or more containers stop, then print their exit codes

Now, if you wish to see the options obtainable on a particular subcommand, utilize this:

docker docker-subcommand –help

You are also capable of viewing your Docker’s system info by simply typing this command:

docker info

Let us focus on some of these subcommands. We will utilize Docker images first.

Step 4. Begin Working with Docker Images

Docker images are essential for constructing Docker containers. Typically, Docker gathers all these images from the cloud-based repository Docker Hub, which is managed by Docker. Everybody is capable of hosting their images on this repository. Therefore, the chance is always high that you’d find the images of all your necessary apps and Linux distributions on Docker Hub.

To ensure your eligibility to navigate to Docker Hub and download your required images, utilize this command below:

docker run hello-world

If your eligibility status is positive, you will get an output like this:

Unable to find image ‘hello-world:latest’ locally

latest: Pulling from library/hello-world

9bb5a5d4561a: Pull complete

Digest: sha256:3e1764d0f546ceac4565547df2ac4907fe46f007ea229fd7ef2718514bcec35d

Status: Downloaded newer image for hello-world:latest

Hello from Docker!

This message shows that your installation appears to be working correctly.

Originally, Docker couldn’t find the hello-world image in your local storage. Therefore, it downloaded that image. After the completion of the download, Docker built a new container utilizing the newly downloaded image. It also constructed the app inside that container. Hence, the message.

You can look for the images you need utilizing the docker command + search subcommand. For instance, execute the following command if you’re trying to find the Ubuntu image:

docker search ubuntu

Doing so will take the script to Docker Hub and show all the available image names matching the search string. So, you will receive the below output:

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

ubuntu Ubuntu is a Debian-based Linux operating sys… 7917 [OK]

dorowu/ubuntu-desktop-lxde-vnc Ubuntu with openssh-server and NoVNC 193 [OK]

rastasheep/ubuntu-sshd Dockerized SSH service, built on top of offi… 156 [OK]

ansible/ubuntu14.04-ansible Ubuntu 14.04 LTS with ansible 93 [OK]

ubuntu-upstart Upstart is an event-based replacement for th… 87 [OK]

neurodebian NeuroDebian provides neuroscience research s… 50 [OK]

ubuntu-debootstrap debootstrap –variant=minbase –components=m… 38 [OK]

1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 36 [OK]

nuagebec/ubuntu Simple always updated Ubuntu docker images w… 23 [OK]

tutum/ubuntu Simple Ubuntu docker images with SSH access 18

i386/ubuntu Ubuntu is a Debian-based Linux operating sys… 13

ppc64le/ubuntu Ubuntu is a Debian-based Linux operating sys… 12

1and1internet/ubuntu-16-apache-php-7.0 ubuntu-16-apache-php-7.0 10 [OK]

1and1internet/ubuntu-16-nginx-php-phpmyadmin-mariadb-10 ubuntu-16-nginx-php-phpmyadmin-mariadb-10 6 [OK]

eclipse/ubuntu_jdk8 Ubuntu, JDK8, Maven 3, git, curl, nmap, mc, … 6 [OK]

codenvy/ubuntu_jdk8 Ubuntu, JDK8, Maven 3, git, curl, nmap, mc, … 4 [OK]

darksheer/ubuntu Base Ubuntu Image — Updated hourly 4 [OK]

1and1internet/ubuntu-16-apache ubuntu-16-apache 3 [OK]

1and1internet/ubuntu-16-nginx-php-5.6-wordpress-4 ubuntu-16-nginx-php-5.6-wordpress-4 3 [OK]

1and1internet/ubuntu-16-sshd ubuntu-16-sshd 1 [OK]

pivotaldata/ubuntu A quick freshening-up of the base Ubuntu doc… 1

1and1internet/ubuntu-16-healthcheck ubuntu-16-healthcheck 0 [OK]

pivotaldata/ubuntu-gpdb-dev Ubuntu images for GPDB development 0

smartentry/ubuntu ubuntu with smartentry 0 [OK]

ossobv/ubuntu

…

Notice the output carefully. The “[OK]”s in the “OFFICIAL” section of the output signifies images that the organization behind the project made and endorsed. Once you’re finished picking the image of your preference, utilize the pull subcommand for downloading it to your PC.

Thus, you can run the following command for downloading the Ubuntu image:

docker pull ubuntu

Once downloaded, you will get the following output:

Using default tag: latest

latest: Pulling from library/ubuntu

6b98dfc16071: Pull complete

4001a1209541: Pull complete

6319fc68c576: Pull complete

b24603670dc3: Pull complete

97f170c87c6f: Pull complete

Digest: sha256:5f4bdc3467537cbbe563e80db2c3ec95d548a9145d64453b06939c4592d67b6d

Status: Downloaded newer image for ubuntu:latest

After downloading an image, you are free to execute the run subcommand for creating a container from your downloaded image. As the hello-world instance might’ve made you comprehend, if an image download fails to occur even after executing the docker command + run subcommand, the Docker client will initially download that image. And, after that, it will create a container utilizing the same.

Your downloaded images could be viewed by executing this simple command:

docker images

The output you will get should something like this:

REPOSITORY TAG IMAGE ID CREATED SIZE

ubuntu latest 113a43faa138 4 weeks ago 81.2MB

hello-world latest e38bc07ac18e 2 months ago 1.85kB

In case you didn’t know, you can modify the images you utilize for the container running. Also, it’s possible to use them for constructing new images, capable of being uploaded to Docker Hub or other similar repositories whenever you please.

So, the next step will dig deeper into this container running matter.

Step 5. Run a Docker Container

Remember the hello-world container you executed earlier? That was a perfect instance of a container that is capable of running and exiting after releasing a demo text. Containers, as you may know, have many other usages. Such a fact shouldn’t come as a surprise as they’re pretty much like VMs, albeit with increased resource-friendliness.

For instance, run a container utilizing the newest Ubuntu image. The below command could give you interactive shell access:

docker run -it ubuntu

Next, try to reflect in your command the fact that your work is occurring within that container. Therefore, make it look something like this:

root@d9b100f2f636:/#

Notice the container ID here. Remember it because we will need it later for container identification provided that you’ve decided to delete it.

With that, you’ve now become capable of running any command you wish to within your container. Let us take the task of package DB update inside the container as an instance. As you are a root user within your container, you don’t have to type sudo before your command:

root@d9b100f2f636:/#

After that, install any app of your preference inside it. For now, we will be installing Node.js:

root@d9b100f2f636:/#

Doing so will help install Node.js in your container. After the installation process is over, you got to verify Node.js’s installation with this command:

root@d9b100f2f636:/#

The output you will get from here will state the version of your newly installed Node.js:

v8.10.0

Remember that anything you modify inside the container applies to that container only.

Now enter exit in the command-line to exit your container.

Step 6: Manage Docker Containers

This step is about the container management aspect. After you install Docker on Ubuntu 18.04 and use it for a while, you’ll find tons of both active and inactive containers stowed on your PC. You can view the active containers list using the command given below:

docker ps

After doing so, you will get the below output:

CONTAINER ID IMAGE COMMAND CREATED

You have begun two containers till now from the hello-world and Ubuntu images. While they are in an active state at present, they still occupy some space in your PC.

You can also view both the active and inactive container list at once by executing the following command:

docker ps -a

You will ten to one receive the below output:

d9b100f2f636 ubuntu “/bin/bash” About an hour ago Exited (0) 8 minutes ago sharp_volhard

01c950718166 hello-world “/hello” About an hour ago Exited (0) About an hour ago festive_williams

Executing the below command will permit you to view your most recent container:

docker ps -l

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

d9b100f2f636 ubuntu “/bin/bash” About an hour ago Exited (0) 10 minutes ago sharp_volhard

You can restart a container that has stopped by implementing docker start and then, your docker ID. Here we will use a Ubuntu-based container:

docker start d9b100f2f636

Once the container gets started, you can check its status by using docker ps:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

d9b100f2f636 ubuntu “/bin/bash” About an hour ago Up 8 seconds sharp_volhard

Now, if you want to stop a container from running, you have to implement docker stop and then, the container ID. Here, we will opt for the Docker-provided container name, that is, sharp_volhard:

docker stop sharp_volhard

If you ever feel that you no longer need any particular container, you can eliminate its existence simply by utilizing the docker rm + container ID combo. Suppose you don’t know the hello-world-related container name, you can use docker ps. This command will aid you in finding the container ID you’re looking for:

docker rm festive_williams

The –name switch can be utilized in initializing and naming a container. Also, there is the –rm switch for generating a self-removing container upon stoppage. For further info regarding these options and facilities, you may run the docker run help command.

You can turn your containers into images. These images can then be utilized for creating new containers.

Step 7. Make Modifications in a Container to a Docker image

While dealing with a Docker machine, you are capable of generating, changing, or removing files exactly like a VM. Any modification you make will only be confined to that container. You are free to initialize or eliminate it. But if you utilize the docker rm command, you won’t be able to recover them.

Once you install Node.js within your Ubuntu container, you possess a running container using an image. However, the created container and the source image are different. But you can base new images on this Node.js container afterward.

Next, modify a new Docker image using the following command:

docker commit -m “What you did to the image” -a “Author Name” container_id repository/new_image_name

The command specifies both the changes you committed as well as the ID of the author. Do you remember the Container ID you came across during the initial stages of your Docker session? Unless you made extra repositories to the Docker Hub, your username is your repository. Here’s how the command will be like:

docker commit -m “added Node.js” -a “sammy” d9b100f2f636 sammy/ubuntu-nodejs

Once you implement an image, that image gets stowed in your local machine.

Using the below command again to list images will help you view both the latest image as well as the source it came from:

docker images

The output you receive would be like this:

REPOSITORY TAG IMAGE ID CREATED SIZE

sammy/ubuntu-nodejs latest 7c1f35226ca6 7 seconds ago 179MB

ubuntu latest 113a43faa138 4 weeks ago 81.2MB

hello-world latest e38bc07ac18e 2 months ago 1.85kB

In the above instance, the latest image is labeled as “ubuntu-nodejs” that came from the source Ubuntu image. There is also a noticeable difference between their size that is a sure shot indicator of the modifications. This instance reflects the addition of Node.js installation as a change.

You can also construct an image from the Docker file. It allows you to auto-install software in a new image. However, it isn’t really our focus here.

Step 8. Route Docker Images to a Docker Repository

The last thing you have to get done is to create an unhackneyed image from an already extant one and share it with others. These include a select few of your buddies, on Docker Hub, or some other Docker repository accessible to you.

Utilize the below command to sign in to your Docker Hub account:

docker login -u docker-registry-username

Next, enter your Docker Hub when asked. If entered right, your sign-in would be triumphant.

In case your Docker repository username and the name you utilized while generating the image differ, make things right by tagging your repository username with your image. Execute this command:

docker tag sammy/ubuntu-nodejs docker-registry-username/ubuntu-nodejs

After doing so, you may start routing your image:

docker push docker-registry-username/docker-image-name

For routing the ubuntu-nodejs to your repository, type:

docker push sammy/ubuntu-nodejs

If successful, an output would state that clearly:

The push refers to a repository [docker.io/sammy/ubuntu-nodejs]

e3fbbfb44187: Pushed

5f70bf18a086: Pushed

a3b5c80a4eba: Pushed

7f18b442972b: Pushed

3ce512daaf78: Pushed

7aae4540b42d: Pushed

Also, you would be able to see that image name on your dashboard.

Nonetheless, if the received output looks like the following one, maybe you didn’t sign in:

The push refers to a repository [docker.io/sammy/ubuntu-nodejs]

e3fbbfb44187: Preparing

5f70bf18a086: Preparing

a3b5c80a4eba: Preparing

7f18b442972b: Preparing

3ce512daaf78: Preparing

7aae4540b42d: Waiting

unauthorized: authentication required

In that case, utilize docker login and perform the procedure again. Then, navigate to your Docker Hub registry page’s dashboard and see whether the image name appears there or not.

And that’s all. Your quest to install Docker on Ubuntu 18.04 is over.

Conclusion

To conclude, the Docker tool is capable of resolving a very common issue of deploying containers or containerized apps that is rampant among almost all IT people. Docker could be a great lifesaver to you if you struggle with a container or containerized app deployment too. Being pretty much a VM, you can run any image you please using this wonderful software. The best thing about Docker is perhaps its open-source facilities that make way for continual updates and constant improvements by an amazingly dedicated community.

Also, as you can see from the entire article, you can install Docker on Ubuntu 18.04 with ease. The procedure is pretty simple. However, losing track of the to-be-followed steps mentioned above could ball things up badly. That’s why it’s crucial to go through the tutorial religiously and then, execute each step with utmost care. From installing the Docker Community Edition software to routing Docker images to a Docker repository – only the proper execution of every step could guarantee the success of their Docker installation. Now that you comprehend what to do and how to do so, you can install Docker on your Ubuntu-installed PC with ease. All the best for testing your knowledge.

Read more
08Apr

How to Install XAMPP in Ubuntu 18.04?

April 8, 2022 admin Ubuntu

When you are hosting a website on your Ubuntu system, you will require different software packages. These software programs work together to make browsing more efficient for the viewers. Developers often use PHP to gather content from a certain database so that those resources can be viewed by the users easily.

The most common components of web-hosting in Linux servers are PHP, Apache, MariaDB, etc. The XAMPP tool helps you run these components together on your Linux system so that they can be easily manageable when it comes to web hosting. XAMPP combines these components into a single installation package so that the installation becomes simple and easy. Within the XAMPP tool, there is a Bitnami feature that facilitates managing WordPress and other content management systems.

Therefore, installing XAMPP on your Ubuntu system makes hosting a website easier. Here in this article, we will discuss in detail how to install XAMPP on Ubuntu 18.04. So, since you are already here, let’s get started.

Prerequisites

XAMPP stack is an Apache distribution, and it is related to the PHP development environment. This open-source platform helps developers to test the software packages and web pages through a single installation of the Apache (A), MariaDB (M), PHP (P), and Perl (P) cross-platform software. It tests the software and the web pages and then transfers the data to an online server remotely. To install this tool on your Ubuntu system, you will have to meet the following requirements:

  • Your system should have Ubuntu 18.04 Bionic Beaver installed.
  • Sudo privileges on a user account.
  • You should have access to the terminal or command line.
  • You should have the apt tool installed in Ubuntu.

If you have taken care of these requirements, then go ahead and get on with the installation process of XAMPP on Ubuntu.

Step 1: Download and Install XAMPP on Ubuntu

To install XAMPP on your computer, visit the official Apache Friends webpage and download the package from there. When you click on that link, the page that appears is where you will find the download button of XAMPP on Windows, Linux, and OS X. Click on the Linux link since you are trying to get it on your Ubuntu computer.

The download will take a few minutes as per the speed of the internet and system. When the download is completed, you can find the downloaded package of XAMPP in your Downloads directory in Ubuntu. You can run a simple command to execute that file and make the installation possible.

You can run the installation, but you will have to modify the file permissions for XAMPP because you are executing the program. And you need to execute the file first for the same. You can open your terminal window and then follow the instructions mentioned below.

Step 1: Go to the folder where you have downloaded the XAMPP installation package, possibly in the Downloads folder. Alternatively, you can run the cd /home/[username]/Downloads command to visit the Downloads folder from the terminal.

Step 2: Execute the file by running the chmod command: sudo chmod 755 [package_name]. When you go to the Downloads folder, you will find the complete package name in there, and you will copy and paste that name to replace [package_name] in the command above. Once you run the command, the file will be executable.

Step 3: Run the sudo chmod 755 xampp-Linux-x64-7.3.5.1-installer.run command to execute the XAMPP installation package.

Step 4: Since the terminal does not confirm if you have successfully executed the installation or not, run this command to verify the installation: ls –l xampp-Linux-x64-7.3.5.1-installer.run

In the output, you may see <strong>rwxr –xr –x 1</strong> before the user name who has the access to execute the file. You can now set up and install XAMPP on your Ubuntu system.

Step 2: Set Up and Install XAMPP

Since you have installed the XAMPP installer, you can run it on your system and the setup wizard with a simple command: sudo ./[package_name]. We have used the sudo ./xampp-Linux-x64-7.3.5.1-installer.run command to run the graphical setup wizard. The graphical wizard will open a new window at the top of the terminal window from where you can install XAMPP. It will have two available options — Next and Cancel. Observe the instructions here to complete the installation process:

Step 1: In the setup wizard, click on Next.

Step 2: A ‘Select Components’ dialogue box will appear where you will have to click on Next once again after selecting the components you need to equip.

Step 3: The wizard will show you the location of the installed XAMPP software. Click on Next.

Step 4: Another prompt will appear that will allow you to install sponsored applications on top of your main XAMPP app. These sponsored apps will contain WordPress. You don’t have to install those apps if you don’t want to. And for that, try to uncheck the ‘Learn more about Bitnami for the XAMPP’ option.

Step 5: The wizard will tell you if it is ready to install XAMPP, and you will have to click Next.

Step 6: The installation will begin and will take some time. You can track the progress in the next prompt.

Step 7: Another prompt will appear that will tell you that the installation has been finished. You can click on Finish to perform the installation.

Step 8: XAMPP will be launched and appear on your screen. From the main dashboard, look at the upper bar, where you will find the Manage Servers option. Click on it.

Step 9: In this tab, you will see the available services of XAMPP and their status. You can change between Start or Stop.

Step 10: Now visit http://localhost/dashboard from the web browser. If you can see the localhost dashboard on your browser, the installation of XAMPP was successful.

To check if the MariaDB service is working on your XAMPP tool, you can go to http://localhost/phpmyadmin. The result will show you a service database with every service in it, including variables, SQL, etc., so that you verify if it is working or not.

Conclusion

That’s how you can install and configure XAMPP on Ubuntu, but you could also uninstall it easily with a few commands. If an uninstall of the XAMPP on Ubuntu is needed, you can go to the <strong>opt/lampp</strong> directory using cd /opt/lampp. In the directory, you can use the sudo ./uninstall command to uninstall the XAMPP tool. A command box will appear where it will ask you again if you want to uninstall it or not. To confirm uninstallation, select Yes. You can also remove the directory of the XAMPP installation using sudo rm –r /opt/lamp to remove any trace of XAMPP from your computer.

The installation of XAMPP is free localhost set up for your Ubuntu computer, but you can replace XAMPP with LAMP stack or the MEAN stack. To know more about the other two, check out our other articles. If you need any further help with how to install XAMPP on Ubuntu, drop a comment below.

Read more
07Apr

How to Install Pip on Ubuntu 18.04?

April 7, 2022 admin Ubuntu

All the Ubuntu 18.04 version users have been searching for ways to install PIP lately. It’s because this Ubuntu version comes with Python 2 and Python 3 pre-installed. That’s why installing and maintaining Python software packages on Ubuntu requires a package manager tool like PIP.

PIP is a command-line software management system that simplifies the way you install and run any application written in the Python language on Ubuntu. Generally, PIP refers to the Python 2 version, and PIP3 denotes Python 3. Since Ubuntu contains both Python 2 and 3, there are two possible variants of PIP available to install on Ubuntu 18.04.

We have provided a comprehensive guide here for installing, managing, and upgrading PIP and PIP3 on Ubuntu 18.04. Follow the below steps to install using the Ubuntu ‘apt’ package manager. Let’s get started!

Prerequisites:

  • A user account with sudo privileges
  • Access to a terminal window or command line
  • Of course, Ubuntu 18.04 system

Note: If you already have a ‘sudo’ account, skip the next section and move to the installation process directly.

How to Create a New User Account with ‘sudo’ Privileges on Ubuntu?

You might already know that a ‘sudo’ account allows you to run any program with the same security privileges a root user has. If you don’t have an account yet, first add a new user account to run the ‘sudo’ command line. This will create a group and home directory too for the new user. Here is how to do so,

Step 1: At first, log into your system with the ‘sudo’ privileged root user account

Step 2: Next, open a terminal window by pressing Ctrl+Alt+T at the same time

Step 3: Now, create a new user account with the below command (Replace the “newuser” with your one)

adduser newuser

Note: Some non-root users have noticed an error message after entering the above command. Bypass it by entering the below command-

sudo adduser newuser

Step 4: After that, your system will prompt you to enter a password and additional information (Optional)

Step 5: Once you’re done with the password, press Enter to skip the optional step

How to Add an Existing User to ‘sudo’ Group on Ubuntu?

In case you want to add an existing user to ‘sudo’ group in order to give him the root-user privileges, perform the below steps:

Step 1: Open a terminal window first with Ctrl+Alt+T

Step 2: Enter the below command next (Replace the “newuser” with your username)

usermod -aG sudo newuser

Note: If an error message pops up, enter –

sudo usermod -aG sudo newuser

Step 3: Verify the groups the new user belongs to by entering the below command next:

groups new-user

Note: If the new user’s name is not displayed under the ‘sudo’ privilege listing, perform step 4.

Step 4: Finally, switch the users by entering the following command (Replace the “newuser” with the one in Step 2)

su – newuser

Note: When you try to alter the /root directory list, it may show an error. In that case, enter the command- ‘sudo ls /root’.

How to Install PIP for Python 3 on Ubuntu 18.04?

As we’ve already mentioned, Ubuntu 18.04 comes with Python 3 pre-installed but not PIP3. Since you’ve already created a ’sudo’ account, let’s learn the steps to install PIP now.

Step 1: Open the terminal window first by pressing Ctrl+Alt+T together

Note: You can also right-click on the desktop and choose the Open Terminal option

Step 2: Next, you need to update the package list present on the repository, type in the below command for that-

sudo apt update

Step 3: Now, run the following command to install PIP3 and all the other dependencies required for building Python modules-

sudo apt install python3-PIP

Note: Once the installation process is done, you’ll be prompted to confirm it. Type Y and press Enter to confirm the same.

Step 4: Then you need to verify the install, enter the below command to do that-

PIP3 –version

Step 5: Finally, upgrade the PIP3 to its latest version by running the below-mentioned command,

sudo PIP3 install –upgrade PIP

Once done, you’re all set to smoothly run applications written in Python on your Ubuntu 18.04. If you’re using Python 2, then follow the below process to do the same on Ubuntu.

How to Install PIP for Python 2 on Ubuntu 18.04?

To install PIP for Python 2, you’ll follow more or less the same ‘sudo’ command line as shown for the PIP3. But this time, the PIP version will be different. However, first, open a terminal window and then keep performing the below mentioned step-by-step process to install PIP on Ubuntu.

Step 1: First, you have to update the package list present on the repository by entering this command-

sudo apt update

Step 2: Next, run the below command to install PIP and its dependencies to build Python modules

sudo apt install python-PIP

Step 3: You’ll be prompted to confirm the installation. Next, type Y and hit Enter in that case

Step 4: Now you have to verify the install; run the below command for that-

PIP –-version

Step 5: Finally, download the latest version of PIP for Python 2 by running the below command-

sudo PIP install –upgrade PIP

That’s all you need to do to install PIP for Python 2 on Ubuntu 18.04. Knowing only the installation process won’t help you complete your job flawlessly. It is necessary to know how to use PIP properly in order to make the most of it. Learn everything you need to know in the following section.

How to Use PIP on Ubuntu?

Before knowing the usage, let’s address a question: do you install Python modules globally on your Ubuntu system?

If so, then it is recommended to install the Python modules provided by the distribution/package manager.

Yes, when you use PIP inside a virtual environment only, it ensures a completely isolated location for the project and does not affect other Python projects.

Nevertheless, here you will learn a few basic yet effective PIP commands, with which you can easily install packages from the Python Package Index, local projects, version control, and distribution files. Take a look.

Install Packages using PIP:

Run the below command to install the latest version of a particular package:

PIP3 install Enter_Package_Name

To install a specific version of a package, run the following command

PIP3 install Enter_Package_Name==1.5

Install Packages using PIP Requirement Files:

If you want to install packages directly from its ‘requirement.txt’ file, which contains the list of PIP packages and their required versions to run a specific Python project, run the below command-

PIP3 install -r requirements.txt

Upgrade a Package using PIP:

Enter the below command to upgrade a package to its latest version with PIP-

PIP3 install –upgrade package_name

List Installed Packages using PIP:

To list all the installed packages using PIP, follow the below command line-

PIP3 list

Search for a Package using PIP:

If you need to search for a particular package installed on your Ubuntu system, type in this command-

PIP3 search Enter_Search_Term

Get a List of Outdated Packages with PIP:

To get all the outdated packages listed with PIP, enter this command-

PIP3 list –outdated

Uninstall Packages with PIP:

If you want to uninstall a package using PIP, follow the below command-

PIP3 uninstall package_name

Note: If you want to run all these basic commands on Python 2, just replace ‘PIP3’ with ‘PIP’ to get the result.

Apart from this list of basic PIP commands, if you need to know any specific one, you can type in ‘PIP3 –help’ to view the list of all commands and corresponding options.

EndNote

Now, you’ve got the complete overview of how to install PIP on Ubuntu 18.04. Hopefully, it will now be easier for you to run any Python-based application smoothly on your system. However, always remember that PIP is designed to install Python packages from Python Package Index (PyPI). So instead of installing a package globally, it’s better to install a package from the package manager while using PIP. If you’ve further queries, drop a comment in the box below. Stay connected for more tech guides.

Read more
05Apr

How to Install Java on Ubuntu?

April 5, 2022 admin Ubuntu

How to install Java in Ubuntu?

JAVA is an open-source programming language. It is an object-arranged programming language intended for having lesser execution conditions. It is a computing source for application development. Released in 1995, and since then, it has come with various latest versions with continuous improvements. Java’s most recent version incorporates many updates that improve the speed, reliability, and security system of Programs in Java.

Thus, Ubuntu also incorporates Java for creating apps and software programs for other services. Java development kit (open JDK) and Java Runtime (open JRE) are the two main java packages available in the Ubuntu repository. According to your needs, you can add any of the packages on Ubuntu. Thus if you are looking to install Java on Ubuntu, then this guide is intended for you.

There are four different versions of JAVA which are as follows:-

  • Java SE (Java Standard Edition)
  • Java ME (Java Micro Editions)
  • Java Enterprise Edition (Java EE)
  • JavaFX

To begin with, it would be great to use the version packaged with Ubuntu to install Java. Ubuntu comes as 18.4 by default with JDK 11.

You Need to Update the Package Index, for Installation of this Version;

sudo apt update

Then you have to check whether Java is already installed or not;

java -version

You will get an output below, if the Java is not installed on the system yet;

Output

Command ‘java’ not found, but can be installed with:

sudo apt install default-jre

sudo apt install openjdk-11-jre-headless

sudo apt install openjdk-8-jre-headless

To install the default java Runtime Environment (JRE), use the following command as below. It will install the JRE from open JDK 11;

sudo apt install default-jre

To verify the installation, enter the command;

java -version

You will get an output;

Output

openjdk version “11.0.11” 2021-04-20

OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04)

OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing))

To run some particular Java based software, you could also require a Java development kit (JDK).

For the JDK installation, you have to use the below given command;

sudo apt install default-jdk

Now, you can check the version of Java to ensure the installation of JDK;

javac -version

Output

javac 11.0.11

Further, you have to install Oracle’s JDK and JRE

Installing Oracle JDK 11

Automatic installation with package managers is not available in Oracle’s licensing terms for Java. Thus, an Oracle account is mandatory to download JDK and to add a new package repository for installing the Oracle JDK.

Further, use the apt to begin the installation with a third party script.

It is important to download a similar version of JDK as with the installer script.

Once the file gets downloaded, transfer it to the server. The below command will tell that you have saved the Oracle JDK file to your download folder;

scp Downloads/jdk-11.0.7_linux-x64_bin.tar.gz sammy@your_server_ip:~

After uploading to the server, add the third-party repository that assists in installing Oracle’s Java;

The software-properties-common package should be installed. It will add the add-apt-repository on the system;

sudo apt install software-properties-common

Next, to authorize the software, import the signing key;

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys EA8CACC073C3DB2A

The output you will get;

gpg: key EA8CACC073C3DB2A: public key “Launchpad PPA for Linux Uprising” imported

gpg: Total number processed: 1

gpg: imported: 1

To add the repo to the list of package sources, use the command add-apt-repository;

sudo add-apt-repository ppa:linuxuprising/java

The following message will appear;

Output

Oracle Java 11 (LTS) and 12 installer for Ubuntu, Linux Mint, and Debian.

Java binaries are not hosted in this PPA due to licensing. The packages in this PPA download and install Oracle Java 11, so a working Internet connection is required.

The packages in this PPA are based on the WebUpd8 Oracle Java PPA packages: https://launchpad.net/~webupd8team/+archive/ubuntu/java

Created for users of https://www.linuxuprising.com/

Installation instructions (with some tips), feedback, suggestions, bug reports etc.:

. . .

Then click ENTER to begin the installation. If you get any message related to no valid OpenPGP data found, just ignore it.

For the availability of new software installation, upgrade the package list;

sudo apt update

Then, the installer will search the Oracle JDK in /var/cache/oracle-jdk11-installer-local.

Create the folder with the given name and copy the Oracle JDK there;

sudo mkdir -p /var/cache/oracle-jdk11-installer-local/

sudo cp jdk-11.0.7_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/

Then, you have to install the package;

sudo apt install oracle-java11-installer-local

While installing, you have to accept the license agreements of Oracle.

To know the selection process of Java’s version, check the details.

Managing Java

Multiple Java can be installed on a single server. To check the default version, use the command below;

sudo update-alternatives –config java

You will get an Output like this if you have installed both versions of Java;

Output

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status

————————————————————

0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode

1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode

* 2 /usr/lib/jvm/java-11-oracle/bin/java 1091 manual mode

Press <enter> to keep the current choice[*], or type selection number:

Select the number linked with the Java version to make it as default. And press ENTER.

You can do the same for other java commands;

sudo update-alternatives –config javac

Commands such as, keytool, javadoc, and jarsigner can be used to run the above command.

Arranging the JAVA_HOME environment variable

The JAVA_HOME environment variable is used in various written programs.

You can use the below command;

sudo update-alternatives –config java

Then, you will get to see every command of Java with their directory;

Output

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status

————————————————————

0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode

1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode

* 2 /usr/lib/jvm/java-11-oracle/bin/java 1091 manual mode

Press <enter> to keep the current choice[*], or type selection number:

According to the above output, the installations directories are as follow;

Open JSK 11 is installed at /usr/lib/jvm/java-11-openjsk-amd64/bin/hava.

Oracle Java is installed at /usr/lib/jvm/java-11-oracle/jre/bin/java.

From your preferred installation package, copy the installation path and open /etc/environment with nano or any of your preferred text editor;

sudo nano /etc/environment

You have to add the following line at the end of the file. Just keep in mind to replace the highlighted path with the path that you have copied. Just skip the bin/ part of the path;

/etc/environment

JAVA_HOME=”/usr/lib/jvm/java-11-openjdk-amd64″

JAVA_HOME will be set as a path for every user on the system, after the modification of the file.

Finally, Save the file and exit the editor.

To apply changes to the current version, relaunch the file

source /etc/environment

Check whether the environment variable is set;

echo $JAVA_HOME

Then you will get the path as you set it;

/usr/lib/jvm/java-11-openjdk-amd64

Conclusion

In a nutshell, you must have got to learn about the installation process of multiple versions of Java. Moreover, the above mentioned steps also help you in managing java in Ubuntu.

Your Ubuntu is set to run the softwares based on Java like Tomcat, jetty, cassandra, jenkins, and Glassfish.

Read more
03May

How to Install Minikube on Ubuntu?

May 3, 2021 admin Ubuntu

When you want to develop and run applications on your local machine, Minikube is a great tool to run Kubernetes. Minikube allows you to run a Kubernetes cluster on your machine. You can install it on Windows, Linux, or macOS. With the help of Minikube, you can use the container environment or a virtual machine environment on your local machine for development work. If you are someone who develops, runs, and tests software single-handedly, you’ll need Minikube as it can aid you with the overall development process.

Minikube is an open-source tool that allows running a single Kubernetes cluster on your device. It creates a VM environment and also supports Docker and Kubernetes. It comes with features like Nodeports, Dashboard, Ingress, DNS, Secrets, CNI, etc.

If you are looking for help regarding the installation of Minikube on your Ubuntu system, you have come to the right place. This article will discuss all the steps that you need to follow for installing Minikube on your Ubuntu system.

So, without further ado, let’s get started.

How to Install Minikube on Your Ubuntu System?

There are five simple steps to install Minikube on a Ubuntu system that are listed as follows:

  1. Update the system and install required packages
  2. Install a hypervisor
  3. Install Minikube
  4. Install kubectl
  5. Start Minikube

We will discuss how to accomplish each step in detail. But before that, you need to know that these steps will allow you to install Minikube on Ubuntu 18.04 and 20.04 and even Debian 10.

1. Update System and Install Packages

Before installing Minikube, you must update your system repository cache. It is easy and can be updated with commands that are as follows:

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get upgrade

Also, install curl with the following command:

sudo apt-get install curl

2. Install a Hypervisor

As you know, Minikube creates a virtual machine environment because the Minikube cluster will be running on a virtual machine. You can use the VirtualBox Hypervisor for creating virtual machines for the Minikube. To install VirtualBox on your Ubuntu system, you need to run the following command:

sudo apt install Virtualbox virtual-ext-pack

It will ask you to confirm the installation. Input “y” to confirm and then hit “Enter”.

After confirming the installation, a license agreement will appear on your screen. You need to agree to it. Press the “Tab” button and then hit “Enter” on your keyboard to continue. The license agreement installer will ask you to agree by popping up a dialog box on your screen. Click on the “Yes” option.

Wait for the installation to complete.

3. Install Minikube

This step is quite important, so you need to be extra attentive.

Firstly, you must install the Minikube binary file using this command:

wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Now, copy the file and move it to the local directory with the following command:

sudo cp minikube-linux-amd64 /usr/local/bin/minikube

Now, you need to give the file permission to run by the system using the command mentioned below:

sudo chmod 755 /usr/local/bin/minikube

As the last step of the installation, check the version of the Minikube installed on your system by running the following command:

minikube version

4. Install kubectl

It is a very important component of Kubernetes as it manages and deploys the clusters. It can be downloaded with the help of this command:

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

Now, execute the following command to make the kubectl binary executable:

chmod +x ./kubectl

Now, move this binary path to your local path with:

sudo mv ./kubectl /usr/local/bin/kubectl

Run the following command to verify the kubectl installation:

kubectl version -o json

5. Start Minikube

Everything has been installed, and you are ready to run Minikube. Initiate Minikube by running the following command:

$ minikube start

With this command, all the components will be installed, and a virtual machine will be created to start your local Kubernetes cluster; all the cluster components will be set up, and as it finishes, you can start working.

Minikube Basics

These are some common commands which will help you get started with your local cluster.

  • Check the cluster status with the following command:
$ kubectl cluster-info
  • To check the config view:
$ kubectl config view
  • To view the nodes running on the cluster:
$ kubectl get nodes
  • To see the pods running on Minikube:
$ kubectl get pod
  • To get into the VM of the Minikube:
$ minikube ssh
  • You can stop a cluster on Minikube with the help of the following command:
$ minikube stop
  • To check the status of a running cluster::
$ minikube status
  • To delete a cluster:
$ minikube delete

Minikube Dashboard

If you do not like working with the command line, you can manage your cluster from the web dashboard of Kubernetes. It is a default add-on installation in Minikube, so you don’t need to worry about installing it separately. To see the complete lists of add-ons, use the following command:

$ minikube add-ons list

You can access this dashboard with the following command:

$ minikube dashboard

And it will open the dashboard directly on your default browser.

You can also use the URL to open the dashboard by executing the command:

$ minikube dashboard –url

Conclusion

Hopefully, this article has made it clear how you can install Minikube on Ubuntu 18.04, 20.04 as well as Debian 10 Linux. If you follow all the steps mentioned above, you can install Minikube and run it on your system within a few minutes, and that too with relative ease.

Read more
29Apr

How to Install MariaDB and Configure for Best Performance on Ubuntu?

April 29, 2021 admin MariaDB, Ubuntu

MariaDB is an open-source database server created by the original developers of MySQL. It is used by top internet giants like Google, WordPress.com, and Wikipedia. It is adept in converting data into structured information for a wide array of applications, ranging from banking to websites.

If you are also looking to use this excellent database server, this article is going to help you install MariaDB and configure it for the best performance on Ubuntu OS through a detailed step-by-step guide.

So, without further ado, let’s get started.

Installing MariaDB on Ubuntu

Ubuntu 20.x has MariaDB available on its default repositories, which can be installed directly from there.

First of all, you will need to update apt repositories data because you will be using apt for the installation of MariaDB. You can run the following command on the terminal app to update apt repositories:

$ sudo apt update

After the repository data is updated, use the command mentioned below to install MariaDB and additional required packages:

$ sudo apt install mariadb-server

You will need to enter ‘Y’ in answer to the prompt that asks you to confirm the installation of MariaDB:

Do you want to continue? [Y/n] Y

Now, MariaDB will be successfully installed on your Ubuntu 20.x machine.

Running MariaDB on Ubuntu

After being installed successfully, MariaDB will automatically start running on an Ubuntu machine. However, you can use the following commands to ensure that MariaDB runs on your Ubuntu machine:

$ sudo systemctl start mariadb. service
$ sudo systemctl enable mariadb.service
$ sudo systemctl status mariadb.service

Running these commands will make the MariaDB service start automatically every time your machine is booted.

After entering the commands, you will get an output that will look something like this:

$ sudo systemctl start mariadb.service
$ sudo systemctl enable mariadb.service

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

$ sudo systemctl status mariadb.service
  • mariadb.service – MariaDB xx.xx.xx database server

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)

Drop-In: /etc/systemd/system/mariadb.service.d

└─migrated-from-my.cnf-settings.conf

Active: active (running) since Thu 2020-12-31 13:20:04 IST; 13s ago

Docs: man:mariadbd(8)

https://mariadb.com/kb/en/library/systemd/

Main PID: 13521 (mariadbd)

Status: “Taking your SQL requests now…”

CGroup: /system.slice/mariadb.service

└─13521 /usr/sbin/mariadbd

Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] InnoDB: 10.5.8 started; log sequence number 45118; transaction id 20
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] Plugin 'FEEDBACK' is disabled.
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] InnoDB: Buffer pool(s) load completed at 201231 13:20:04
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] Server socket created on IP: '::'.
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] Reading of all Master_info entries succeeded
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] Added new Master_info '' to hash table
Dec 31 13:20:04 centos7vm mariadbd[13521]: 2020-12-31 13:20:04 0 [Note] /usr/sbin/mariadbd: ready for connections.
Dec 31 13:20:04 centos7vm mariadbd[13521]: Version: '10.5.8-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
Dec 31 13:20:04 centos7vm systemd[1]: Started MariaDB 10.5.8 database server.
$

Securing MariaDB

It is essential to secure the deployment of MariaDB, which can be done if you set up a root password, disable remote root login, remove the test database along with anonymous users, and reload privileges.

MariaDB can be hardened by running the following command:

$ sudo mysql_secure_installation

You might see some prompts after this, and you can take necessary actions for them unless you have a special requirement.

Here is the output you will get on the terminal after MariaDB has been hardened:

$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS IN PRODUCTION USE. PLEASE READ EACH STEP CAREFULLY!

  • In order to log into MariaDB to secure it, we’ll need the current password for the root user. If you’ve just installed MariaDB and haven’t set the root password yet, you should press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
  • Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorization. You already have your root account protected, so you can safely answer ‘n’.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
  • You already have your root account protected, so you can safely answer ‘n’.
Change the root password? [Y/n] n
 ... skipping.
  • By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having a user account. 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? [Y/n] Y
 ... Success!
  • Normally, root should only be allowed to connect from ‘localhost. This ensures that someone cannot guess the root password from the network.
Disallow root login remotely? [Y/n] Y
 ... Success!
  • By default, MariaDB 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? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
  • Reloading the privilege tables will ensure that all changes made so far take effect immediately.
Reload privilege tables now? [Y/n] Y
 ... Success!
Cleaning up…
Thanks for using MariaDB!
$

All done! If you’ve completed all of the above steps, your MariaDB installation should now be secured.

The system’s authentication has been used here, and that is why we haven’t set up a separate root password for MariaDB as it has been already secured, but you can set up a separate root password at any time you want.

Setup Validation

  • To verify your MariaDB setup, you need to run the command mentioned below and put in the password you set up while running mysql_secure_installation. If you skipped that step earlier and did not set up a password, you can enter your system’s root credentials.
$ sudo mysqladmin -u root -p version

Output:

Enter password:
mysqladmin Ver 9.1 Distrib 10.5.8-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab, and others.
Server version 10.5.8-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 53 min 17 sec
Threads: 2 Questions: 77 Slow queries: 0 Opens: 20 Open tables: 14 Queries per second avg: 0.024
$
  • It is also possible to set up a new admin account and use it on MariaDB instead of the root, and you can do so by running the following command (change the password to the one you want to set for your admin account):
$ sudo MariaDB

Output:

Welcome to the MariaDB monitor. Commands end with; or \g.
Your MariaDB connection id is 44
Server version: 10.5.8-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab, and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Query OK, 0 rows affected (0.003 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit
Bye
$
  • You will need to verify the access with the new admin user by entering this command:
$ mysqladmin -u admin -p version

Output:

Enter password:
mysqladmin Ver 9.1 Distrib 10.5.8-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab, and others.
Server version 10.5.8-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 56 min 59 sec
Threads: 2 Questions: 83 Slow queries: 0 Opens: 20 Open tables: 14 Queries per second avg: 0.024
$

OS Optimization

Once you have successfully installed and secured your MariaDB setup, it is time to configure it for delivering optimal performance. Two ways can help to achieve the optimal performance of MariaDB: the first way is to tune your operating system, and the second way is tuning the MariaDB.

 

Firstly, we will take a look at how to tune your OS, and this optimization will vary based on your system configuration, usage type, number of users, and various other factors.

Linux Kernel Settings – IO Scheduler

The IO schedulers that are recommended for MariaDB are noop and deadline. For checking the scheduler, use the command mentioned here:

$ sudo cat /sys/block/sda/queue/scheduler
[mq-deadline] kyber bfq none
$

A temporary change can be initiated by issuing the following command and its effect can be observed immediately on the performance of the system:

$ sudo echo noop > /sys/block/sda/queue/scheduler

For continuing this, you will need to configure it in GRUB’s configuration file as shown below in /etc/default/grub. Then, you need to rebuild GRUB and initiate rebooting the system.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"

Resource Limits – Open Files Limit

The number of file descriptors that can be opened by each process is limited by Linux. This limit can be easily exceeded for an active DB system. This limit is 1024 by default on many Linux systems, and if you want to increase this, you can add the below-mentioned lines in your /etc/security/limits.conf:

mysql soft nofile 65535
mysql hard nofile 65535

After adding these lines, you will be required to reboot the system, and then the new limits will be applied, and you can use them. You can check the increase in limits by running the following commands:

$ ulimit -Sn
65535
$ ulimit -Hn
65535

Resource Limits – Core File Size

Linux also puts limits on the size of core files, and it has a soft as well as a hard limit. By default, the soft limit is 0, which disables core file generation. You can enable the core file generation by increasing the value of core file size in /etc/security/limits.conf:

mysql soft core unlimited
mysql hard core unlimited

You will be able to check the new core file size values after rebooting the system by using the ulimit command in the following way:

$ ulimit -Sc
unlimited
$ ulimit -Hc
unlimited

Configure Swappiness

There is a swappiness value in Linux, which tells how likely is the system to swap a page from memory to swap space configured on the system, and this value is usually set to 60 by default. It can be checked by running the following command:

sysctl vm.swappiness

The value of this can fall anywhere from 0 to 100, and the higher is the value, the more likely is the system to swap. When a system is running only MariaDB, the value should be 0 because swapping should be avoided as much as possible. However, setting the value to 0 can be risky considering other design factors of the system, and if the memory usage or I/O load is high, the kernel can end up killing the Out of Memory (OOM) process.

Therefore, setting the swappiness value to 0 can pose high risks, and thus, it is advised to set it to 1 instead to avoid such risks. This can be done by adding the line mentioned below in /etc/sysctl.conf so that this change persists.

vm.swappiness = 1

In order to see the changes, you need to reboot the system; however, you can do it before as well by using this command:

sysctl -w vm.swappiness=1

MariaDB Optimization

On MariaDB, there are several tunables in its functioning that are customizable according to the needs of the user. We will be discussing some of them here.

You can configure MariaDB by using my.cnf file, which is available on Ubuntu at:

/etc/mysql/my.cnf

The details of the variables that you can use when customizing the configuration file can be found here.

The type of engine that MariaDB uses affects this tuning. These engines can be MyISAM and InnoDB or XtraDB. Both of these engines come with different advantages and disadvantages. When choosing one among them, you should consider your database and application requirements.

It can improve your performance to a high degree if you set innodb_buffer_pool_size to about 80% of your memory, as this ensures that 80% of your working set is in memory.

Here are a few other parameters that can be tuned to improve the performance of MariaDB on your Ubuntu machine:

innodb_log_file_size
innodb_flush_method
innodb_thread_sleep_delay
innodb_adaptive_max_sleep_delay
innodb_buffer_pool_instances
innodb_buffer_pool_size
innodb_max_dirty_pages_pct_lwm
innodb_read_ahead_threshold
innodb_thread_concurrency

If you want to know more about optimizing InnoDB or XtraDB variables, you can visit this link and refer to this guide to see all the available tuning options for MariaDB.

Conclusion

MariaDB is one of the most popular database servers, being open-source certainly adds to its popularity. Through this article, we shared with you an extensive account of how to install and run MariaDB on your Ubuntu machine along with the two popular ways to optimize MariaDB so that it can perform at its best.

Read more
25Jan

How to Install Docker in Ubuntu?

January 25, 2021 admin Docker, Ubuntu

Docker is one of the most popular software when it comes to creating containers for application development. While dockers share the same idea as that of virtual machines, they offer better flexibility.

Docker can readily speed up the entire application as it requires very few resources from the host’s kernel. In this tutorial, we are going to discuss how to install Docker in Ubuntu. You will learn the various ways to install Docker Engine and use it in the safest ways.

Prerequisites

Supported OS

You can easily install Docker Engine on any of the following 64-bit versions of Ubuntu:

  • Ubuntu Groovy 20.10
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)
  • Ubuntu Xenial 16.04 (LTS)

Storage Drives

Storage drives that are supported on Ubuntu include opverlay2, btrfs, and aufs.

Docker Hub Account (Optional)

Although having a Docker Hub account is completely optional, it is required if you want to publish your own images on it.

Installation Methods for the Docker Engine

Mainly, you can install Docker Engine on Ubuntu in one of the following 3 ways:

  1. A majority of the users go with installing Docker via the repository. It offers a seamless installation process without any hassles.
  2. If you want to take more control over the installation process, there’s always the option for downloading the DEB file. Once you have downloaded the file, you can install it in systems without an active internet connection.
  3. If you want to install the under-testing version for the development environment, you can always use the convenience script.

1. Installing Docker using the Repository

Setting up the repository is the prime thing that you need to do before installing your Docker Engine. You can install or update. Only after that, Docker can be installed from the repository. Here is the process to set up the Docker repository:

Step #01 – You need to update the apt package and install the apt. The apt command ensures that the repositories can take over the standard HTTPS installation.

$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Step #02 – After that, you need to add Docker’s GPG key as:

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

Step #03 – After that, you need to verify it. That verification will provide you with the key to the fingerprints. 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. You need to add only the last eight characters.

$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
  9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid  [ unknown] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017-02-22 [S]

Step #04 – After that, you need to build a stable repository by using the following command. If you want to add the test repository, you must replace the word stable with the test.

Also, you need to note that the subcommand which is stated below returns your Ubuntu distribution. Docker does not hold any guarantee for the untested distributions.

$ sudo add-apt-repository \
 "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
 $(lsb_release -cs) \
 stable"

This is for amd64. For deb_armhf and deb_arm64, you need to replace amd64 in the command with the one you want.

Installing the Docker Engine

Well, installing a Docker Engine can be done by installing the latest version after updating the apt package.

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

Also, if you have multiple repositories installed, then the most recent version of the Docker Engine will automatically be installed. You need to follow the following steps to install a specific version:

Step #01 – While installing a specified version, you can always look at the available repositories. After that, select and install.

$ apt-cache madison docker-ce
 docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 18.06.1~ce~3-0~ubuntu  | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 docker-ce | 18.06.0~ce~3-0~ubuntu  | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
 ...

Step #02 – Select the column from which you wish to install a specific version.

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Step #03 – You can always run the hello world image to properly check the installation.

$ sudo docker run hello-world

It will run in a container. After that, it will print a piece of information and exit.

Note: Docker Engine is now installed and running. Even after creating the docker group, you need to add users. For other configurational steps, and to allow a non-privileged user to run the Docker Commands, you need to proceed to Linux post-install.

How to Upgrade the Docker Engine?

To upgrade, you need to run sudo apt-get update, and after that, you need to follow the installation instructions and choose the new version to install.

2. Install from a Package

You can also install the Debian (DEB) file and install it manually without using the Docker repository. Proceed further with the following steps:

Step #01 – Go to https://download.docker.com/linux/ubuntu/dists/ and choose your Ubuntu version.

Step #02 – Browse to pool/stable/ and choose amd64, arm64 and armhf.

Step #03 – Download and install the .deb file for the corresponding version. If you need to install the test package, change the word ‘stable’ from ‘test’. After that, you need to change the below path to the directory of the downloaded Docker package.

$ sudo dpkg -i /path/to/package.deb

This will automatically start the Docker daemon.

Step #04 – Run the hello world script in order to verify the installation process.

$ sudo docker run hello-world

This will run a container. While running, it will print an informative message and exit.

Now that, you have got your Docker engine installed, but no user is added to the newly created docker group. In this case, you need to proceed to the Linux post-installation steps for further configurations.

Upgrading the Docker Engine

You need to install new files every time to install the latest Docker Engine and need to repeat the same installation process with the new file.

3. Install via a Convenience Script

You can install Docker Engine from the convenience scripts provided by Docker. You can get the scripts from get.docker.com and test.docker.com.

You can always go with these scripts to install either edge or testing versions. But it has its risks, and you need to understand them before opting to install. It is always advised to run these scripts in development environments. The risks are:

  • You need to cautiously audit the scripts as they need sudo privileges to run.
  • Scripts will tend to configure your Linux distribution system.
  • The scripts will always install the current version. There’s nothing you can do about it.
  • You must not use the scripts if your host machine has Docker preinstalled.
  • It can install a large number of the packages as it does not ask for confirmation.

The following is a script that will install the Docker Engine. You should always examine the scripts. If you want a test version, replace ‘get’ with ‘test’.

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

<output truncated>

You can always add users to the Docker group with the following command:

sudo usermod -aG docker <your-user>

It will take effect after you log out and log back in. Now the Docker Engine community is created and it will start on a .deb based distribution.

For RPM-based distribution, you should use commands like systemcl or service. You can’t run the Docker command without admin privileges.

Upgrade the Docker Engine

You can upgrade your Docker Engine using your package manager directly. If you re-run the convenience scripts, it will re-install the previously installed repositories.

Uninstalling the Docker Engine from Ubuntu

In case you do not want Docker Engine on your Ubuntu device, you can remove it by following these steps:

Step #01 – You can use the below command to uninstall Docker Engine on Ubuntu

$ sudo apt-get purge docker-ce docker-ce-cli containerd.io

Step #02 – You have to manually delete the remaining images and the containers. In case, you have edited any configuration files; you need to delete them manually as well.

$ sudo rm -rf /var/lib/docker

Final Takeaway

That was all about how to install Docker on Ubuntu. You can easily choose among the 3 aforementioned ways to get started with Docker on your Ubuntu-based device.

Ensure to pay close attention to the above-mentioned steps, and you can easily install Docker Engine on your system running Ubuntu. Leveraging Docker for DevOps technologies will deliver you a seamless workflow. So, all the best!

How to Install Docker in Ubuntu?

Read more
corporate-one-light
+1 800 622 22 02
info@scapeindustries.com

Company

Working hours

Mon-Tue

9:00 – 18:00

Friday

9:00 – 18:00

Sat-Sun

Closed

Contacts

3 New Orchard Road
Armonk, New York 10504-1522
United States
915-599-1900

© 2021 Kuberty.io by Kuberty.io