Documentation/Installation/Local

From ISP admin

Jump to: navigation, search

Contents

Local installation on software RAID1

This manual will guide you step by step through the set-up of the disc array and the following ISPadmin system installation and configuration. For the accomplishment of the local installation, at least a basic knowledge of the linux system is required. That is why we rather recommend this kind of installation to an experienced users, otherwise you should choose an easier way described in the manual for remote installation.

Setup step by step

1. Check of the settings of HDD in BIOS

During the booting switch yourself into BIOS (key Delete or F2 etc.) and check that you have the support of AHCI (Advanced Host Controller Interface) at the SATA hard disks activated. If your motherboard does not support AHCI, nevermind. But if it is possible to activate this function, do it. If you keep it off, the system will work with the fast SATA disks in a mode compatible with the older IDE disks and so the speed of reading and writing will be much lower than with the activation of AHCI.

2. Boot from cd

Set the booting from cd in BIOS. Insert the installation CD into the drive and boot from it. After booting the preparation of the installation enviroment will run through and a command line will show up. Now you may begin to work localy or connect yourself to the server through a SSH service with the following indications:

  • IP:      192.168.1.100
  • user:   root
  • pass:   ispadmin

3. Disk partitioning setup

The model installation will expect two SATA disks from which a software mirror (RAID 1) will be further created. The first one is connected as /dev/sda and the other as /dev/sdb.
The first harddisk is connected as /dev/sda and the second one as /dev/sdb.

  • If you have hard disks with the capacity up to 160GB, create just 2 new partitions. One for the creating of the software RAID, labeled md0(there will be the system) and one for SWAP. Firstly create a partition, where the system should be installed. The capacity of the first partition will be determined by the deduction of a maximal capacity of the disk and a space which is reserved for the storage space , about 2 to 4GB. After that from the rest of the available space a second primary partition will be created, where also the once mentioned SWAP will be situated.
  • If you have greater hard disks ( 250GB, 320GB, 500GB, 1000GB ), it is advisable to separate the system from the backups and the NETflow data to your own partitions before creating any new ones. Create then firstly a partition for the system with a capacity about 100GB(this will be array md0), the second partition for SWAP about 4GB and the last one for the backup data and for the NETflow (this will be the second array md1).

If there is already any sw raid activated, you have to cancel it, otherwise it would be impossible to manipulate with the disk partitions. If there is none, proceed.

mdadm  --manage  --stop /dev/md0


Run the fdisk program with a parameter /dev/sda, which is the first disk.

fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 38913. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)


Display the disk partitions pressing "p" and possibly remove the prevously created ones pressing "d", so that the disk would be totally empty.

Command (m for help): p 
Disk /dev/sda: 320.0 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System


If the disk is empty, begin to create a new primary partition pressing "n"

Command (m for help): n		        ###  <n> is a command for creating of a new partition
Command action
   e   extended
   p   primary partition (1-4)
p                                       ### create a new primary partition, press <p>
Partition number (1-4): 1               ### it is the first partition
First cylinder (1-38913, default 1):	
Using default value 1                   ### the first partition always begins with cylinder 1, this the fdisk will automatically propose, <Enter>
Last cylinder or +size or +sizeM or +sizeK (1-38913, default 38913): +316G 
### instead of the number of cylinders you may assign the size in Mega and also Giga units


In a similar way we will create from the rest of the available space a storage partition for SWAP

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (38001-38913, default 38001):
Using default value 38001			### fdisk will again propose us the first available cylinder, confirm by pressing <Enter>
Last cylinder or +size or +sizeM or +sizeK (38001-38913, default 38913):
Using default value 38913			### the last available cylinder at the end of a disk is again proposed automatically, so 
press again <Enter>. And so the second partition will be created till the end of the disk.

Display your list of partitions, so that you can make sure that they have the required size. If they do not, remove all of them and create them again.

