Install memcache on cpanel

How to install memcached on cpanel server.

1: Login to WHM > Software > Easyapache 4 > “Currently Installed Packages” > Customize > Apache module > search using memcache > install this if it is not.

2: Login to server via ssh as root user and execute following command.

yum install memcached.x86_64 -y

3: Then WHM > Software > Module Installers > PHP Pecl, search for memcache this will list both memcache and memcached, install both.

4: Restart service apache.

5: Now start memcached by executing command

memcached -d -m 512 -l -p 11211 -u nobody

6: Verify if it is working by executing command :  systemctl start memcached

7: Enable memcached so whenever server will reboot service will get start automatically.

systemctl enable memcached

8: Check memcached status using command.

systemctl status memcached

Output should be like:

* memcached.service – Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-11-05 18:38:46 -05; 7s ago
Main PID: 47657 (memcached)
CGroup: /system.slice/memcached.service
`-47657 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024

Nov 05 18:38:46 systemd[1]: Started Memcached.
Nov 05 18:38:46 systemd[1]: Starting Memcached…

Now you shall able to use memcached  in your applications.


Deleting files using find

We will learn how to delete files using command find from given folder.

Suppose you want to delete .png files from /home/directory.

Use following command

find /home/directory/ \( -name "*.png" \) -type f -exec rm {} +

This will delete file with extension .png from /home/directory and sub directories of /home/directory like *.png files from /home/directory/directory2/ as well .

But suppose if you need to delete .png files only from directory /home/directory and not from sub directories then use following command.

find /home/directory/ -maxdepth 1  \( -name "*.png" \) -type f -exec rm {} +

Install MongoDB on Ubuntu 18.04

How Install MongoDB on Ubuntu 18.04..

What is MongoDB ?

MongoDB is a free and open-source NoSQL document database which uses JSON-like documents with schemata. It means fields can vary from document to document and data structure can be changed over time.

In this tutorial we will learn how to install MongoDB, manage MongoDB service, and enable remote access.

First we will update package list so we will have more recent repository version listing.

Command to update package list on Ubuntu 18.04 is

apt update

Now install MongoDB using command

apt install mongodb -y

This command will install latest version of mongodb on your server along with management tools required for mongodb server.

Let’s check status of mongodb service installed using command

systemctl status mongodb

If you see active running then it is up and running.

We will execute further command to connect mongodb server

mongo --eval 'db.runCommand({ connectionStatus: 1 })'

Above command will provide version of mongodb server as output.

Output should be like:

MongoDB shell version v3.6.3
connecting to: mongodb://
MongoDB server version: 3.6.3
        "authInfo" : {
                "authenticatedUsers" : [ ],
                "authenticatedUserRoles" : [ ]
        "ok" : 1

Here ok: 1 means service mongodb is ready to use.

Below are command to start, stop, restart.

systemctl start mongodb

systemctl stop mongodb

systemctl restart mongodb

By default it is enabled for onboot start. Command to disable/enable ie. to disable automatic start on server boot is

systemctl disable mongodb

To enable automatic start of mongodb server on server boot is

systemctl enable mongodb

Port used by mongodb server is 27017. You need to open this port in firewall if you want to allow access to this server from remote server.

Once you open port you will need to define IP of remote server in mongodb configuration.

vi /etc/mongodb.conf

find line starting with word bind_ip and then add all remote server IPs and separate them by comma for example to allow IPs and

Change line
bind_ip =
bind_ip =,,

Save file and restart mongodb service.

systemctl restart mongodb.