Posts Under Category: VPS

Many server / VPS have very small /tmp partition like 500 MB. It is recommended to have /tmp partition of minimum 2GB.
If you server is facing issue of /tmp partition filling-up quickly, here is how you can increase its size.

This tutorials explains how easily you can increase size of /tmp partition on a cPanel server / VPS.
Login as root via SSH to your server, and follow below steps / commands.

Step 1: Stop services

Before you start resizing, you should stop cpanel, apache and mysql. Run following command to stop these services

/etc/init.d/cpanel stop
/etc/init.d/httpd stop
/etc/init.d/mysql stop

Step 2: Umount /tmp and /var/tmp

umount -l /tmp
umount -l /var/tmp

Step 3: edit /scripts/securetmp

vi /scripts/securetmp

And change value of my $tmpdsksize For making size of /tmp partition to 2GB change its value to 2048000. After making change save this file. It should be like this:

$tmpdsksize = 2048000

Step 4:Run these commands to resize /tmp partition

rm -fv /usr/tmpDSK
/scripts/securetmp

Step 5: Start services

/etc/init.d/httpd start
/etc/init.d/mysql start
/etc/init.d/cpanel start

Done!!! The /tmp partition on your cPanel server is now of 2GB

This tutorial is applicable only for cPanel Server / VPS

Our Recommended Dedicated Server

I will try to explain the tutorial step by step on a fresh VPS.

I just got a fresh VPS with only operating system installed. OS installed on my VPS is centos 6 64-bits. Below is details of my new VPS.

OS: centos 6 64-bits
IP: 5.231.81.71

Login to your VPS/server as root via SSH and follow these simple steps.

Step 1: Install Apache

My first step is to install Apache on my server. Run following command to install Apache on the VPS.

yum install httpd
service httpd start

For detailed instruction, please refer to this tutorial:
How to install Apache on a Linux Server

After installing Apache, VPS IP will show default Apache page.
default-apache-page

Step 2: Upload HTML pages

Now upload your HTML pages in /var/www/html/ directory.
Your website is now running on your VPS. Address of your website is your VPS IP.
website-on-ip

Step 3: Use a domain name

Now its time to use a domain name like domain.com for your website. This can be achieved using A-record. Create a A-Record and point it to your VPS IP. A-record can be created from domain control panel.
a-record

After creating A-record, wait for few hours for DNS propagation.
Done!!

Our Recommended VPS Hosting

In this tutorial I will explain how to mass change permission of all files and folders/directory on a Linux server.
Login to server via SSH as root and execute following commands.

To change permission of all files and folders to 644 in /home/username/pulic_html

chmod 644 /home/username/public_html -R

To change permission of all files to 644 in /home/username/pulic_html

cd /home/username/pulic_html
find . -type f -exec chmod 644 {} \;

To change permission of all folder to 755 in /home/username/pulic_html

cd /home/username/pulic_html
find . -type d -exec chmod 755 {} \;

Our Recommended Dedicated Server

By default all MySQL database on a server is saved in /var/lib/mysql directory. If you don’t have enough space left in /var directory or if its filling up quickly, you can move your MySQL directory to /home partition.

Assuming you have enough space in /home partition, follow below steps to move MySQL to a new location in /home/var_mysql directory.

Login in server as root via SSH and run following command:

mysqldump --all-databases | gzip > /home/alldatabases.sql.gz
/etc/init.d/mysql stop
mkdir /home/var_mysql
mv /var/lib/mysql /home/var_mysql
chown -R mysql:mysql /home/var_mysql/mysql
ln -s /home/var_mysql/mysql /var/lib/mysql
/etc/init.d/mysql start

Done!!!
You should now have your MySQL at a new location /home/var_mysql

Explanation of above commands

mysqldump --all-databases | gzip > /home/alldatabases.sql.gz

This will create a full backup of all MySQL database. If anything goes wrong, you can restore all MySQL database using this backup file. Name of this file will be alldatabases.sql.gz and it will be saved in /home directory.

/etc/init.d/mysql stop

