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

Secure Docker using USER and Volume

Issue

Docker user has root privilege on host. The default user in container is root. In order to secure docker, we can create a user in docker container and run as non privilege user. The problem is that some services in docker need to write data to disk. E.g. druple has a files folder to store user uploaded files.

Read More

Docker restart policies.

Policies:

  • no - this is defualt value
  • no-failure - restart container if it returns an error exit code. It also supports maximum numbers of times Docker will try.
  • unless-stopped - only restart container if it is running after reboot or restart docker service
  • always - Always keep the container running
Read More