Tampilkan postingan dengan label CENTOS. Tampilkan semua postingan
Tampilkan postingan dengan label CENTOS. Tampilkan semua postingan

Jumat, 17 Desember 2021

Kickstart-Server CentOS 7.9_x86_64 For Apache Hadoop®

A. Prepare Kickstart Server environment

 1. Install all the required packages through yum

     yum install syslinux xinetd tftp-server dhcp httpd deltarpm python-deltarpm createrepo yum-utils

2. Create folder/directory and copy pxelinux.0

     mkdir /var/lib/tftpboot/pxelinux.cfg
     mkdir /var/lib/tftpboot/centos7
 
     cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

3. Open the xinetd settings to enable tftp server
    vi /etc/xinetd.d/tftp
   # at line 14 change the parameter from yes to no.
        Disable=no

4. Restart the service to apply the settings made
    systemctl restart xinetd 

5. Set the service to start with each subsequent system reboots
    systemctl enable xinetd

6. Open the file and configure edit the DHCP Server
    vi /etc/dhcp/dhcpd.conf

#### vi /etc/dhcp/dhcpd.conf ###
Allow booting;
Allow bootp;
authoritative;
### Subnet definition hostname kickstart  server ###
ddns-update-style interim;
subnet 192.168.111.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.111.30 192.168.111.130;
option broadcast-address 192.168.111.255;
option routers 192.168.111.2;
filename "pxelinux.0";
next-server 192.168.111.80;
#use-host-decl-names on;
}
#### Client Node ###
host master01.kopi.com {
hardware ethernet 00:0C:29:33:9A:F2;
fixed-address 192.168.111.81;
option subnet-mask 255.255.255.0;
option routers 192.168.111.2;
option host-name "master01.kopi.com";
filename "pxelinux.0";
}
host master02.kopi.com {
hardware ethernet 00:0C:29:B0:74:AB;
fixed-address 192.168.111.82;
option subnet-mask 255.255.255.0;
option routers 192.168.111.2;
option host-name "master02.kopi.com";
filename "pxelinux.0";
}
host worker01.kopi.com {
hardware ethernet 00:0C:29:58:E8:B8;
fixed-address 192.168.111.83;
option subnet-mask 255.255.255.0;
option routers 192.168.111.2;
option host-name "worker01.kopi.com";
filename "pxelinux.0";
}
host worker02.kopi.com {
hardware ethernet 00:0C:29:CF:37:CE;
fixed-address 192.168.111.84;
option subnet-mask 255.255.255.0;
option routers 192.168.111.2;
option host-name "worker02.kopi.com";
filename "pxelinux.0";
}
host worker03.kopi.com {
hardware ethernet 00:0C:29:AE:A3:EF;
fixed-address 192.168.111.85;
option subnet-mask 255.255.255.0;
option routers 192.168.111.2;
option host-name "worker03.kopi.com";
filename "pxelinux.0";
}


7. Restart the service and make it permanent
    systemctl restart dhcpd
    systemctl enable dhcpd

8.
Create folder/directory
 

    mkdir -p /var/www/html/centos7.9
    mkdir -p /var/www/html/centos7.9/ks

9. Insert your CentOS 7. DVD + Mount it to /mnt
    mount /dev/sr0 /mnt

10. Check the contents to see if it is properly mounted
    ls -al /mnt/

