Linux BootCamp Series – Repository Mangement

Installing Tomcat on Centos and Ubuntu

  • Searching Java 8
# Create a Centos Machine
sudo yum update

sudo yum search jdk


sudo apt-get update
sudo apt-cache search jdk
  • Repeat the same process to search for tomcat
sudo yum search tomcat

sudo apt-cache search tomcat

Findout Version of the Software to be installed

sudo apt-cache madison <package-name>
  • Exercise: Try installing older version of Jenkins on ubuntu
  • Try doing the same exercise on centos

Uninstalling Software from Linux

  • APT:
apt-get remove <package-name>
apt-get purge <package-name>
  • YUM:
yum remove <package-name>

Important References

Users and Groups in Linux

Preview

  • Linux is a multi-user OS
  • Since multiple users are involved, managing permissions for user w.r.t any devices/folders etc.. is must to understand/

User-Creation

  • To create user in linux we have useradd and adduser
  • So lets try to create user1 and user2 in both centos and ubuntu.
# become root (sudo -i)
adduser user1
useradd user2
  • Observe the contents of /etc/passwd
cat /etc/passwd
  • Centos Users Preview

  • Ubuntu Users Preview

  • Passwd file in /etc folders shows the username, userid, groupid, home directory and default prompt

  • Useradd command behavior

    • Centos:
      • Creates home directory
      • Password is not set
    • Ubuntu:
      • Doesn’t create the home directory
      • Password is not set
  • adduser command behavior

    • Centos
      • Creates home directory
      • Password is not set
    • Ubuntu:
      • Creates home directory
      • Password is set when user enters password as part of the user creation
  • Whenever a user is created , a group with same name as user name will also be created

  • groups can be created using groupadd & deleted using group del

  • To Set Password

passwd <username>
  • To set basic permissions linux adopts numbering
    • Read = 4
    • Write = 2
    • Exectue = 1
  • Now navigate to /home and execute
ls -la /home and check the permissions

# Sample
total 28
drwxr-xr-x  2 test    test    4096 Dec 23 02:32 test
drwxr-xr-x  5 ubuntu  ubuntu  4096 Dec 23 02:37 ubuntu
drwxr-xr-x  8 jenkins jenkins 4096 Dec 26 02:53 jenkins
drwxr-xr-x 23 root    root    4096 Dec 28 02:28 ..
drwxr-xr-x  2 user1   user1   4096 Dec 28 04:01 user1
drwxr-xr-x  2 root    root    4096 Dec 28 04:12 user2
drwxr-xr-x  7 root    root    4096 Dec 28 04:12 .
  • Lets understand permissions, basic pattern is
d<User permission in rwx><group permission in rwx><others permission in rwx>

#sample
rw- => read write => 6
r-- => read 4
r-x => read execute => 5
rwx => read write execut => 7
  • Changing permissions require numbering
  • Whenver user is added a unique user id (uid) is created, when the user is deleted (userdel) the user name will be removed from /etc/passwd, but the uid will not be allocated to any other user
  • The users created over here are local to the machine in which they are created.
  • Exercise: Examine /etc/passwd file for Jenkins Master.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner