CentOS 7 Manual Installation

The installation program is designed to be used in new equipment and to allocate the whole disk to install CentOS 7 with SaltOS pre-installed. If your case is different and you want to install the image of CentOS 7 for SaltOS, there is another option that is the so-called manual installation.

To do this, all the necessary steps will be described below:

  • Create and Format Partitions
  • Mount the partitions and extract all the files from the image to disk
  • Mount the rest of directories
  • Install grub to allow operating system startup
  • Create certificate and give permissions to / var / www / html directory
  • Unmount directories and partitions

Create and Format Partitions

If our system is a system based on BIOS:

  // CREATING BIOS FILESYSTEM
  echo 'unit: sectors\\n2048,1024000,83\\n1026048,0,83' | sfdisk ${dev}
  mkfs.ext4 -L boot ${dev}1
  mkfs.ext4 -L root ${dev}2

And if our system uses the new UEFI system:

  // CREATING UEFI FILESYSTEM
  sgdisk -n 1:0:+200M -t 1:ef00 -c 1:'EFI System Partition' -n 2:0:0 -t 2:0700 -c 2:'' ${dev}
  mkfs.vfat -n EFI ${dev}1
  mkfs.ext4 -L root ${dev}2

Notes:

  • When using $ {dev}, it is referring to the disk where the operating system will be installed.
  • When using $ {boot}, it is referring to "boot" for BIOS systems or "boot / efi" for UEFI systems
  • When using $ {dev} 1, this refers to the partition used for boot or EFI
  • When $ {dev} 2 is used, this refers to the partition used to host the operating system files

Mount the partitions and extract all the files from the image to disk

The next step is to mount the directory structure to decompress the image

  // WRITING FILES
  mkdir /sysroot/root
  mount ${dev}2 /sysroot/root
  mkdir -p /sysroot/root/${boot}
  mount ${dev}1 /sysroot/root/${boot}
  unsquashfs -f -d /sysroot/root/ /sysroot/cd_root/root.img

Mount the rest of directories

The next step is to mount the rest of the directories in order to install grub.

  mount -o bind /dev /sysroot/root/dev
  mount -o bind /dev/pts /sysroot/root/dev/pts
  mount -o bind /dev/shm /sysroot/root/dev/shm
  mount -o bind /proc /sysroot/root/proc
  mount -o bind /sys /sysroot/root/sys

Install grub to allow operating system startup

In case our system uses UEFI, we must execute the following block of commands before installing grub.

  // SOME FIXES FOR UEFI FILESYSTEMS
  chroot /sysroot/root mv /etc/fstab.efi /etc/fstab
  chroot /sysroot/root grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

With the following command, you should install grub without problems.

  // INSTALL GRUB
  chroot /sysroot/root grub2-install ${dev}

On some UEFI systems such as VirtualBox, you need to leave the boot loader in the EFI / BOOT directory instead of EFI / centos. For this, the solution I have found is to execute the following block of commands.

  // SOME FIXES FOR UEFI FILESYSTEMS
  rsync -va /sysroot/cd_root/EFI/BOOT /sysroot/root/boot/efi/EFI/
  rm -f /sysroot/root/boot/efi/EFI/BOOT/grub.cfg
  cp /sysroot/root/boot/efi/EFI/centos/grub.cfg /sysroot/root/boot/efi/EFI/BOOT/

Create certificate and give permissions to / var / www / html directory

The next step is to create the apache certificate and give the apache permissions so that you can access the / var / www / html directory.

  // CREATE CERTIFICATE AND SETTING PERMISSIONS
  chroot /sysroot/root /etc/pki/tls/make-apache-ssl-cert.sh
  chroot /sysroot/root chown apache.apache /var/www/html

Unmount directories and partitions

And to finish, you have to unmount directories and partitions.

  // UMOUNT DIRECTORIES AND PARTITIONS
  umount /sysroot/root/sys
  umount /sysroot/root/proc
  umount /sysroot/root/dev/shm
  umount /sysroot/root/dev/pts
  umount /sysroot/root/dev
  umount /sysroot/root/${boot}
  umount /sysroot/root
  rmdir /sysroot/root

And if we want to be strict:

  // UMOUNT SOURCE SETUP
  umount /sysroot/cd_root
  rmdir /sysroot/cd_root


XML lines
60,895
PHP lines
18,637
JS lines
11,620
XSLT lines
2,498
CSV lines
1,919
CSS lines
577