Command (m for help): p			### an overviewdisplay of the created partitions 
Disk /dev/sda: 320.0 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 1 38000 305234968+ 83 Linux /dev/sda2 38001 38913 7333672+ 83 Linux


The first, and so a system partition, must be in type FD ( Raid Autodetect ) and the second one for SWAP will be in type 82 ( Linux swap / Solaris )

Command (m for help): t			 
Partition number (1-4): 1
Hex code (type L to list codes): fd
   Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 1 to fd (Linux swap / Solaris)


Then set the booting on the first partition, where the system is about to be installed.

Command (m for help): a
Partition number (1-4): 1


Check the setup once again, whether everything is all right (size and types of the partitions and also the boot index on the first partition)

Command (m for help): p 
Disk /dev/sda: 320.0 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 38000 205234968+ fd Linux raid autodetect /dev/sda2 38001 38913 7333672+ 82 Linux swap / Solaris


The last step in the fdisk programme is the saving of the accomplished changes on the disk by the record to the MBR table.

Command (m for help): w
The partition table has been altered! 
Calling ioctl() to re-read partition table. Syncing disks.


And so the setup of the first disk /dev/sda is completed. Now we will apply the same approach on disk /dev/sdb. So, run the command fdisk /dev/sdb and repeat the previous instructions on the other disk. If you had a great disk, you would create 3 portitions instead of 2.


WATCH OUT! The created portitions must be equal on both of the disks! This you may certify by the command:

fdisk -l

4. Creating of a disk array RAID1 (mirror) and formatting

Now you need to create RAID1 (mirror) from the first partitions of both disks /dev/sda1 a /dev/sdb1. For this use a command:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm: array /dev/md0 started.


You may display the status of the raid by a command:

more /proc/mdstat 
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] md0 : active raid1 sdb1[1] sda1[0] 306841344 blocks [2/2] [UU] [=>...................] resync = 5.2% (16186816/306841344) finish=41.2min speed=117548K/sec
unused devices: <none>

Here you may that the field:

  • is named /dev/md0,
  • is active ( md0 : active raid1 ),
  • is assembled out of two disks ( sdb1[1] sda1[0] ),
  • two out of two disks are in “U” status, which means UP ( [2/2] [UU] ),
  • the completion time of the synchronization is 41 min,
  • the speed of the mirroring is currently 117MB/sec.

After the completion the field will be fully redundant.


With the following command it is possible to list the detail of the disk array:

mdadm --detail /dev/md0  
Version : 00.90.03 Creation Time : Thu Nov 19 03:38:06 2009 Raid Level : raid1 Array Size : 240171648 (229.05 GiB 245.94 GB) Device Size : 240171648 (229.05 GiB 245.94 GB) Raid Devices : 2 Total Devices : 2 Preferred Minor : 0 Persistence : Superblock is persistent
Update Time : Thu Nov 19 04:46:52 2009 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0
UUID : e488aee4:72e58752:7f132997:5ffa538b Events : 0.4
Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 8 17 1 active sync /dev/sdb1


When using a great hard disk and creating 3 partitions instead of 2 you would run even the second RAID 1 field by the command:

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3


Eventually do the format of the partitions. Count with the possibility that formatting of some greater disks might last longer, even a few minutes.

mke2fs -j /dev/md0	### format of the first field md0 (fyzických oddílů /dev/sda1 a /dev/sdb1) on the file system ext3
mkswap /dev/sda2		### creation of the filesystem for the storage space on the second partition of the first disk
mkswap /dev/sdb2		### creation of the filesystem for the storage space on the second partition of the second disk

Formatting of the possible second RAID field

mkfs.xfs /dev/md1        ### formatting of the second field md1 (physical partition /dev/sda3 a /dev/sdb3) on a file system xfs

Why should you use a´the file system xfs for the second data section? Because it is more efficient at work with great disk partitions and with huge amount of small files - typically Netflow data. For the system partition (field md0) you should always use a native file system ext3!

5. Data archive unpacking

Check the availability of the source archive ispadmin.tgz. This should be located in the directory /install if the detection of the CD drive is correct.

