Setup IP Address and Network Connection on CENTOS 7

Standard

Edit ifcfg file

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Add this

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=62f47c6d-cf65-409f-bbd6-696db494d74c
DEVICE=eth0
ONBOOT=yes
IPADDR=73.123.136.53
NETMASK=255.255.255.248
GATEWAY=73.123.136.49
DNS1=8.8.8.8
DNS2=8.8.4.4

And then run command

service network restart

ping google.com

Changing Primary Domain Document Root in Cpanel

Standard
  1. Login to ssh.
  2. sudo and edit this file:
    /var/cpanel/userdata/user/domain

    If you have SSL:

    /var/cpanel/userdata/user/domain_SSL

    user is your cpanel username and domain is your domain, _SSL capital leter.

  3. Change these 2 line to your new document root:
    documentroot: /home/USER/public_html

    and

    path: /home/USER/public_html/cgi-bin
  4. Run sudo:
    sudo /scripts/rebuildhttpdconf
    sudo service httpd restart
  5. Done.

Protecting a file using chattr command

Standard

Write protecting a file using chattr command

Let say you want to write protect the file called data.txt so that no other users can change it including root user, enter (you must login as the root user to use chattr command):

# chattr +i data.txt

To remove i attribute, enter:

# chattr -i data.txt

Yum Repo Command

Standard

YUM REPO

To list only enabled repos, enter:

# yum repolist enabled

To list only disabled repos, enter:

# yum repolist disabled

To list all repos (default), enter:

# yum repolist all

To list available packages under a repo called ksplice-uptrack, enter:

# yum --disablerepo="<repo name>" --enablerepo="<repo name>" list available