Difference between revisions of "Linux"

From Leaky
Jump to: navigation, search
(Added process id limits)
(Mount .img in directory)
 
(3 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
* [[LVM]]
 
* [[LVM]]
 
* [[Nginx]]
 
* [[Nginx]]
 +
 +
== Common stuff ==
 +
 +
* Scripts to help with Nagios and server reboots - https://github.com/LaMi-/nagios_downtime
  
 
== CentOS - max pids ==
 
== CentOS - max pids ==
Line 29: Line 33:
  
 
cPanel sets it to 1048576 by default.
 
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 [https://fedoraproject.org/wiki/EPEL EPEL] (Extra Packages for Enterprise Linux) or [https://ius.io/GettingStarted/ 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 <code><nowiki>yum install epel-release</nowiki></code> but RHEL users need to download the rpm from the main EPEL webpage.
 +
 +
IUS package urls to install the repository
 +
 +
* https://rhel6.iuscommunity.org/ius-release.rpm
 +
* https://rhel7.iuscommunity.org/ius-release.rpm
 +
* https://centos6.iuscommunity.org/ius-release.rpm
 +
* https://centos7.iuscommunity.org/ius-release.rpm
 +
 +
These can be installed with <code><nowiki>yum install $url</nowiki></code>

Latest revision as of 15:55, 27 August 2017

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