This will stop mySQL.

mkdir /home/var_mysql

This will create a new directory var_mysql in /home

mv /var/lib/mysql /home/var_mysql

This will move /var/lib/mysql to /home/var_mysql

chown -R mysql:mysql /home/var_mysql/mysql

This will give ownership of /home/var_mysql/mysql directory to user mysql.

ln -s /home/var_mysql/mysql /var/lib/mysql

This will symlinking the old /var/lib/mysql to the new location.

/etc/init.d/mysql start

This will start the MySQL.

What if anything goes wrong

We have create a full MySQL backup in our first step. If anything goes wrong, you will always have the full mysql backup to restore all database. Please refer to below tutorial to restore your databases using the full MySQL backup file.
http://www.lophost.com/tutorials/ssh/how-to-create-and-restore-mysql-backup-of-all-accounts/

Our Recommended Dedicated Server

Login to your server as root via SSH and run below command:

To start Apache

service httpd start

To stop Apache

service httpd stop

To restart Apache

service httpd restart

Our Recommended VPS Hosting

Login as root to your server via SSH and run following command:

httpd -v

This will show you the Apache version installed on your server.
apache-version

Our Recommended VPS Hosting

If you have just received a fresh dedicated server / vps with only operating system installed, Apache may not be installed on your server. By default, Apache is not install with OS.

Here is how you can install Apache on your server.
Login to your server as root via SSH and run following command:

yum install httpd

During installation you will asked to allow download of package. Press y to allow download of package.
It will take 1-2 minutes to complete installation.
install-apache

After installation you may need to start Apache. Run following command to start Apache

service httpd start

Now open your server IP in any browser. You should get default Apache page.
default-apache-page

Our Recommended VPS Hosting

In this tutorial I will show you how we can transfer / restore a cPanel website using full cPanel backup from SSH.
Sometimes, cPanel to cPanel transfer may not work as expected. So, in this case you can manually create full cPanel backup, transfer to new server and restore on new server.

Step 1:

Create a full cPanel backup from cPanel >> Files >> Backup
Name of backup file will be something like backup-username.tar.gz

Step 2:

Upload the full cpanel backup file on new server in /home directory.
You can do server to server transfer from SSH using wget or scp command.

Step 3:

When you have uploaded the full cPabel backup file in /home directory of new server, login as root via SSH and run following command:

/scripts/restorepkg username

In above command, change username to your actual cPanel username which you are transferring.
It will take sometime to restore the account depending on size of the backup file.

You can also restore account from:

WHm Home >> Backup >> Restore a Full Backup/cpmove File

Our Recommended VPS Hosting

Server root MySQL password can be different from server root password. Here is how you can get root MySQL password.

Login as root via SSH and execute following command

tail /root/.my.cnf

OR

cat /root/.my.cnf

This will show you the root MySQL password of your server.

Our Recommended Dedicated Server

If you have many websites / accounts on your server, and you want to make backup of all mySQL via a single command, here is how you can do. Creating regular full mySQL backup of all accounts is a very good practice. Creating full MySQL backup is also recommended before performing any mysql upgrade.

How to create full MySQL backup

Login as root via SSH and execute following command:

mysqldump --add-drop-table --all-databases | gzip > /home/alldatabases.sql.gz

This will create a SQL-based backup of everything in MySQL and save it into your /home directory. The name of your backup file will be alldatabases.sql.gz

You may change the backup file name and location where it will be saved.

How to restore full MySQL backup

To restore a full MySQL backup file, you will need root MySQL password. Run following command to get root mySQL password

tail /root/.my.cnf

The above command will show the root MySQL password. When you have password, run following command:

gunzip < /home/alldatabases.sql.gz | mysql -u root -p

If your saved full mysql backup is at different location, change the path in above command. If the name of your full mysql backup file is different, please change in above command.

You will be asked to enter password. So, enter the password that you have got above from tail /root/.my.cnf command.

Done!! It will take sometime to restore all database depending on size of database file.

Our Recommended Dedicated Server