Change hostname and static IP on Centos 7

Change hostname

  • Edit file: /etc/sysconfig/network
    HOSTNAME=servername.domain.com
    
  • Add the servername in /etc/hosts file
  • Run hostname command
    sudo hostname servername.domain.com
    
  • Restart network service
    sudo /etc/init.d/network restart
    
Read More

PHP extensions

Useful extensions:

php-xml php-gd php-curl php-mcrypt php-mbstring php-gettext

For mysql: php-mysql
For Apache2: libapache2-mod-php

Read More

Remove old kernels on Linux

Display current kernel

  $ uname -r
  $ uname -mrs

On ubuntu

  • List all installed kernels
    $ dpkg --list | grep linux-image
    
  • Remove old kernels
    $ sudo apt-get autoremove
    
Read More

Linux System Monitor Commands

Checking service/process

SERVICE=lighttpd
if ps ax | grep -v grep | grep $SERVICE > /dev/null; then echo -n "\"$SERVICE\" : \"running\","; else echo -n "\"$SERVICE\" : \"not running\","; fi
Read More

Ubuntu proxy settings

For apt, software center etc

edit file /etc/apt/apt.conf

Acquire::http::proxy "http://username:password@host:port/";
Acquire::ftp::proxy "ftp://username:password@host:port/";
Acquire::https::proxy "https://username:password@host:port/";

Environment variables

edit file /etc/environment

http_proxy=http://username:password@host:port/
ftp_proxy=ftp://username:password@host:port/
https_proxy=https://username:password@host:port/
Read More