Linux Tutorials

Linux Server Managment

Linux server tip: force reboot/shutdown

Forcing reboot

A Linux Server is not Windows XP and if reboot fail you usually still connect by SSH and do something. This commands will show you how to remotely hard reboot machine. Hard reboot mean that shutdown scripts will not run and machine reboot immediately without syncing hard disk drives, shutdown applications etc, it’s more like hitting the reset button.

echo 1 > /proc/sys/kernel/sysrq

echo b > /proc/sysrq-trigger

This commands enable sysrq and after this calls fast reboot. If you want to force shutdown machine try this.

Force shutdown

echo 1 > /proc/sys/kernel/sysrq

echo o > /proc/sysrq-trigger

This came handy, when I had a server that had some IO error and it can no longer read from disk, only few cached binaries into memory kept it running (kernel, SSHD, bash), I could still access the machine via SSH but can no longer do anything, forcing the reboot as mentioned above was my only resort, and it worked like charm…

How to update Virtuozzo Node to the newest Kernel

Virtuozzo includes a utility to update itself and the included templates. To run this, you will need to ssh into the hardware node and execute the command:

vzup2date

In order to update the templates, add a -t to the command thusly:

vzup2date -t

It should be noted that if Virtuozzo is installed on the server, the standard Redhat up2date command should never be run.

If you are running Virtuozzo on a Windows server, then you can run the Virtuozzo update utility accessed through the Start menu.

Turbo charging MySQL by setting up the query cache

To make sure MySQL uses the query cache, there are a few variables you need to set in the configuration file . Usually its my.cnf or my.ini so check on your server with the shell command locate , in our case we are running on a CentOS 5.2  distro and to its my.cnf located in /etc so we opened it by using :   nano /etc/my.cnf

More >

Moving mySQL DBs between servers

Moving mySQL DBs from one server to another:

mysqldump -uUSER -pPASSWORD txp_database > txp_database.sql

puts the entire thing in one nicely portable text file.

on a new server it takes

mysql -uUSER -pPASSWORD txp_database < txp_database.sql

to import it.

Taking backup of mysql database using cron

Taking backup of mysql database using cron

Create a file called database_backup.sh and also an empty directory called mysql_backup. The database_backup.sh script should have the following info :

More >

How to Reset your Linux Root Password

Whenever you can’t remember Root password, you can read this tutorial and do step by step to Reset it … You can log in with single-user mode and create a new root password.
Reboot your computer. When GRUB is presenting the menu list, follow those instructions:

More >

CentOS – what happened to netconfig in 5.1

For whatever reason CentOS decided to drop netconfig and renamed it to

system-config-network

Common SSH Commands and Linux Shell Commands

We’ve put together some of the more frequently used SSH commands or linux shell commands, and organized them by name so you can easily find a command, their description and how to use it. This guide will continue to be updated and should not be considered a complete list of SSH commands or linux shell commands, but commands, we found, often used. If you would like to add to this guide, please email us and let us know.

More >

Moving large files from one linux server to your new linux server

Ok, so you like to move your 3 gig backup from your old server to your new server, but the the good old wget command is not doing the trick?

There is an easy way around with the scp command

More >

How to check and stop if DDoS attack is going on.

Distributed denial-of-service attacks
In a distributed attack, the attacking computers are often personal computers
with broadband connections to the Internet that have been compromised by viruses
or Trojan horse programs. These allow the perpetrator to remotely control machines
to direct the attack, and such an array of computers is called a botnet. With
enough such slave or zombie hosts, the services of even the largest and most well-connected
websites can be disrupted.

More >

How to mount and unmount a drive in linux

How To Mount A Drive In Linux

This simple step by step guide will show you how to mount a new hard drive or partitions onto your Linux server

More >

Linux sub directory size info

Need to know the exact size of your subdirectories in Linux?

Just go to the directory , like cd / and try this

du -cksh *

 

More >

Easyapache failing on CentOS server

Had an issue with one on our CentOS cPanel servers running 64 bit and cPanels easyapache upgrade. The folks at cPanel helped out with their usual professional response

More >

How to find MAC address in CentOS

Open SSH and type the following and press Enter:

/sbin/ifconfig | grep -i hwaddr

The sequence of hexadecimal digits that appears to the right of eth0 HWAddr (e.g. 08:00:27:ED:DA:8b) is
your network card’s MAC Address

cPanel – Manually back up and transfer an account via SSH

Sometime accounts are to big to transfer via the WHM transfer feature.

Below you can find some steps to do so manually

Log into your server and create a cPanel backup for the account

/scripts/pkgacct <username> <location> backup

<username> refers to the username you want to backup.

<location> is the path to where the backup will be placed (in your case you want to put /backup/cpbackup here).

So backup tells pkgacct that you want to create a backup file.

If you leave this off it creates a cpmove archive. Not sure what the difference is between a cpmove and a backup file, but this tells pkgacct you just want to create a <username>.tar.gz file in <location>.

And after the backup has been completed you can simple move it by pushing it via SCP

here is the tutorial  http://www3.wiredgorilla.com/content/view/322/1/

Problems with CenotOS5 – cPanel and BIND

If you have issues with cPanel running CentOS5 with BIND then the easiest way is to downgrade BIND to 9.2.4

The reason you’re having trouble is because CentOS 5 uses bind-9.3 and CentOS 4 uses bind-9.2 – The changes between these versions is significant enough that cPanel won’t work with it properly.

For instance by default there is no /etc/named.conf file created when bind-9.3 is installed and the default named.conf file for bind-9.3 is significantly different than in older versions.

Until the code is updated to work with bind-9.3, I have found the workaround to be to remove bind-9.3 packages and install bind-9.2 packages as follows:
 

More >

kernel yum upgrade

check what kernel you are running at the moment

uname -a


and t
o upgrade your kernel

yum update \kernel*

check if your kernel is added to grub

cat /boot/grub/grub.conf

and then reboot


shutdown -rf now