11. copy all DVD the contents to the /var/www/html/centos7.9 directory & updates

    shopt -s dotglob
    cp -apvrf /mnt/* /var/www/html/centos7.9/     
 
     
sudo reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/

    createrepo /var/www/html/updates

    eject

12. Copy the vmlinuz and initrd.img files to the tftpboot directory
    cp /var/www/html/centos7.9/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7 

    cp /var/www/html/centos7.9/images/pxeboot/initrd.img /var/lib/tftpboot/centos7

13. Copy the menu file
    cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/

14. Prepare the boot menu.
    vi /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 100

menu title === PXE-CentOS7.9-Boot Menu===
label 1
menu label ^ 1) CentOS 7.9.2009
kernel centos7/vmlinuz
append initrd=
centos7/initrd.img ks=http://192.168.111.80/ks/ks.cfg

15. Prepare the httpd server

    vi /etc/httpd/conf/httpd.conf
        Listen 192.168.111.80:80

    vi /etc/hosts
       192.168.111.80     kickserver    kickserver.customer.com

    vi /etc/httpd/conf.d/welcome.conf
        <LocationMatch "^/+$">
        Options +Indexes

     systemctl restart httpd
    systemctl enable httpd

    iptables -F; iptables -L
    systemctl stop iptables; systemctl disable iptables 
    systemctl stop firewalld;systemctl disable firewalld


    vi /etc/selinux/config
     SELINUX=disable
 

reboot

after that you can login and run cli (pls, verify with a local repository "updates")

yum update

reboot

(pls, verify your booting with a new kernel version 3.10.0-1160.80.1.el7)

Selasa, 01 Oktober 2013

RESTORE with Clonezilla and error "Kernel Panic" special instruction for Centos 5.x



1. Boot any linux-dvd room with ”similiar" architecture (i386 or x86_64)

2. press F5 or type-in linux rescue

3. pres enter...enter

4. # chroot /mnt/sysimage

5. # cd /boot and then # ls -al

6. # mv initrd-2.6.18-238.el5PAE.img initrd-2.6.18-238.el5PAE.img.BACKUP

7. # mkinitrd /boot/initrd-2.6.18-238.el5PAE.img 2.6.18-238.el5PAE

8. # grub-install /dev/sda

9. disconnect linux-dvd

10. exit

11. exit

12. Success booting but X-windows error......select OK an then select No

13. login with Normal Terminal root/P@ssw0rd

14. Install vmware tools (VM > Guest > Install/Upgrade Vmware Tools)

15. see w/ #dmesg (location drive ex. /dev/sdc)

16. # mount /dev/sdc /mnt

17. # cd /mnt/VMware...tab

18. # cp VMware...tar.gz /tmp

19. #cd /tmp

20. # gunzip VMware....tab

21  # tar -xvf VMware..tar

22. # cd vmware-..tab

23. # ./vminstall-..tab

24. all instruction press ENTER...ENTER (for default)

25. ...choose resolution 11 (800x600)

26. reboot


27. wow...success w/x-windows GUI

28. shutdown and change MAC-Address on vmware edit setting. (match the physical server)

Minggu, 03 Februari 2013

LVM - How to Create a Partition in Linux

This is a short tutorial that explains how to create an LVM in Linux. Let's get started.

I have got 2 hard disks of 2GB size each -

# fdisk -l 2>/dev/null | grep '/dev/sd[a-b]'
Disk /dev/sda: 2147 MB, 2147483648 bytes
Disk /dev/sdb: 2147 MB, 2147483648 bytes

The following steps will show you how to create logical volumes on these hard disks.

Step 1: Prepare the disks


If you are using entire disks for creating logical volumes, then make sure they are raw disks. ie they should not contain any partitions.


If you are using individual partitions on a disk for LVM, then you should open fdisk (or another partitioning tool) and set each partition as type "Linux LVM" - 0x8e, so that they can be recognized by the LVM system.


Step 2: Initialize the disks to be used as a physical volume


To initialize the disks to be used as a physical volume, you use pvcreate.

# pvcreate /dev/sda
Writing physical volume data to disk "/dev/sda"
Physical volume "/dev/sda" successfully created

# pvcreate /dev/sdb
Writing physical volume data to disk "/dev/sdb"
Physical volume "/dev/sdb" successfully created

Now use lvmdiskscan to verify that the hard disks have been properly initialized.

# lvmdiskscan
/dev/sda  [ 2.00 GiB] LVM physical volume
...
/dev/sdb  [ 2.00 GiB] LVM physical volume
...
2 disks
2 LVM physical volume whole disks
0 LVM physical volumes


Step 3: Create the volume group


To create a volume group, you run the vgcreate as follows.

# vgcreate vg_sda /dev/sda
Volume group "vg_sda" successfully created

# vgcreate vg_sdb /dev/sdb
Volume group "vg_sdb" successfully created

This creates a volume group descriptor at the start of each disk.


Step 4: Create the logical volumes


Logical volumes can be classified into 3 types -


  1. Linear volumes
  2. Stripped volumes, and
  3. Mirrored volumes


Logical volumes are similar to partitions in hard disks - only better.

Use lvcreate command to create a logical volume.

Lets create a single linear logical volume within each of the volume groups that was created.

# lvcreate --extents 100%FREE --name lv_sda vg_sda
Logical volume "lv_sda" created

# lvcreate --extents 100%FREE --name lv_sdb vg_sdb
Logical volume "lv_sdb" created

In the above commands, --extents gives the number of logical extents to allocate for the new logical volume. Here we have specified the number as the percentage of the free space in the volume group.


lvcreate takes a lot of options. Do check its man page to know more.


Step 5: Verify your work


Lastly, you should scan all disks for logical volumes and volume groups. For this you use the tools - vgscan and lvscan respectively.

# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_sdb" using metadata type lvm2
Found volume group "vg_sda" using metadata type lvm2

and scan the logical volumes on all the disks ...

# lvscan
ACTIVE  '/dev/vg_sdb/lv_sdb'  [2.00 GiB] inherit
ACTIVE  '/dev/vg_sda/lv_sda'  [2.00 GiB] inherit

The logical volumes are included in the /dev directory in the format /dev/vg/lv where vg is volume group name, and lv is logical volume name. In our case it will be -

/dev/vg_sda/lv_sda and /dev/vg_sdb/lv_sdb.

Run lvdisplay to see the details of the logical volumes that were created.

# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg_sdb/lv_sdb
  VG Name                vg_sdb
  LV UUID                ytRveJ-ZCsD-gIXd-Uzfl-UOeO-8CYF-xdXb72
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                2.00 GiB
  Current LE             511
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
   
  --- Logical volume ---
  LV Name                /dev/vg_sda/lv_sda
  VG Name                vg_sda
  LV UUID                gTG0Sy-TiF9-3bmF-C7U5-FlqJ-TbZG-eYULtf
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                2.00 GiB
  Current LE             511
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

From here on, you can access the logical volumes the same way you access physical disks. All the commands such as for mounting disks, creating file systems, formatting and so on will work on the logical volumes as well.


What to do next


Before you start using the logical volumes to store your files, you have to do 2 things, namely -


  1. Format the logical volume, and
  2. Mount the logical volume in a suitable location.

First lets format the logical volumes

Formating the logical volume involves creating a file system on it. You use the mke2fs command to create a file system.

# mkfs.ext4 /dev/vg_sda/lv_sda

and for the second logical volume ...

# mkfs.ext4 /dev/vg_sdb/lv_sdb

Now lets mount the logical volumes in a suitable location.

Mounting the first logical volume at /mnt/volume-a

# mkdir /mnt/volume-a
# mount -t ext4 /dev/vg_sda/lv_sda /mnt/volume-a

and mounting the second logical volume at /mnt/volume-b

# mkdir /mnt/volume-b
# mount -t ext4 /dev/vg_sdb/lv_sdb /mnt/volume-b


If you want to automatically mount the logical volume(s) each time you boot into Linux, you will have to enter the appropriate line in the /etc/fstab file as well.


List of LVM Commands


To recap, following are the LVM commands we have used to create logical volumes in Linux.

pvcreate - Initializes physical volume for later use by logical volume manager (LVM).

lvmdiskscan - Scan for all devices visible to LVM.

vgcreate - Create a volume group.

lvcreate - Create a logical volume in an existing volume group.

vgscan - Scan all disks for volume groups and rebuild caches.

lvscan - Scan all disks for logical volumes.

lvdisplay - Display attributes (information) of all logical volumes.

There are many more LVM commands that accomplish other tasks. However, these set of LVM commands should get you started on creating an LVM in Linux.

Jumat, 30 Desember 2011

Using Centos DVD as Yum Repository

Centos coming with dvd/cd as installation media, in some case you want to use it as yum repository. In this tech tips posting, I used centos 6.1 DVD#1. 

1. Mount your dvd media under one of this directory as default :
 a. /media/CentOS/
 b. /media/cdrom/
 c. /media/cdrecorder/

2. edit the configuration : # vi /etc/yum.repos.d/CentOS-Media.repo
      make sure enabled = 1
3. Test # yum --disablerepo=\* --enablerepo=c5-media install groupinstall "X Window System" "GNOME Desktop Environment"