Category Archives: Linux Tutorial

Using parted on > 2TB drives to create new partitions for LVM

fdisk utility doesn’t support storage device that is larger than 2TB. Therefore you need to use GNU “parted” to create your partition.

As root run ‘parted /dev/sdX’ where X is the SAS/SATA/whatever controller’s drive as presented to the Linux kernel.

At the ‘(parted)’ prompt, enter:

mkpart primary ext3 0 -1
set 1 lvm on

Then ‘quit’ Parted to save your changes to the partition table on the relevant drive.

This creates a new partition assigned the whole drive capacity and gives it the LVM partition type, then saves those changes & exits parted.

How to install WildCard SSL in cPanel

Install the SSL Server Certificate Files

  1. Login to cPanel
  2. Click SSL/TLS Manager > Certificates (CRT) > Generate, view, upload or delete SSL certificates
  3. In the Upload a New Certificate section click the Browse button and locate your SSL Server Certificate file your_domain_com.txt.
  4. Click the Upload button.
  5. Click the Go Back link to return to SSL/TLS Manger.

Setup the Domain

  1. Click SSL/TLS Manager > Setup a SSL certificate to work with your site. If this option is not available to you your ISP may have disabled it and you will need to contact them to complete your SSL setup.
  2. From the Domain drop down menu select the domain that will use the SSL Certificate. The system will attempt to Fetch the SSL Certificate and corresponding private key.
  3. Open SSL_Intermediate.txt in Notepad or other simple text editor (not Word). Copy-and-paste all the contents of the GeoTrust_Intermediate.txt file into the Ca Bundle (CABUNDLE) box.
  4. Click on Install Certificate. You should receive a message that the certificate was successfully installed. If you receive an error you may need to contact your web hosting provider for additional support.

How to set your subdomain SSL

  1. Open public_html/.htaccess and add the following code

    RewriteCond %{SERVER_PORT} ^443$
    RewriteCond %{HTTP_HOST} ^abc\.domain\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/abc/
    RewriteRule ^(.*) /abc/$1

    /abc/ is your subdomain folder under public_html.

Recreate deleted ‘www’ symbolic link in cPanel

If you accidentally remove the ‘www’ shortcut to public_html folder in cPanel, please follow tutorial below to recreate it.

1) Go to cPanel user folder

cd /home/user/

2) Create back the symbolic link

ln -s public_html www

3) Change the ownership of the www sym link to the cPanel user’s ownership

chown -h user.user www

4) Done. Do a ls -al to double check the sym link.

ls -al

 

Migrating cPanel Accounts without homedir – The SSH Way

Step 1: Generate backups without the homedir and sync them one by one removing each backup after the transfer

Code:
for x in `\ls -A1 /var/cpanel/users/`; do /scripts/pkgacct --skiphomedir ${x} ; rsync -aP /home/cpmove-${x}.tar.gz -e ssh root@NEW-SERVER-IP:/home/ ; rm -f /home/cpmove-${x}.tar.gz ; done

Step 2: Restore all accounts on the new server

Code:
for x in `ls -A1 /home/cpmove*` ; do /scripts/restorepkg /home/${x} ; done

Step 3: Sync /home from old server to new server

Code:
 rsync -aP /home/ -e ssh root@NEW-SERVER-IP:/home/

 

How to Setup Sofware RAID in FreeBSD

I’m going to show you on how to setup the Software RAID for FreeBSD. The Software RAID process in FreeBSD is a lot simpler compared to the previous CentOS, Debian, or Ubuntu Software RAID.

Please make sure before this installation, you will need 2 identical hard disk with same space connected to the server. But the truth is, you don’t need to same hard disk with the same space amount, but as long as you partitioned the space equally then it would be good as well. But for beginner, it is better to get a hard disk that got the same space quantity, less percentage that you would get yourself confused.

Below are the steps on how to setup the Software RAID on FreeBSD:
1) Follow the initial operating system installation here:

How to install Unix FreeBSD

Continue reading

How to Setup Software RAID in Debian / Ubuntu

This time around, I will show you how to configure the software RAID using Debian. This also can be applied to Ubuntu system as their are based on Debian platform anyway. As I mentioned earlier, the Software RAID configuration can be quite troublesome and time consuming, but at least it is reliable and save a lot of cost when buying a hardware RAID instead.

For a normal installation of Debian or Ubuntu, you can refer to the links below for initial steps until the hard disk partitioning:

How to install Linux Debian

How to install Linux Ubuntu

Please make sure before this installation, you will need 2 identical hard disk with same space connected to the server. But the truth is, you don’t need to same hard disk with the same space amount, but as long as you partitioned the space equally then it would be good as well. But for beginner, it is better to get a hard disk that got the same space quantity, less percentage that you would get yourself confused.

Continue reading

How to Setup Software RAID for CentOS

Today I’m going to to show you guys on how to setup software RAID on CentOS. This technique is an alternative instead of getting the expensive RAID card for your server. Though I had to warn you, getting software RAID means its involving a few manual approach and the usage of command lines instead. But nevertheless, software RAID is reliable and also will save a lot of cost 😉

You can follow the whole normal installation process of CentOS that I have wrote earlier here:

How to install Linux CentOS

Please make sure before this installation, you will need 2 identical hard disk with same space connected to the server. But the truth is, you don’t need to same hard disk with the same space amount, but as long as you partitioned the space equally then it would be good as well. But for beginner, it is better to get a hard disk that got the same space quantity, less percentage that you would get yourself confused.

Continue reading