Linux

From Leaky
Revision as of 15:55, 27 August 2017 by Leaky (talk | contribs) (Mount .img in directory)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Distributions

Features

Common stuff

CentOS - max pids

To view the current maximum number

$ cat /proc/sys/kernel/pid_max
32768

To increase the maximum number of processes, you can use sysctl for a temporary or permanent change.

Temporarily update it (until next reboot):

# sysctl -w kernel.pid_max=1048576

or a permanent change:

# echo "kernel.pid_max = 1048576" >> /etc/sysctl.conf
# sysctl -p

cPanel sets it to 1048576 by default.

Mount .img in directory

To mount a disk image in a directory.

# losetup -v --show -f /path/to/disk.img
/dev/loop0
# mount -t ext3 /dev/loop0 /mnt

If disk.img is an image of the entire disk, not just a filesystem, you can specify

# fdisk -l /dev/loop0

Disk /dev/loop0: 4022 MB, 4022337024 bytes, 7856127 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1              62     7849447     3924693   83  Linux

This gives the start byte count (62 * 512 = 31744) to use. Remove the original loopback device (-d)

# losetup -d /dev/loop0

Add the new loopback device but specify the offset into the file as 31744 bytes.

# losetup -v --show -f -o 31744 /path/to/disk.img
/dev/loop0
# mount -t ext3 /dev/loop0 /mnt

Package repositories

If you need something more up to date than the standard CentOS packages, check EPEL (Extra Packages for Enterprise Linux) or IUS (Inline with Upstream Stable).

  • PHP 7 - IUS
  • git 2.x - IUS
  • Nagios - EPEL
  • Perl modules installed for system Perl - EPEL

With CentOS, the EPEL repository can be enabled with yum install epel-release but RHEL users need to download the rpm from the main EPEL webpage.

IUS package urls to install the repository

These can be installed with yum install $url