Sahil Negi
codereek

Follow

codereek

Follow
One Python menu to operate everything in Linux

One Python menu to operate everything in Linux

Sahil Negi's photo
Sahil Negi
·Aug 23, 2021·

4 min read

Some may be good at coding and operating CLI tools. But to be good at this, we need to go through a lot of practice to be confident at what we are doing. Even if we know what and how to do a task, that won't be enough. So, How about letting the computer do the tasks?

Yes! it is possible. Thanks to automation scripting with languages like python, shell or with other languages, we can make the tasks done by the computer. So why is this process good? because, when we want to set up infrastructure, though if you know how to do it on your own by manually typing all the commands, it may not be efficient with respect to time.

So if we can write a prewritten script that can do the configuration by itself, of course, it will be awesome. So this is a task from Vimal Daga Sir given to our team create a menu app that can control Docker, AWS, Hadoop, Webserver, Yum repo config, partitions and many more with one script.

You can run this script with ./main.py when you navigate into the directory. After doing that the first option will be whether you want to run commands on SSH or on your local system. most of the commands work only on the local system because we are still working to extend the scope of SSH.

image.png After this, the main menu will open and allows us to choose the options we need

image.png

This is the main menu here by entering the appropriate value.

With the help of the menu, we can perform many operations which can help anyone who doesn't know the Linux commands:

Docker Operations:

image.png In docker, we can create containers and then we can do various operations on the containers like stopping, starting, executing commands on that container and then terminating it also. you also can run these commands with ssh also.

Hadoop operations:

image.png Big data is one of the biggest and most important problems to be solved and Hadoop is one of the solutions for this problem. This CLI app can be used to install and configure and very easily with one click. Though the SSH features are not currently working, we are about to complete it soon.

Amazon Web Services Operations:

image.png AWS EC2 operations are one of the most use by every user, new or pros. So including them in the menu is very useful. All the operations of AWS EC2 and some parts of S3 are supported in this CLI menu.

Webserver actions:

image.png A webserver is an important option that needs to be done for sure because we all use webservers. Even when you are reading this article, the reason is that someone is hosting this file in their webserver. so Apache provides httpd service in RedHat to fulfil this requirement.

Partitions:

image.png Disk Partitioning is the process of dividing a disk into one or more logical areas, often known as partitions, on which the user can work separately. It is one step of disk formatting. If a partition is created, the disk will store the information about the location and size of partitions in the partition table. With the partition table, each partition can appear to the operating system as a logical disk, and users can read and write data on those disks. The main advantage of disk partitioning is that each partition can be managed separately.

Logical Volume Management:

image.png Logical volume management (LVM) is a form of storage virtualization that offers system administrators a more flexible approach to managing disk storage space than traditional partitioning. This type of virtualization tool is located within the device-driver stack on the operating system. It works by chunking the physical volumes (PVs) into physical extents (PEs). The PEs are mapped onto logical extents (LEs) which are then pooled into volume groups (VGs). These groups are linked together into logical volumes (LVs) that act as virtual disk partitions and that can be managed as such by using LVM.

Configuring YUM Repos:

YUM Repos are the first thing we need to set up after installing any operating system because we need packages to run commands on the OS and these come from the internet and we need to mention from where we want to download the packages. Hence we made it easy to configure without writing a single word.

Thanks Meher Chaitanya for contributing to this project, also thanks to Vimal Daga sir for teaching these concepts in details.

Thank You!!

 
Share this