Posts Under Category: VPS

If you want to see the list of users who are logged in server and their IP and what they are doing, here is how you can do.

Login to your server as root and run following command.

w

OR

who

Above command will list all logged in users, their IP, what they are doing.

Our Recommended VPS Hosting

If for some reason you do not want to update your server kernel but want to update other packages running on CentOS, here is how you can do.

Update can be done using yum command and to exclude kernel from update we need to add exclude command.
Login to your server as root via SSH and run following command:

yum -y --exclude=kernel\* update

OR

yum -y -x 'kernel*' update

Above command will update all packages but will leave kernel update on a CentOS server.

Our Recommended VPS Hosting

Recently one of my vps (CentOS) went down after flushing / clearing iptables rules using below command:

iptables -F

The above command will flush/clear all current firewall rules of your CentOS / Linux server.

Here is how I fixed it. I just restarted iptables rules using below command and my VPS was UP.

service iptables restart

You can also use below command to restart iptables rules.

/etc/init.d/iptables restart

Our Recommended VPS Hosting

If you want to copy a file / folder from one server to another, you can use wget or scp command. In this tutorial I will show how to use scp command to copy files / folder from one server to another.

Let us suppose

Server One IP is: 1.1.1.1
Server Two IP is: 2.2.2.2

How to copy a file

Suppose you want to copy a file from server one to server two.
Location of file on server one is: /home/filename.txt

Login to server two via SSH and run following command

scp root@1.1.1.1:/home/filename.txt /home/

This will copy filename.txt file from server one to server two and save in /home directory.

How to copy a folder / directory

Suppose you want to copy a complete folder from server one to server two.
Let’s say you want to copy /backup folder from server one to server two.

Login to server two via SSH and run following command

scp -r root@1.1.1.1:/backup /foldername

This will copy /backup directory from server one to server two and save in /foldername directory.

Our Recommended VPS Hosting

We can test server disk read / write speed from SSH. Below command will show the speed that the server can read and write a 1GB file.

Login to your server via SSH and run below command:

dd if=/dev/zero of=sb-io-test bs=1M count=1k conv=fdatasync

Higher scores is better.

SSD disk will give you very fast read / write speed compared to SATA disks. There are many providers offering SSD VPS like DigitalOcean, RamNode etc

Our Recommended VPS Hosting

Apache is the most popular HTTP server. Hers is how you can install Apache server on a CentOS / RedHat server.
Login to your server as root via SSH and run below command:

yum install httpd

Now start Apache

service httpd start

Done!!

Our Recommended VPS Hosting

CentOS is the most popular and widely used Linux operating system (OS) on VPS / Dedicated server. You must keep your CentOS updated for security reasons. Below are the basic SSH commands to update CentOS on a VPS / Dedicated server.

Check for update

It will check your machine to see if any update is available.

yum check-update

Run Update

You just need to run one command to apply all updates. Below command will update your machine.

yum update

You can also run yum update command with -y option.

yum –y update

The –y option will answer yes to all prompts such as confirmation that you want to install or update a particular package.

Our Recommended VPS Hosting

When you run cPanel Security Advisor, and if you get kernel out of date warning message, you need to update server kernel. The warning message may be something like below:

Current kernel version is out of date. current: 2.6.32-358.2.1.el6, expected: 2.6.32-358.23.2.el6 Update current system software in the “Update System Software” area, and then reboot the system in the “Graceful Server Reboot” area.

Updating from WHM may not solve this problem. This tutorial explains how to update kernel and solve this warning.

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

yum update

Accept kernel upgrade when asked. Reboot server after update.

Done!!

Our Recommended VPS Hosting

Please follow below steps to change root password via SSH of a dedicated server / VPS.

Step 1:

Login as root to your server via SSH.
login-root

Step 2:

Run below command

passwd

Step 3:

Enter your new password and press enter.
enter-new-password

Step 4:

Re-enter your new password to confirm the password.
re-type-password

If completed successfully, the shell will show you a successful message showing

passwd: all authentication tokens updated successfully.

root password changed

Done!!!

Our Recommended VPS Hosting

This tutorial explains how you can change or move MySQL /tmp directory to a new location on a server / VPS. Login as root to your server via SSH.

Step 1: Open /etc/my.cnf file for editing

nano /etc/my.cnf

Step 2: Add below line under the [mysqld] section and save the file.

tmpdir=/home/mysqltmp

To save file press: Ctrl + O
To exit from nano editor press: Ctrl + X

This will set new location of MySQL tmp to /home/mysqltmp. You may change to any different location.

Step 3: Create new directory

mkdir /home/mysqltmp
chmod 1777 /home/mysqltmp

Step 4: Restart MySQL

/etc/init.d/mysql restart

Step 5: Check new location

mysqladmin var | grep tmpdir

This should show following return.

| slave_load_tmpdir                       | /home/mysqltmp
| tmpdir                                  | /home/mysqltmp

Done!!

Our Recommended Dedicated Server