If needed stop firewall (not enabled or available)
systemctl status firewalld
service firewalld stop
systemctl disable firewalld
firewall-cmd --zone=public --add-port=80/tcp --permanent
sed 's/enforcing/disabled/g' -i /etc/sysconfig/selinux
sed 's/enforcing/disabled/g' -i /etc/selinux/config
sudo systemctl stop postfix
sudo systemctl disable postfix
useradd -c "Product specific user" -d /home/demo -g users -m -N demo
Add the new user demo
to /etc/sudoers
to give sudo privilege without password for all commands.
demo ALL=(ALL) NOPASSWD:ALL
timedatectl set-timezone America/New_York
> fdisk /dev/xvdb`
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier ------
Command (m for help): n
Command action
e extended
p primary partition (1-4)
Select (default p): p
Partition number (1-4): 1
First cylinder (1-6527, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527): [Enter]
Using default value 6527
Partition 1 of type Linux and of size 50 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
> mkfs.ext4 -L Product /dev/xvdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=Product
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13106944 blocks
655347 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2162163712
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
mkdir /opt/product
mount -t ext4 /dev/xvdb1 /opt/product/
chown demo:users /opt/product/
Add the new disk in mount file /etc/fstab
/dev/xvdb1 /opt/product ext4 defaults 0 2
mkdir /opt/swap
cd /opt/swap
dd if=/dev/zero of=/opt/swap/swapfile bs=1024 count=2MB
mkswap /opt/swap/swapfile
cp /etc/fstab /etc/fstab.bak
echo "/opt/swap/swapfile swap swap defaults 0 0" >>/etc/fstab`
- Add
preserve_hostname: true
at end of the/etc/cloud/cloud.cfg
file on your RHEL 7 or Centos 7 Linux instance to ensure that hostname is preserved after reboot. - Run the following command to set the new name.
hostnamectl set-hostname <new host name>.demo.ap
Add the new name to /etc/hosts
file to ensure that it is resolved correctly.
Update the install
yum update
Override DNS Configuration provided as part of DHCP. Add the following entry to /etc/dhcp/dhclient.conf
file
supersede domain-name-servers 8.8.8.8;