Friday, August 28, 2015

Linux Using PACKAGE MANAGERS [apt, dpkg]

PACKAGE MANAGER
  •     Every Linux Distro have a package manager.
  •     Used to install,uninstall,update and many other function related to programs in the system
Advantages
  1. Download from OS project  repositories  of packages
  2. Secure provider
  3. Dependencies resolution
  4. Common Installation and  configuration location
  5. Standard format
Package manager
 Debian/Ubuntu

  1. backend : dpkg
  2. frontend : apt
  3. GUI for apt :  aptitude

ADVANCE PACKAGING TOOL (apt)
         
 apt-get
  1. Installing : apt-get install [package name]
  2. Uninstalling : apt-get remove [package name]
  3. Remove downloaded pkg files : apt-get clean
  4. Purge : apt-get purge [package name]
  5. Update : apt-get update
 apt-cache
  1. Search : apt-cache search [package name] 
  2. Show : apt-cache show[package name] 
  3. Check if a package is install or not : apt-cache policy [package name] 
  4. List currently installed packages : apt-cache [package name]  
 /etc/apt/sources.list

  1. Contains the repositories from which apt constructs its database.
  2. Format : deb [location of resource] [distribution][components]
  3. Distribution:
lenny (current -stable)
squeezy  (testing)
sid (unstable)
etch (old-stable)


  

Init,Systemd, and Upstart

init?

In Linux, init is a abbreviation for Initialization. The init is a daemon process which starts as soon as the computer starts and continue running till, it is shutdown

If somehow init daemon could not start, no process will be started and the system will reach a stage calledKernel Panic. init is most commonly referred to as System V init. 

  • The SysV and LSB mainstay
/etc/inittab
 - calls the scripts for each runlevel

/etc/init.d/rc
  -followed by a number for the runlevel

Each runlevel has a directory of scripts
 -When entering the runlevel, start S scripts
 -When existing the runlevel, stop the K scripts

Distros using SysV init would have several directories under /etc such as rc0.d, rc1.d, through rc6.d for each runlevel.Under each of the directories, you'd have a set of symbolic links that point back to scripts that include startup and shutdown directives for services like Apache and the SSH daemon. Each link has a name like KNNsshd or SNNcups, where the NN determines the order in which services are killed (K) or started (S). 

Upstart

A replacement for SysV init 
  - Developed by ubuntu,used i other distros

Advantages over init
   - better support for hotplug devices
   - cleaner and faster service management 
   
/etc/init
 - configuration files

initctl
 - this is the script that control the application.

After months of often bitter debate,Ubuntu will ditch and adopt systemd

Systemd

  - Improve handling of dependencies
  - Concurrent processing
  - Reduce computational overhead

/etc/systemd
 - configuration files

systemctl
 - Control Services

To switch between targets :
  #systemctl isolate muti-user.target

To get the default target :    #systemctl get-default

To set the target :   #systemctl set-default graphical.target 


Locations of systemd files         #/etc/systemd/system/