Managing Packages & Users
Index
- Installing and Removing Software in Linux
- Getting and Unpacking the Package
- Configuring the Package
- Compiling the Package
- Managing Users and Groups
Installing and Removing Software in Linux
- Enable root user
sudo passwd root- Install the package in the root user (vim is text editor package/ software)
apt-get install vim- Install the package in the normal user (okular is pdf viewer package)
sudo apt-get install okular
Removing Package/ Software
sudo apt remove vim
(vim package name )
Getting and unpacking the package
A tar.gz file contains several compressed files to save storage space, as well as bandwidth during the downloading process. The .tar file acts as a portable container for other files and is sometimes called a tarball. The .gz part of the extension stands for gzip, a commonly-used compression utility.
Prerequisites
- Access to a command-line/terminal window
- The tar utility (included by default)
- The gzip utility (included by default)
Extracting tar.gz Files in Linux
Using gzip Utility for zipping the files
Gzip by default, extracts the file in the current directory. In this example, the file is located in the Documents directory. Below, we have used the file named test.txt. Use the name of the file you want to compress instead. to compress a single file with gzip enters the command in your terminal window:
gzip test.txt
After zipping the file, enter the command ls to confirm that the file has been compressed. The output confirms that the file now has a .gz extension.
~/Documents$ gzip test.txt
~/Documents$ ls
test.txt.gz
Using gunzip to unzip the files
To decompress a file, use the gunzip command:
gunzip test.txt
Again, use the ls command to confirm the extension of the file.
~/Documents$ gunzip test.txt
~/Documents$ ls
test.txt
Configuring a Package
dpkg –configure one of the popular commands used to configure unpacked programs or packages. Configuration command is used to unpack and configure the package. You can unpack packages with the following command:
$ dpkg --unpack [package_name]
Now, you can configure the package you have recently unpacked above. To configure it, use the following command:
$ dpkg --configure [package_name]
How to Compile the Package on Linux
The build-essential package contains make, the automatic tool used to begin compiling your source code into software that you can run on your PC. It uses the makefile file, configured and created by the earlier configure command, which contains the specific instructions needed to compile your package.
To begin compiling your source code, open a terminal and use the cd command to enter the correct folder. When you’re ready, type make to begin compiling your package.
This will take a little bit of time to complete, depending on the size of the package and your available system resources. If no errors appear after your software package has been compiled, you can then install your package.
Managing User and Groups
What is a User?
A user is another name of an account capable of logging into a computer. A user is an individual who uses the available hardware and software resources.
User account Properties – /etc/passwd
User Password Properties – /etc/shadow
Type of User:
- System User: - It is created by OS automatically.
Eg.
Root user account automatically created at the time of Linux OS Installation.
Administrator user account automatically created at the time of Windows OS installation. - Normal User: - It is created by privilege/Administrator user
Eg.
Student, Sachin, Ajay
To manage user accounts use the following commands –
- useradd: - use to add a user account
- usermod: - use to modify existing user account
- userdel: - use to delete a user account
- passwd: - use to create or change a user account password
Manage User Account step by step: -
- For Create user account:
useradd ajay - For check user account properties: grep search ajay string into passwd file were stored the user account database and display the whole line where match ajay string.
grep ajay /etc/passwd - For Crate/change user account password:
Type here the password which wants to set, need to re-enter the password for the confirmation.Passwd ajay - For switch one user account to another user account:
su ajay - For delete user account:
userdel ajay
With above command, we can delete the user account but it home directory still remains, for deleting the user account with the home directory we can use the following command.userdel -r ajay
What is a group?
Group is a collection of user accounts which very uses full to an administrator for manage and apply for permission on a number of users.
Group Properties – /etc/group
Group Admin Properties – /etc/gshadow
Type of Group:
- Primary Group: - The primary group create and delete with user account operation
- Secondary Group: - The secondary group creates and delete by the privileged user.
- For add group account: -
groupadd developergrp
grep developergrp /etc/group
gpasswd -a sara developergrp
gpasswd -M ajay,vijay,harry developergrp
gpasswd -A sara developergrp
gpasswd -A “” developergrp
Grep developergrp /etc/gshadow
groupdel developergrp
groupmod -g 2556 developergrp
Comments
Post a Comment