web analytics

Category General

Accessing Gmail with Roundcube

Requirement : I want to access my gmail under my own domain with the help of webmail.

Say my domain name is abc.com , I want to access it as http://abc.com/mail

Suppose I am on a cpanel server. Download and install Roundcube as follows.

root@me [/home/abc/public_html]# wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/1.0.0/roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# tar -xzvf roundcubemail-1.0.0.tar.gz

root@me [/home/abc/public_html]# mv roundcubemail-1.0.0 mail

root@me [/home/abc/public_html]# chown -R abc:abc mail

root@me [/home/abc/public_html]# cd mail

Now login to your cpanel and create a database for roundcube installation, create a database user and assign privileges. This can all be done from cpanel.

Once done, go to the installer link as ...

Read More

Migrating emails from mailenable to exim

I wanted to transfer my entire sites from my Windows Plesk server to Linux Cpanel server. I could simply create the new accounts in the new server and copy the files. The main issue was with emails. My windows server was using mail enable, where as the the cpanel server uses exim.

I realized I will have to create all email accounts manually in the new server. A simple tool which will do everything in a click was not available. Losing email was not something I could let happen, so I decided to go ahead with creating accounts and then copying emails. I used imapcopy for it. If anybody wants to do it, you can do it as follows. I am copying the email account test@abc.com to new server. Its password is test123c on both servers.

root@abc [~]# cd /usr/local/src/

root@abc [/usr/local/src]#  wget ...

Read More

Sharding in MongoDB

Sharding refers to the process of distributing data across multiple servers which helps in retrieving it easily. When the data set is huge, it is said that sharding significantly improves the query response time.

Let us see how we can implement sharding. Sharding requires a  minimum of three servers for test purpose. In production scenario, sharding may require more servers.

Sharding is implemented through the following :-

1) Config Servers – These servers contain the metadata as to where the data belongs to. Means, it holds data as to which shard each data goes. A minimum of 2 config servers in a huge databases system is recommended.

2) Query Router Servers – These servers are the ones that communicate with the application directly...

Read More

Find the number of FTP connections along with the connected IP Addresses

You can use the following t o find which all IP Addresses are connected to server via FTP as well as the number of connections.

netstat -tpn | grep pure-ftpd | awk ‘{print $5}’ | cut -d”:” -f1 | sort | uniq -c | sort -nr

Read More

Configuring SSL in nginx

Suppose you have a domain greproot.com for which you want to enable SSL. Make sure you have a dedicated IP for the domain. Say, 1.2.3.4 is the dedicated IP address for greproot.com

First, decide where you want to keep your certs and keys. In my case, I am going to place it in /etc/ssl/certs/ and /etc/ssl/keys respectively.

[root@abc ~]#mkdir /etc/ssl/certs/

[root@abc ~]#mkdir /etc/ssl/keys

Now we need to generate CSR and key for the greproot.com, get the cert signed and then install SSL.

[root@abc ~]#cd /etc/ssl/keys

[root@abc ~]#openssl genrsa -out greproot.com.key 2048

[root@abc ~]# chmod 600 greproot.com.key

[root@abc ~]# cd /etc/ssl/certs/

[root@abc ~]#openssl req -new -key greproot.com.key -out greproot.com.csr

Now we have the CSR and key...

Read More

Password Protecting a Site in nginx

This post will explain how to password protect a site in nginx. It is very simple and it uses the normal htpasswd protection

Suppose I need to password protect the site greproot.com whose document root is /var/www/greproot/public_html

Simple follow the steps given below

[root@abc ~]#  cd /var/www/greproot/public_html

[root@abc ~]#  htpasswd -c .htpasswd admin        where admin is the username chosen. It will prompt for password, give a strong password.

Now, your login details are stored to the file /var/www/greproot/public_html/.htpasswd and we need to call this file from greproot.com’s conf.

Simply add the following two lines before the locations

[root@abc ~]# cd /etc/nginx/sites-available/

[root@abc ~]# vi greproot.com

auth_basic “Restricted”;
auth_basic_user_file /var/www/g...

Read More

Extend partitions in 1&1 dedicated servers

1&1 dedicated servers comes with pre-configured partitions which are too small in size. If you are to host websites, create databases etc, you should definitely extend those partitions, or you will soon be flooded with low disk space warnings.

This post will tell you how you can increase the partition size. In the example I consider here, the server has two disks with 1.5T space each. The server has RAID1, which means the total usable space is 1.5T. This is how my partitions are currently.


[root@abc ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              4.0G  615M  3.4G  16% /
/dev/mapper/vg00-usr  4.0G  1.3G  2.5G  35% /usr
/dev/mapper/vg00-var  4.0G  334M  3.5G   9% /var
/dev/mapper/vg00-home
4.0G  136M  3...
Read More

MongoDB backup/restore

Want to know how the backup of mongo database can be taken. Read below…

Four tools are described here.

1) mongoexport

mongoexport can be used to take the backup of a mongo database. It takes the backup to a CSV, TSV or JSON files. The syntax is as follows.


mongoexport -d db_name -c test -o db_name.csv

where -d is the database name
-c is the collection name
-o is the file name to which the backup is to be taken


2) mongoimport

mongoimport can be used to import a backup to a database. You can import from the backup file as follows.


mongoimport -d db_restore -c test –file db_name.csv

where -d is the name of the database to which the file is to be restored
-c is the collection name
–file is the backup file

3) mongodump

For those who need a complete backup of the database, you can use mongod...

Read More

SVN dump and restore

Backup of SVN repo can be taken as follows. Suppose repo name is divz,

svnadmin dump reponame > reponame.repo

 

This dump can be used to restore the repo as follows.

svnadmin load reponame < reponame.repo

Read More

Enable root login in vsftp

Want to enable root access in vsftp? Do the following.

[~]# cp -pv /etc/vsftpd/ftpusers  /etc/vsftpd/ftpusers.bak.$(date +%F)

[~]# vi  /etc/vsftpd/ftpusers

Now remove root if present from the file. Save and quit the file.

We need to do the same from one more file also.

[~]#cp -pv   /etc/vsftpd/user_list  /etc/vsftpd/user_list.bak.$(date +%F)

[~]# vi /etc/vsftpd/user_list

Remove root from the users listed in this file. Save and quit.

Now restart vsftp.

[~]#/etc/rc.d/init.d/vsftpd restart

Now try connecting with root user in FTP.

 

Read More