RHEL/CentOS – How to install NGINX

Pre-requisites:

make sure EPEL is enabled – see here.

Once that is done just issue:

yum install nginx

and when installed enable the service so it starts with they OS:

[root]# chkconfig nginx
Note: Forwarding request to 'systemctl is-enabled nginx.service'.
disabled
[root]# chkconfig nginx on
Note: Forwarding request to 'systemctl enable nginx.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root]# chkconfig nginx
Note: Forwarding request to 'systemctl is-enabled nginx.service'.
enabled

RHEL/CentOS – How to enable EPEL Repository

What is EPEL?

EPEL (Extra Packages for Enterprise Linux) is a volunteer-based community effort from the Fedora project to create a repository of high-quality add-on packages that complement the Fedora-based Red Hat Enterprise Linux (RHEL) and its compatible spinoffs, such as CentOS and Scientific Linux.

Why?

  1. it provides tons of open source packages that can be installed via YUM
  2. maintained by Fedora – therefore trusted

How?

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -Uvh epel-release-7-5.noarch.rpm
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm
## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm

# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm
## RHEL/CentOS 4 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
# rpm -Uvh epel-release-4-10.noarch.rpm

## RHEL/CentOS 4 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
# rpm -Uvh epel-release-4-10.noarch.rpm

once the package is installed update yum and verify that epel is in on our repo list:

[root]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.strencom.net
 * epel: epel.check-update.co.uk
 * extras: mirror.strencom.net
 * updates: mirror.strencom.net
No packages marked for update
[root]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.strencom.net
 * epel: epel.check-update.co.uk
 * extras: mirror.strencom.net
 * updates: mirror.strencom.net
repo id                                 repo name              status
base/7/x86_64                           CentOS-7 - Base        9,007
epel/x86_64                             Extra Packages for Enterprise Linux 7 - x86_64        9,111
extras/7/x86_64                         CentOS-7 - Extras        191
updates/7/x86_64                        CentOS-7 - Updates       369
repolist: 18,678

 

CentOS disable firewall

How Do I Disable Firewall?

First login as the root user.
Next enter the following three commands to disable firewall.
# service iptables save
# service iptables stop
# chkconfig iptables off

If you are using IPv6 firewall, enter:
# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off

How to setup NIC teaming in Linux (CentOS)

Lab hardware: HP ProLiant DL360 G5 running CentOS

If you want to create a bonding on two interface (i.e. eth0 and eth1) you should do the following :
Edit /etc/sysconfig/network-scripts/ifcfg-eth0

# Bonding eth0 to bond0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=NO
TYPE=Ethernet

Edit /etc/sysconfig/network-scripts/ifcfg-eth1

# Bonding eth1 to bond0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=NO
TYPE=Ethernet

Copy /etc/sysconfig/network-scripts/ifcfg-eth1 to /etc/sysconfig/network-scripts/ifcfg-bond0 to keep the same file permission by executing the following commands :

cd /etc/sysconfig/network-scripts
copy ifcfg-eth1 ifcfg-bond0

Edit /etc/sysconfig/network-scripts/ifcfg-bond0

ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.100.100.0
NETMASK=255.255.255.0
IPADDR=10.100.100.1
GATEWAY=10.0.0.254
USERCTL=NO
TYPE=BOND

Edit /etc/modprobe.conf adding the following line :

alias bond0 bonding

Reboot your system to let modules be loaded or load it manually with the following command :

insmod bond0 bonding

If you haven’t rebooted your system, restart your network with the following command :

/etc/init.d/network restart

You should check if bonding is working you should look at /proc/net/bonding/bond0 with the following command :

cat /proc/net/bonding/bond0

and you should see something similar to the following :

Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:17:88:5a:3c
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:17:88:5a:3d

DONE