ls -al /install			### the list of the directory with files on the installation CD


If the installation CD is not present in the directory /install, CD-ROM drive was probably not correctly detected. It is therefore necessary to attach the content of the installation CD manually. The indication of the device with the instalaltion cd is easy to detect by the activation of command "dmesg | more", which will list you page after page reports about the detection of individual components of the server during the start of the system.

mount /dev/XXX  /install         ### instead of XXX complete the block device representing the CD-ROM drive, most frequently represented by
                                     hda, hdb, hdc, hdd nebo třeba sr0.


Add the system partition into the directory /hd and then unpack the data from the archive /install/ispadmin.tgz.


mount /dev/md0 /hd			### connecting the created disk into the directory  /hd, into which you will inpack the installing files 
tar xvfz /install/ispadmin.tgz -C /hd	### with this command you will run unpacking of the installation archive into the created disk

It is necessary to copy it from the installation cd into the installation system with the assistance of a scp programme, or winscp from a different device.


The partitions adjustment in the configuration file /etc/fstab. Adjust according to the following example.

pico -w /hd/etc/fstab 
/dev/md0 / ext3 errors=remount-ro 0 1 proc /proc proc rw,nodev,nosuid,noexec 0 0 /dev/sda2 none swap sw 0 0 /dev/sdb2 none swap sw 0 0 /dev/md1 /data/backup xfs rw 0 2 ##- in case that we have the second field just for the backups /dev/md1 /data/support/flow xfs rw 0 2 ##- in case that we have the second field for NETflow

6. LILO boot loader setup

After finishing the installation, it is necessary to set up the boot sector and to create a boot loader; so switch to the new disk and edit the file /etc/lilo.conf

chroot /hd 
pico -w /etc/lilo.conf 
prompt disk=/dev/sda ### adjusted to /dev/md0 (system disk) # bios=0x80 timeout=20 default=ISP_admin_64 boot=/dev/sda ### adjusted to /dev/md0 (system disk) map=/boot/map #raid-extra-boot=mbr-only ### uncomment this line root=/dev/sda1 ### adjusted to /dev/md0 (system partition)
image=/boot/vmlinuz-2.6.27.7 label=ISP_admin_64 read-only


Then run the program lilo, to create a boot sector.

lilo 
Warning: LBA32 addressing assumed Warning: '/proc/partitions' does not exist, disk scan bypassed Added ISP_admin_64 * The Master boot record of /dev/sda has been updated. Warning: /dev/sdb is not on the first disk The Master boot record of /dev/sdb has been updated. 3 warnings were issued.


Eventually by the sommand exit you may leave the enviroment of chroot

exit

7. Setup of the Network connection

To start the system with the new IP address, and not with the default 192.168.1.100 after the restart of the server, you must enter the new address data into /hd/etc/rc.local : IP address, network mask and default port. It is enough to overwrite the default addresses at the commands ifconfig a route.

pico -w /hd/etc/rc.local

8. Finishing the Installation

Disconnect the disk with a new installation

umount /hd

Eject the CD from the drive so that the newly installed system is implemented and not the installation CD. If the CD-ROM is on the SATA interface, everything is alright; but if it is IDE, it is necessary to enter which block device it is. As a last step, eject the CD manually.

eject or eject /dev/hdc or eject /dev/sr0


Finally reboot the system, so that the newly installed system is uploaded.

reboot -f


After the ensuing reboot, the newly installed system will be uploading. If this does not happen, check the booting sequence in BIOS setting and adjust the first item onto the system disk.

If everything has been carried out correctly, the system will start and it is possible to log in. The default access is set in this way:

  • Remote login SSH:
user: root
pass: ispadmin
  • Access to ISP admin:
user: admin
pass: ispadmin

7. Configuration of the Installation

After finishing the installation it is necessary to configure the system. Which usually means the change the set of domain names, configuration of a web server, enter the administrator password and revive the license. All necessary steps are again listed and available at: