Changes Linux Cloud Workshop PDF
Changes Linux Cloud Workshop PDF
Changes Linux Cloud Workshop PDF
5 Installation
1. Boot your system with CentOS bootable media or ISO, youll get
following screen.
Media Check
3. CentOS Installer started.
CentOS Installation
4. Language to choose during installation process.
Language Selection
Select Keyboard
Set Hostname
9. Select location.
14. Format Warnings. Click Format which will erase existing data.
Device Formatting
Formatting Devices
1. / - Parent Directory
Contains the list of commands that can be used by Normal user and
Super user.
[vimals@linkshare /]$ ls
bin
net
boot dev
opt proc
COPYING directories
MOVE command
[vimals@linkshare ~]$ cat > Linux
This is a Linux classroom.
[vimals@linkshare ~]$ cat > Selenium
This is a selenium classroom
Moving linux to Selenium
[vimals@linkshare ~]$ mv Linux
Selenium
[vimals@linkshare ~]$ ls
Selenium
To rename a directory/file
[vimals@linkshare ~]$ ls
Mydir1
Mydir2
New_name_Mydir3
List[ls] commands:
Version of ls
[student@gss Desktop]$ ls --version
ls (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Richard M. Stallman and David MacKenzie.
second.txt
third.txt
third.txt
To find date
[vimals@linkshare ~]$ date
Tue Jan
To view calender
[vimals@linkshare ~]$ cal
January 2015
Su Mo Tu We Th Fr Sa
9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
To view calender of specific month of a year
[vimals@linkshare ~]$ cal 05 2015
May 2015
Su Mo Tu We Th Fr Sa
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30 31
To perform calculations
[vimals@linkshare ~]$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software
Foundation, Inc.
EDITORS
Vim is an editor to create or edit a text file.
There are three modes in vim. One is the command mode, second is the
insert mode followed by Execution mode.
In the command mode, user can move around the file, delete text,
etc.
In the insert mode, user can insert text.
In Execution mode, user can save and quit the file.
Changing mode from one to another
From command mode to insert mode PRESS a/A/i/I/o/O
From insert mode to command mode PRESS Esc (escape key)
From command mode to execution mode PRESS shift+:
Insert Mode:
i Insert a text at current cursor position
Execute Mode
:q
Start
2048
411648
End
411647
51611647
Blocks
204800
25600000
Id
83
83
System
Linux
Linux
/dev/sda3
Solaris
51611648
53708799
1048576
82
Linux swap /
Start
2048
411648
51611648
End
411647
51611647
53708799
Blocks
204800
25600000
1048576
Id
83
83
82
53708800
62914559
4602880
System
Linux
Linux
Linux swap /
Extended
Restart the machine for the kernel update ### MANDATORY ###
[root@gss Desktop]#reboot
Creating Logical Partitions
[root@gss Desktop]# fdisk -cu /dev/sda
Command (m for help): n
First sector (54122496-62914559, default 54122496): PRESS ENTER BUTTON
Using default value 54122496
Last sector, +sectors or +size{K,M,G} (54122496-62914559, default
62914559): +200M
Format the partition with File Systeem
[root@gss ~]# mkfs -t ext4 /dev/sda5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
defaults
0 0
tmpfs
/dev/shm
defaults
0 0
devpts
/dev/pts
gid=5,mode=620 0 0
sysfs
/sys
defaults
0 0
proc
/proc
defaults
0 0
/dev/sda6
/mnt/fdisk_permanentpartition
defaults
0 0
ext4
ext4
swap
tmpfs
devpts
sysfs
proc
ext4
Mounted on
/
/dev/shm
/boot
/media/CentOS_6.4_Final
Type
0
0
-1
-2
-1
Type
proc
0 0
/dev/sda6
defaults,pri=10
/proc
proc
swap
0 0
defaults
swap
Type
To encrypt a partition
[root@gss ~]# cryptsetup luksFormat /dev/sda5
WARNING!
========
This will overwrite data on /dev/sda5 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: redhat
Verify passphrase: redhat
[root@gss ~]# cryptsetup luksOpen /dev/sda5 gss
Enter passphrase for /dev/sda5: redhat
[root@gss ~]# mkdir /mnt/disk_lock
[root@gss ~]# mkfs -t ext4 /dev/mapper/gss
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
0
0
-1
10
sysfs
0 0
proc
0 0
/dev/mapper/gss
0 0
/sys
sysfs
defaults
/proc
proc
defaults
/mnt/disk_lock
ext4
defaults
the encryption
Desktop]# umount /mnt/disk_lock/
Desktop]# vim /etc/fstab ### Remove the entries #####
Desktop]# vim /etc/crypttab #### Remove the entries ####
Desktop]# cryptsetup luksClose gss
~]# reboot
**********************************************************************
******************************************************
************* LVM Configuration ***********
/dev/sda5
53710848
53915647
102400
83
/dev/sda6
53917696
54122495
102400
83
/dev/sda7
54124544
54226943
51200
83
[root@gss ~]# pvcreate /dev/sda{5,6,7}
WARNING: LUKS signature detected on /dev/sda5. Wipe it?
Wiping LUKS signature on /dev/sda5.
Physical volume "/dev/sda5" successfully created
Physical volume "/dev/sda6" successfully created
Physical volume "/dev/sda7" successfully created
[root@gss ~]# pvs
PV
VG
Fmt Attr PSize
PFree
/dev/sda5
lvm2 a-- 100.00m 100.00m
/dev/sda6
lvm2 a-- 100.00m 100.00m
/dev/sda7
lvm2 a-50.00m 50.00m
[root@gss ~]# pvdisplay
"/dev/sda5" is a new physical volume of "100.00 MiB"
Linux
Linux
Linux
[y/n] y
vol_grp1
vol_grp1
lvm2
1
1
read/write
resizable
0
0
0
Max PV
Cur PV
Act PV
VG Size
PE Size
Total PE
Alloc PE / Size
Free PE / Size
VG UUID
0
1
1
96.00 MiB
4.00 MiB
24
0 / 0
24 / 96.00 MiB
8FOigJ-0PrC-WIBy-Rwuw-9aUW-C230-H47u52
Attr
VSize VFree
wz--n- 96.00m 96.00m
wz--n- 96.00m 96.00m
wz--n- 48.00m 48.00m
-L +50M -n log_vol1 vol_grp1
Move Log
/dev/vol_grp1/log_vol1
log_vol1
vol_grp1
utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt
read/write
gss.com, 2014-05-31 16:26:22 +0530
available
0
52.00 MiB
13
1
inherit
auto
256
253:0
auto
256
253:0
Move Log
/dev/vol_grp2/log_vol2
log_vol2
vol_grp2
goVxt0-QsKS-QfoC-Hcif-LC7n-juLS-JnF7gn
read/write
gss.com, 2014-05-31 16:29:30 +0530
available
0
52.00 MiB
13
1
inherit
auto
256
253:1
/dev/vol_grp1/log_vol1
log_vol1
vol_grp1
utDjDs-PtMh-atfq-HKwQ-d5zG-1Uk5-lkgoQt
read/write
gss.com, 2014-05-31 16:26:22 +0530
LV Status
# open
LV Size
Current LE
Segments
Allocation
Read ahead sectors
- currently set to
Block device
available
0
52.00 MiB
13
1
inherit
auto
256
253:0
************************************************************
Creating mount point for volume groups
[root@gss ~]# mkdir /mnt/vol_grp1
[root@gss ~]# mkdir /mnt/vol_grp2
*****************************************************************
Permanently mounting the volume groups
[root@gss ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Feb 3 17:44:09 2014
#
# Accessible filesystems, by reference, are maintained under
'/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more
info
#
UUID=6858dbcd-0bd6-495f-85b3-c6a1a9e7f610 /
ext4
defaults
1 1
UUID=32f3ce14-7aee-493a-9ecb-c3e46dd9af38 /boot
ext4
defaults
1 2
UUID=9feebb3b-0df7-4d80-b422-9c9025bac217 swap
swap
defaults
0 0
tmpfs
/dev/shm
tmpfs
defaults
0 0
devpts
/dev/pts
devpts gid=5,mode=620
0 0
sysfs
/sys
sysfs
defaults
0 0
proc
/proc
proc
defaults
0 0
/dev/mapper/vol_grp1-log_vol1
/mnt/vol_grp1
ext4
defaults
0 0
/dev/mapper/vol_grp2-log_vol2
defaults
0 0
/mnt/vol_grp2
ext4
Move Log
Move Log
Size
25G
tmpfs
504M 228K
/dev/sda1
194M
27M
/dev/sr0
3.6G 3.6G
/dev/mapper/vol_grp1-log_vol1
70M 5.1M
/dev/mapper/vol_grp2-log_vol2
51M 4.9M
504M
1% /dev/shm
158M 15% /boot
0 100% /media/CentOS_6.4_Final
62M
8% /mnt/vol_grp1
43M
11% /mnt/vol_grp2
*****************************************************************
To reduce the logical volume
[root@gss ~]# umount /dev/vol_grp1/log_vol1
/mnt/vol_grp1
[root@gss ~]# df -h
Filesystem
Size Used Avail Use% Mounted on
/dev/sda2
25G 3.2G
20G 15% /
tmpfs
504M 228K 504M
1% /dev/shm
/dev/sda1
194M
27M 158M 15% /boot
/dev/sr0
3.6G 3.6G
0 100% /media/CentOS_6.4_Final
/dev/mapper/vol_grp2-log_vol2
51M 4.9M
43M 11% /mnt/vol_grp2
[root@gss ~]# fsck -f /dev/vol_grp1/log_vol1
fsck from util-linux-ng 2.17.2
e2fsck 1.41.12 (17-May-2010)
fsck.ext2: Is a directory while trying to open /dev/vol_grp1
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
Move Log
LV
VG
Attr
LSize Pool Origin Data%
Cpy%Sync Convert
log_vol1 vol_grp1 -wi-a---- 32.00m
log_vol2 vol_grp2 -wi-ao--- 52.00m
[root@gss ~]# pvs
PV
VG
Fmt Attr PSize PFree
/dev/sda5 vol_grp1 lvm2 a-- 96.00m 64.00m
/dev/sda6 vol_grp2 lvm2 a-- 96.00m 44.00m
/dev/sda7 vol_grp3 lvm2 a-- 48.00m 48.00m
Move Log
Vim /etc/fstab
################REMOVE THE FOLLOWING LINES FROM THE FILE AND SAVE
IT#################
/dev/mapper/vol_grp1-log_vol1
/mnt/vol_grp1
ext4
defaults
0 0
/dev/mapper/vol_grp2-log_vol2
/mnt/vol_grp2
ext4
defaults
0 0
********************************************************************
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vg1
1
1
0 wz--n- 96.00m 64.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgextend vg1 /dev/sda7
No physical volume label read from /dev/sda7
Physical volume "/dev/sda7" successfully created
Volume group "vg1" successfully extended
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize
VFree
vg1
2
1
0 wz--n- 144.00m 112.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgreduce vg1 /dev/sda7
Removed "/dev/sda7" from volume group "vg1"
[root@gss ~]# vgs
VG
#PV #LV #SN Attr
VSize VFree
vg1
1
1
0 wz--n- 96.00m 64.00m
vg2
1
1
0 wz--n- 96.00m 44.00m
[root@gss ~]# vgcreate vg3 /dev/sda7
Volume group "vg3" successfully created
[root@gss ~]# vgmerge vg1 vg3
Volume group "vg3" successfully merged into "vg1"
[root@gss ~]# vgsplit vg1 vg3 /dev/sda7
New volume group "vg3" successfully split from "vg1"
***************************************************************
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin
saslauth:x:497:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
student:x:500:500::/home/student:/bin/bash
centos:x:501:501::/home/centos:/bin/bash
---------------------------------------------------------------------------[root@gss ~]# cat /etc/shadow
root:$6$lJlCBi9cCMDewWga$QI2AfHrMrvfqFO9HiH/GYy5CdFKh.3gnCuJ87nasjPUpd
Rpx3ja6y9yu7Zd666cfw7rW4J5loVmX0flOFXPUh1:16104:0:99999:7:::
bin:*:15628:0:99999:7:::
daemon:*:15628:0:99999:7:::
adm:*:15628:0:99999:7:::
lp:*:15628:0:99999:7:::
sync:*:15628:0:99999:7:::
shutdown:*:15628:0:99999:7:::
halt:*:15628:0:99999:7:::
mail:*:15628:0:99999:7:::
uucp:*:15628:0:99999:7:::
operator:*:15628:0:99999:7:::
games:*:15628:0:99999:7:::
gopher:*:15628:0:99999:7:::
ftp:*:15628:0:99999:7:::
nobody:*:15628:0:99999:7:::
dbus:!!:16104::::::
usbmuxd:!!:16104::::::
vcsa:!!:16104::::::
rpc:!!:16104:0:99999:7:::
rtkit:!!:16104::::::
avahi-autoipd:!!:16104::::::
pulse:!!:16104::::::
haldaemon:!!:16104::::::
ntp:!!:16104::::::
apache:!!:16104::::::
saslauth:!!:16104::::::
postfix:!!:16104::::::
abrt:!!:16104::::::
rpcuser:!!:16104::::::
nfsnobody:!!:16104::::::
gdm:!!:16104::::::
sshd:!!:16104::::::
tcpdump:!!:16104::::::
student:$6$G1zJyUfcwV8cIsFV$hzpxmKL7rEkcXfiYbYY6JVhNT8K4O0NH9Ro1XM92YU
TgNuH8eCYMwcJ/FNekbkurAWoc9VgJ1npYTJBwDpN2P.:16107:0:99999:7:::
centos:$6$.h/1EAQB$j7Y7Cce82PjDXuGpPCZv5uukXWB.q1hntgsEZO7xXPrm3AQUQZS
UK2iBNHxi.MeRxd0f9of5gqsy1mxxXfRYH0:16222:0:99999:7:::
-----------------------------------------------------------------CREATING USER WITH USER ID
[root@gss ~]# useradd -u 505 narendra
[root@gss ~]# passwd narendra
Changing password for user narendra.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@gss ~]# grep narendra /etc/passwd
narendra:x:505:505::/home/narendra:/bin/bash
[root@gss ~]# usermod -u 510 narendra
[root@gss ~]# grep narendra /etc/passwd
narendra:x:510:505::/home/narendra:/bin/bash
--------------------------------------------------------------------[root@gss ~]# useradd -c "PM of INDIA" modi
[root@gss ~]# grep modi /etc/passwd
modi:x:511:511:PM of INDIA:/home/modi:/bin/bash
[root@gss home]# ls
centos Harsha NAMO
student