How to install docker-compose on a fresh Alpine Linux

Alpine Linux is a Linux distribution based on musl and BusyBox, primarily designed for power users who appreciate security, simplicity and resource efficiency.

1. Edit repository file
Open the /etc/apk/repositories with your text editor and uncomment the line for community. In my case, I will use vi.

vi /etc/apk/repositories

2. Update packages
To get the latest list of available packages, use the update command.

apk update

3. Upgrade installed packages (Optional)

apk upgrade

4. Install Docker
We need to install docker, add it in the startup, and start the docker service.

apk add docker
rc-update add docker boot
service docker start

5. Install docker-compose
docker-compose is not yet available in apk, so we will be using PIP to install it.

apk add py-pip
pip install docker-compose

Congratulations, you should now have docker-compose in your fresh Alpine Linux

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04

The following instruction assumes that you know what a LAMP Server is and what it is for.

1. Install Apache
To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt install apache2

2. Install MySQL
To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt install mysql-server

3. Install PHP
PHP requires a few packages to work as you expect, so we recommend the following command.

sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php

4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.

sudo service apache2 restart

5. Verify Apache
You can type the following in terminal to check your web server.

curl http://localhost/

Or open a web browser and navigate to http://localhost/. You should see a message saying It works! or type

6. Verify PHP
You can check your PHP by executing any PHP file from within /var/www/html. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file.

php -r 'phpinfo();'

You should now have your Ubuntu LAMP Server.

How to install docker-compose in Ubuntu Server

One of the most widely used Linux Distro is Ubuntu because of its apt-get and the community who is actively supporting it. To install docker-compose you will need to logon to your server and type the following commands in your terminal.

sudo apt-get update
wget -O- | sudo sh

Once docker is installed, you will have the option to add a user to the docker group, but note that doing so will give them the chance to get a root priviledge to your docker host. To add a user in the docker group, you can type the following command.

sudo usermod -aG docker your-user

You can install docker-compose with several option:

sudo curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo apt-get install -y python-pip
sudo pip install docker-compose
#As of this writing docker-compose version 1.21.2, build a133471
sudo apt-get install -y docker-compose

It’s up to you which one you prefer, but for me, I am using option 2 which is via PIP.

How to get real IP of user in WordPress when using NginX as proxy

If your wordpress instance is behind an Nginx Proxy, by default you won’t get their real IP. To fix this issue, you will need to update your proxy configuration with the following details:

server {
	listen 443 ssl;
	ssl_certificate /cert/;
	ssl_certificate_key /cert/;
	error_log  /var/log/nginx/error.log;
	access_log /var/log/nginx/access.log;
	resolver valid=5s;
	set $upstream http://webserver;
	location / {
		proxy_set_header  Host $host;
		proxy_set_header  X-Real-IP $remote_addr;
		proxy_set_header  X-Forwarded-For $remote_addr; 
		proxy_set_header  X-Forwarded-Host $remote_addr;
		proxy_pass $upstream;

Once updated, restart your nginx service and add the following code in your wp-config.php file.

if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
  $http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );

  $_SERVER['REMOTE_ADDR'] = $http_x_headers[0];

You should now see your visitor’s IP.

How to Share Windows Host file system to Guest Ubuntu OS in VirtualBox

To share a windows file system, you will need to go to your VM’s settings, Select Shared Folders and click the Folder with Plus(+) icon on the right of the dialog box. Select the directory that you want to share and click OK.

You will also need to insert the VirtualBox’ Guest Addition CD image. You can do this by selecting the Devices in the Toolbar and you should see it in the bottom of the screen.

Once Guest Addition CD image is inserted, you will need to execute the following in the Guest OS’ Terminal

sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
sudo mount /dev/cdrom /media/cdrom
cd /media/cdrom

Reboot the Guest OS and create a folder anywhere

mkdir sharedWindows
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) Windows ~/sharedWindows

At this point, you should be able to see your C:\Windows contents in your Guest OS.