×


Blog


Install and Use Docker Compose on CentOS 8 - Step by Step Process ?

This article covers how to install and use the Docker-compose on CentOS 8 system. By using the Docker-compose, you can deploy multiple Docker applications with container services through a single command. 

Basically, Docker Compose is a tool that can be used to define and run multiple containers as a single service. With Docker Compose, you can link multiple containers and deploy an application from a single command. 

It is mainly used in the development, testing and staging environment. 

Docker Compose uses a YAML file to define a complex stack in a file and running it with a single command.


To install Docker on CentOS:

1. Before starting, make sure you have Docker installed on your server. If not installed, you will need to add Docker-CE repository to your system. 

You can add it with the following command:

$ dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

2. Once the repository is added, install the latest version of docker using the following command:

# dnf install docker-ce --nobest -y
# systemctl start docker
# systemctl enable docker

3. You can verify the docker version with the following command:

$ docker --version


Install Python 3.9 on Ubuntu 20.04 - Step by Step Process ?

This article covers how to install and compile Python3.9 using different methods, using PPA repo, compiling it from the source code, and installing it using the Linuxbrew tool.

We can now start using Python 3.9 for our projects.

Python is a high-level programming language, mostly used to write scripting and automation. It is a very popular language known for its simplicity and easy syntax. 

Python one of the best language for for artificial intelligence (AI).


To Install Python 3.9 on Ubuntu 20.04 using APT:

1. Update package list, type:

$ sudo apt update

2. Install software-properties-common package to easily manage distribution and independent software vendor software sources:

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa

3. Now install python 3.9 using apt command:

$ sudo apt-get install python3.9

4. The following command can help to identify the proper install location of Python:

$ which python3

The execution of the above command produces the following output on console:

/usr/bin/python3


Install AWX on Ubuntu 20.04 - Step by Step Process ?

This article covers how to install ansible AWX on Ubuntu 20.04. You have got a basic idea about managing hosts, inventories, and projects from AWX ansible.

Ansible AWX is an open source tool which provides a web-based user interface, REST API, and task engine for easy and collaborative management of Ansible Playbooks and Inventories.

AWX allows you to centrally manage Ansible playbooks, inventories, Secrets, and scheduled jobs from a web interface. 


To Install Ansible on Ubuntu:

Run the following commands,

# sudo apt update
# sudo apt install ansible


Add a User to Sudoers on Ubuntu 20.04 LTS - Step by Step Process ?

This article covers how to add a user to sudoers using different methods, limit root access with sudo and remove a user from sudoers.

Sudo is a very handy tool for system administrators that allow them to provide root access to a user with granularity.


Steps to Add Sudo User on Ubuntu ?

1. Log into the system with a root user or an account with sudo privileges.

2. Open a terminal window and add a new user with the command:

# adduser newuser

The adduser command creates a new user, plus a group and home directory for that user.

You may get an error message that you have insufficient privileges. (This typically only happens for non-root users.) Get around it by entering:

# sudo adduser newuser

3. You can replace newuser with any username you wish. The system will add the new user; then prompt you to enter a password. Enter a great secure password, then retype it to confirm.


To Add User to Sudo Group:

1. In a terminal, enter the command:

# usermod -aG sudo newuser

Replace newuser with the username that you entered in Step 1.

Again, if you get an error, run the command with sudo as follows:

# sudo usermod -aG sudo newuser

The -aG option tells the system to append the user to the specified group. (The -a option is only used with G).


Install Apache OpenOffice on CentOS 8 - Step by Step Process ?

This article covers how to install Apache OpenOffice on CentOS 8. Apache OpenOffice is a software bundle which contains various software tools like word processor, spreadsheet, database management, and so on. It is very much similar to other popular editors like Libreoffice and NeoOffice. 


Main features and tools provided by OpenOffice:

1. Writer a word processor you can use for anything from writing a quick letter to producing an entire book.

2. Calc a powerful spreadsheet with all the tools you need to calculate, analyze, and present your data in numerical reports or sizzling graphics.

3. Impress the fastest, most powerful way to create effective multimedia presentations.

4. Draw lets you produce everything from simple diagrams to dynamic 3D illustrations.

5. Base lets you manipulate databases seamlessly. Create and modify tables, forms, queries, and reports, all from within Apache OpenOffice.

6. Math lets you create mathematical equations with a graphic user interface or by directly typing your formulas into the equation editor.


Unit Testing in Python - A Quick Overview ?

This article covers the concept of Unit Testing in Python. Testing in Python is a huge topic and can come with a lot of complexity, but it doesn't need to be hard. You can get started creating simple tests for your application in a few easy steps and then build on it from there.

Here, You'll learn about the tools available to write and execute tests, check your application's performance, and even look for security issues.


pytest supports execution of unittest test cases. The real advantage of pytest comes by writing pytest test cases. pytest test cases are a series of functions in a Python file starting with the name test_.


pytest has some other great features:

1. Support for the built-in assert statement instead of using special self.assert*() methods

2. Support for filtering for test cases

3. Ability to rerun from the last failing test

4. An ecosystem of hundreds of plugins to extend the functionality


Running Your Tests From Visual Studio Code

If you're using the Microsoft Visual Studio Code IDE, support for unittest, nose, and pytest execution is built into the Python plugin.

If you have the Python plugin installed, you can set up the configuration of your tests by opening the Command Palette with Ctrl+Shift+P and typing "Python test". 


How to Use unittest and Flask

Flask requires that the app be imported and then set in test mode. You can instantiate a test client and use the test client to make requests to any routes in your application.

All of the test client instantiation is done in the setUp method of your test case. In the following example, my_app is the name of the application. Don’t worry if you don’t know what setUp does. You’ll learn about that in the More Advanced Testing Scenarios section.


The code within your test file should look like this:

import my_app
import unittest

class MyTestCase(unittest.TestCase):
    def setUp(self):
        my_app.app.testing = True
        self.app = my_app.app.test_client()
    def test_home(self):
        result = self.app.get('/')
        # Make your assertions

You can then execute the test cases using the python -m unittest discover command.