MongoDB

MongoDB is an Open Source NoSQL database.

https://www.mongodb.com/

Connecting to to MongoDB with user/pass

Install MongoDB

Free MongoDB hosting

Rsync backup with X days retention

rsync is run on backup server, that login to remote servers and backup.

Add following code

Repeat the rsync/echo lines for each server you need to backup.

We exclude some of the files from backup, this is specified in .rsync-exclude file.

Run it with cronjob

Backup Rotation

We rotate backup, so we have 20 days of backups. To do this, run cronjob

Create script

With following content

Here you need to add a folder for each server on line PATHES.

Here is content of excludes.txt

lvm

vgcreate

When i try mount a partition i get error

mount: unknown filesystem type ‘LVM2_member’

This is because the partition is LVM. Got it fixed with

Nginx WordPress

Here is nginx configuration for wordpress

Nginx Config with FCGI Cache + gzip compression

Cpanel NetworkManager error

Cpanel Error NetworkManager is installed

When installing Cpanel on a dedicated server, i get error

NetworkManager is installed and running, or configured to startup.

To fix this, you just need to uninstall NetworkManager package.

Cpanel NetworkManager error

Another error i got on same server is

2017-12-18 09:47:20 1076 (FATAL): /etc/resolv.conf must be configured with non-local resolvers for installations to complete.

This error is fixed by editing /etc/resolv.conf and adding “nameserver 8.8.8.8” line.

Debian Allow MySQL root user to login using phpMyAdmin

On Debian/Ubuntu by default MySQL root user can only login from local accounts.

To enable login from phpMyAdmin, you need to set plugin to “mysql_native_password”.

To do this, login to MySQL as user root, then run

Configuring MySQL .my.cnf

Add following content

Replace DBPASSWORD with your MySQL root password.

Now set permission for this file to 600, so no user other than root can see it.

Install Cpanel DNS Only Server

To install Cpanel DNS only server, run

iftop

iftop

iftop show bandwidth usage like top show cpu and memory usage.

To see network usage, run

If you have multiple network interface, you need to specify network interface to monitor, this can be done with -i option

To install on CentOS, run

For installing from source, see Install iftop from source on CentOS

On Ubuntu

To use, run iftop

iftop

Cpanel Server Behind NAT – Amazon EC2

When your cpanel server is behind nat, for example Amazon EC2 where you have an internal IP and External IP.

Go to

Home > Server Configuration> Basic WebHost ManagerĀ® Setup

Enter your servers internal IP where it ask for “The IPv4 address (only one address) to use to set up shared IPv4 virtual hosts.”.

Now login to Server using SSH and run

For an Amazon EC2 server with internal IP 172.31.26.120, i added the IP in WHM > Basic WebHost ManagerĀ® Setup

Run command /scripts/build_cpnat

That associate the IP with external IP address.

This allow DNS and Apache to resolve external IP properly. With out running this command DNS server will just reply with servers internal IP address.