Category Archives: Linux

How to install MongoDB on Ubuntu 16.04

To ensure the credibility of the packages Ubuntu makes sure they are signed with GPG keys.
Let’s begin by importing the GPG keys we need for the official MongoDB repository:

Next add the MongoDB repository in /etc/apt/sources.list.d using this command:

Installing MongoDB

Create service file for MongoDB

Paste following code:

Now we have to update systemd to include our newly created service and we enable and start the service:

Create admin user in MongoDB:

Enable MongoDB authentication

Open file /etc/systemd/system/mongodb.service and update following line:

After that reload configurations:

Now connect to the MongoDB shell using this command:

Install WordPress on Nginx

Download latest wordpress code:

Extract files:

Copy all extracted files to /var/www/html folder:

Change directory to /var/www/html folder:

Change group and owner of all files to www-data:

Create MySQL user for

Create wp-config.php file and update as per above details.

To create a virtual host please follow this post

SSL Setup on Nginx Server

To add https support on your website you need to follow these steps:

Get the SSL certificate

There are various vendors from which you can buy SSL certificate. If you want to generate self signed SSL certificate instead of buying it, please execute below command:

Add -nodes in the above command if you do not want to set any passphrase for your private key.

Copy certificate to right location

Once the certificate is generated copy it to /etc/ssl/ folder on your server.

Update virtual host file

Open your virtual host config file ( /etc/nginx/sites-enabled/your_site.conf):

Deploy your Website Changes using Git

It is really a bad idea to deploy website using FTP and replacing old files with new one. Let me explain you the deployment using git which makes the life easy.

Before starting we need SSH client and Git to be installed on our local machine. I am assuming you already have installed these applications. So lets begin the interesting stuff.

We need to install Git on the remote server, so SSH to the server and issue following command:

Now we need to create a bare Git repository which should located outside the webroot. We can keep it in our home directory or create a separate folder in the home folder for bare Git repositories.

Lets create out Git repository

Now we are going to create a hook which will move latest changes in the webroot. Create a file hooks/post-receive and paste following code it it:

Update the GIT_WORK_TREE path with your webroot path. Make this file executable:

Server setup is done.

On your local machine you just need to add a remote branch to push your changes.

Your latest code is deployed to the server.


Share network drive on rdesktop

If you want to share clipboard and map your local drive as server’s network drive, you can do this using rdesktop.

Once you get connected your home directory will be available on the server as network drive.