If you believed in your desire. Desire will show the path to get the same.

Powered by Blogger.

Thursday 23 March 2017

System Administration

No comments :

#### System Administration Topics ##

Text Editors


Console Based Text Editors:
1.    Emacs
2.    Nano
3.    Vim/vi

Graphical (GUI) Editors:
1.    Gedit
2.    Gvim
3.    Sublime (have to install separately)

Now we are going to discuss about vi/vim editor.
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the VI editor distributed with most UNIX systems. It is a tool, the use of which you must be learned. Program is written by Bram Moolenaar et al.

Usage of vi/vim, it has three modes
1.    Command mode
2.    Insert Mode
3.    Ex-mode

Command mode: this mode is the default mode following things we can do
Yank/copy (yy)         -           copying the single line
(nyy)   n number of lines at a time you can copy.
p                                  -           Paste a content bellow the cursor
P                                 -           Paste content above the cursor
dd                                -           Delete a single line
ndd  n number of line delete yet a time
x                                  -           Deleting a single character
dw                               -           Deleting a single word
.                      -           redo
u                      -           Undo
J                      -           Joining the line
r                      -           Replace the character

Arrow Keys
h                      -           Left
j                       -           Down
k                      -           Up
l                       -           Right
Ctrl+d            -           Scroll Down
Ctrl+u            -           Scroll UP

Insert Mode: This mode is used to insert the text into the file
i           -           Inserting the content before the cursor position
I          -           it will insert the character starting of the line
a          -           it will insert the character of the cursor append
A         -           It will append the character from end of the line
O         -           It will insert a new line above the cursor
o          -           It will insert a new line below the cursor
s          -           Substitute the stream

EX-Mode:   Esc is used to change the mode. Press Escape key to enter EX-Mode
:w        -           save the modifications
:q         -           quit
:wq      -           save & quit
:w!       -           save forcefully
:q!        -           Quit forcefully
:set nu            -           setting the line numbers
:set nonu       -           Remove line numbers
:<number>    -           it will goes to particular line
:%s/find string name/replace string/g     - to replace the string group of lines
:r         -           reading the another file from here
:!<command>           -           command will execute from here
:r !date           -           output will save in current file
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkEzqLa5vBQSnIf7DyRlku5G_ViA1j7k4Sujyzbwo_TTFOdp9ZURQyVcLbRHsJLz_j8JyvGJIuoOQaoFuEbqy75ftdo13B90K3Nj3cRZ6P1KsybIz3xSJgtaYlBxuztN2MSrX4KdOLF3I/s640/editors.png

Redhat Linux Installation

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs_XL0dW-VLEfkpxOjiCWQusUV7xvbUII-Qz4od3hbtDCpWh6yHHsidXfZXk2UeCRTmcfeQ4P-vQntX1-I8_ysZniM5LbX-LtWY1HjjvGmWT0JetnFhoeY_Wp0M5rw-PPzHlv7uhE0Kzk/s1600/0.jpg

After booting from RHEL bootable CD/DVD, We will get above screen
           Ø  If you want to install OS using GUI then hit ENTER key
           Ø  If you want to install OS using TEXT mode (CLI) then type linux test hit ENTER key
Currently we are installing Operating system using GUI mode.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhydjWW9TZkA4kSDf6tjfnUzfFEkx52_q7NzS0g3tyY3IEE_YEvRnfiLDixIpLyz5dA1lslqPtvUHJA6n2HxljKqMzcLqdQWbPt_TI7pjMZtGAj7zaR57m96NCvwaZ37grkxpSdzSbX4bs/s1600/1.jpg

If you want to verify you installation media (OS CD/DVD) press OK (It will take long time to verify). Press SKIP to jump next screen.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguLttbvxpyk_SIkloTZeNsBeuaX9ThvhZOPdxwllnIW90jTAZ3j6fsx8kbtygMcHb7xW2rEHkRcIzgU0ume9M5MAiApWBAluKj4oH_ceyXoCgdlAhQpwwZXxP-o7Gs0pTqoaMV5vylgww/s1600/2.jpg

Click NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAiWmfwA6K1i8paY9SWg1MBb6KUe1AISegW50xOYbo37NPI4-MRb6wWDt5fJgoZjX4PH4ft8UaKhCO0I8Adf7-IkavxuQvolleEzbZ69pEm0ukWhAkK8sJmgnKBlVeBeUBEI4yt76bP-I/s1600/3.jpg

Select the Language then click NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl-_kxOhrCXy_jJwzh5iu-NYNWT2c0Kp_nIf0cjHBZKDmtL_93Hj5uLr4XMYW0AgvdIJwagy-9VpfXqI7K2zK2Zcm36A6VvrbYE0GjdfanS5rn7tD1rHEynXoiTRxVNGnLoTfEZNVjeto/s1600/4.jpg

Select Keyboard Language then click NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5OULlZzFpTBQ9y_ZYc6uU8t8RZiTc1CgUpHy1r8PVi415BGwf0vqt_Hfj707AP4okwNfSUsHWW1Dgz3gqVWzcQLgB1Qft167j7BUDAHSBRZM9mrCcXm0yhgs3VQ3ZlPlYuGnWIk_Ngkk/s1600/5.jpg

Click OK

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizHZzTqI_zPsnyCMowP0cUQzqFHLIUSQJ8YQ0-LXSmxqwjEwZk1w_nKy5IltisW-MxY_MdOQGCP_WHpBHZ3EO2aRyLhse-V4HmSINVzyhISHxAirEHO7QF8uT6ES2D5P2TT0luBwuaMFw/s1600/6.jpg

It will give you a WARNNING since you don’t have a key click on SKIP

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpe-_uEOf8XntX-DjnCfT2bQWXabpINcHEn2bwofLGuU53-gE-qrrT6C3Yjc45yHIVOB1Ile1GlvpABPbAaRYrWmJc8ppUN-6GtHRzBpWmkcoP6WnVnP6bxqCeznJhp1GYnI0vHgHHEYQ/s1600/7.jpg
 Click on YES to continue
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkYQEUHrQGBr7uyMBDFgX9fL1AShmkQJHx_v0aKn3WNZVmX3JZ4OkddnU86k14nXpkOe4pgvzuKuR20FFptdpQR0hStfcErrt5d-HMKSz1_p-jZssIqQ-amI5zrv6Ns8t2fC9AKTTzEls/s1600/8.jpg

Options:
Remove all partitions on selected drives and create default layout this options will delete all the drive partitions and install OS
Remove all Linux Partitions this option will only remove Linux partitions and creates default layout, install OS
Use free space this option will install on free space of the drive creates default layout
Create Custom layout this option will not create any layout you have to create as per your requirement
This option will give more customization you to create your own layout (Selected Customize Layout)

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS4A5xdQx-Hbt_FMwdp0eSncdZUjudg9Wr8Slh4D_zMMt4-PnG1HyHgfZ4rSnZ5oqCH9GlK7deV4enC09cyLHh13eru5n1ayGNO_zF9N5urS_aNSEBPA5kg57GpbnG4-O378Gi7-73xWU/s1600/9.jpg

Now you can able to see HDD space to create partitions follow click on NEW
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5f9EVNemeheJs_S3-_QUJMz0L_WslSqF34RtQuUF-jwm4eZ7MNYY2L4ZeBiqIVbmQADZbh_dngn955SEBtUjjQzCAf1Ep9-YExsMyYoBLda4E6CRLn87C1ALA-F9QTw5ZN2Y0g8J_E1I/s1600/10.jpg

After clicking on NEW you will see above popup
First create /boot because it needs normal partition to store MBR (master boot record). 100MB is enough for /boot partition.
Mount point /boot
File system Type: ext3 OR ext4

Select fixed size Click OK

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3UTbnazX5bZriFGhoq9prjLOtX8oo4NIceRKa3UCsvpNlCFkq35f-VVzcE3HCfV_n5wETldNIToJnGVNuxkPsONRzwng0f3ajBKV_GWFJJyVWP2E3WoQykxriUjngLaqw2PTCXrJnWPM/s1600/11.jpg

See above screen /boot partition is created.
Note:  Always remember to create LVM partitions OR RAID partitions is recommended, because later on if you want extend the ROOT file system is possible and easy.
To create LVM partition click on NEW you can able to see popup as below

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8IbMwJSMzRauBLdobi8QxNXDamVtSn-R9OD94URbkXMK7V8Qo9ccslg4vtggb0Cwmhx41xGDBUNnNQqwlu4h0hGhiAa1zvyp0aG0j9bD1U796gn6Lk-YkeYLCKi41O2nUIHf3vpVPRQ0/s1600/12.jpg

For creating a LVM partition we have to create Physical Volume select file system type as physical volume (LVM)
Select Fill to maximum allowable size then click on OK
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTDZz27QcBNiYkP9vOsBwZaSk4R2-axuBhEtPFl9LD3YmNs-x5nK74duk9eL_zBYQ-7R23k2PZvRSoCp1qPUoB1Pjnn8JZkgKDF6Sq18M7iu1X4YvofD4ywbZOm7WZeUwrJ1-l0JsJDTA/s1600/13.jpg

See above screen LVM PV is created now select PV and click on LVM popup will open as below screen
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP6gTjuKBgD5lQDQMMauOEtbfa9q4rfOnHi48Cy2ppktTngfZown4bsdJaWx13T3np6KZ94V6klH-cumtgOEZYd6Uwy2SCLX7zTBVSNpvsgWh8gruFgYDRSXvZnuJIWH6T9KQjfwzUI1Y/s1600/14.jpg

Change the Volume group name as required. Example: VG01

Click on ADD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGrMbQTKw7wkS-i_r2A4PZn1xeB7iX4lAsTGjB6BDE8vwawQQHtPxaKaLpj-IncWO47cDx9yMv9t0ll3_kRXWd1DQYoGu4QQ8GK1ZNrclaXjAzkrTi2krjA8vErjuvHg6fZFuOihHy2x8/s1600/15.jpg

As above screen select Mount point as “/” slash, provide Logical volume name “ROOT” for easy identification, provide the size as per your requirement (Minimum 10GB). Click on OK
Again click on ADD
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Jlmv1-vsS9ikwj59DsTRA1kOgjLiYsr7vIKA2CCrZPzfs5FXPp5smSpPnVhnWwhtJD2A72lIt76cieCagkoLUW1NtpyH6dF7J91qUGUluSm8M6qOkKqMOE_SRf-LHfkBnfzMZU_hMss/s1600/16.jpg

Select File system type as SWAP, provide logical volume name as “SWAP” for easy identification. Provide the swap size is always (RAM SIZE * 2) in my case 2GB RAM. Click on OK

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPJW5_6HB7M70pSb2RYSu8tialsznuLnWvlVws-N5Dr0tG13HImWTC3zi7G67-viYvLzhOB58SVKNPdsz4JkQxGRo6cTzHTAUmWn_TIHhSdNMfLpX7XzZLb1bsrfjOD0j0EBfPUVq2Cs4/s1600/17.jpg

As you created above all the partitions are created. Click NEXT
Minimum Recommended Partitions
Slash “/”
/boot
SWAP

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdAH6iX5JCLN-MLW5epIfdCLmgkfJFvJOPcqhaXi5wWoaJV7DuxgDw28SAY-DBHSy4qPEDkO14YAbGdDWDho7vhHE0PhWbzALvgKrs0VIh6Lb6LzUV2Htgz-CTy5Qna8d6uwUXwjA3SvI/s1600/18.jpg

Select label and click NEXT (if you want to change label you can change it using edit option)

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMzS9EeRiaTl6i3iXQ1ExZNgh7ZSpzgviwO3Z-Ir_c9NKhw_atD1W21fskBltlovern61rNeGVFsuT3SH4-9TsBFzz-9vYtkYVv0oHHJIkWm-TnXWtBjW6TUBCrJ255p7IHfyaHu9-Qi0/s1600/19.jpg

Here provide your system name (Example: ARK-IT-Solutions.localdomain)
Click on EDIT
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_JCgjjS7dKgNAfbemMnlfhlENyMCWf6MppV9qWYA0elwhCq3rIIs-OO1JvEgicLnH7D6hD_ob1kEqsVcozjJf1UNqLsMiqrjzJbLY50rYiqNQtSkpaLE00oWLWvvyQmb7xP9JmdGBmO0/s1600/20.jpg

If you are using DHCP in your network select Use dynamic IP configuration
If not using DHCP enable IP4 and provide IP address and Netmask Click on OK

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUTiJEZj6GpFDsaKUo0WDS3RKXyHZFNeF66wx30KhPRpJC2h2A40dC-a3VFxGGDjomdfqug0YiLa4hx7CWpTAGQGUTsBnITGJOEmqugkqG1Q4bGKdIDmMpCLBRVnjOjSsJSmVz6uzu4mM/s1600/21.jpg

Provide the gateway IP and DNS IP and Click on NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGUy1DMRWsYDQHhDUPl6bujQuRWfvVz1mvpWGH3eUG5CzERAzUtyhKGUBHdnh7ZUF3I4xP3UfS4GWGod2qb2q6vcOFtyH8LgsStzUd_q4a1IhmEOGbAPmdKeQac8veGNYhsMGiAEbTQLw/s1600/22.jpg

Select the time zone and click on NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXI0fnV1ZHkmEx3R4RMAJSFJeX12XdZWf8MZOdIDZuw-LyBPPYH2qUWEo3hsSo2nBvgCQDrglTUviRsjQXsGppmlBFTiPN1dKA2LHZxcJ5wbldo_58EfA3kAMu5Ph2tAYx9lQIHaBbSX4/s1600/23.jpg

Provide your password and confirmation password then click on NEXT

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsEHu6pgb3mAOMTZ1MKu2mJFm_5OGzzL5TcGAwXLI4kMvlDsoOpCvqkykTSpbVnA2hSaGlBB6fM3ZrJuhZVCU7tXQiUbHFJAx4-oILC4doCqF5pCxcmsHyPKq7jEiDgNB6H8tGTs6q_C8/s1600/24.jpg

Select to install the required software’s while installing the operating system, select software development and web server and select Customize now.
Then click on NEXT
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNt36y2JLCGL7GUd3ldEngVnNDASTMTJWx5Ru23B_f2VOB73fTQzxdzOYXOElyGc-S-HGcGNJynYJVByDz9GzZ3jlZ7QQnA-Spdc_nryWr5q_8HTe2AMRFZ7aHZMS3gAe7F1kAzO6Z22w/s1600/25.jpg

Select the required packages from all the fields click on optional packages and check all (as showed in below screen)

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP-7xo75rn7NdMPL3gNurazRRs1CgX03Kh_SIHXAgvapZSRpHMyD8HrkYcFVke_F2IyNgrlErKBr-q3tDqL7DevLxoRpGP-Q8oKdyFcw6NoIGU8lqv-HxWDVADz5Puz8uqjkwzccO17A8/s1600/26.jpg

Selected all the optional packages as well click on CLOSE
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvGGKUji2YC0dLzFzwxAjN7ZmMnqVoi_qWfKSQ5dSQy3rxkVl8-ZqIS2CWNhX0aHr_h0uCPWczcLDDxk7TjJ_OGG1kgd9j3Qse65fJixuIfzDw2C8VZn9JhUVWncQxFxPoVJxWDkc829k/s1600/27.jpg

then click on NEXT
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYuHNCrLd2m_Wks1dzIOrRktdzuX0sbKqssALGkIA4H-qgG5Ri4t45-ZKqt4QoiXd_vEkvm-_lFZaqwtN44NWEmmn0pq-l8vB9BYQNN78-miWkwODw0s7UiqTIooecnOcXKtEutTgxPHw/s1600/28.jpg

After next dependencies will be resolved and ready for installation
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmTmblDKN_cXBgYoNGr5CdE6Zeoq1H-MLLbRDy2mUNWOdnNQGmzoFO6IfnYbJuBNR_yEkyZ7bNfWZ4-ZLA_mvxLhifuMz9R4yyk8xaBrUGWNdHmGMxyh3f6dl1azGymZaGF_DQsknlMMI/s1600/29.jpg
 Click NEXT to install Operating system
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX5EKh03bp_tui4eSQcIWxOgTRzjIWo-v6Begi3_hnp3DzGsKpESUJFsqz24i9FwMPgZGN_2LLwcRGykRSiqT8IbBGShViMUk7e6bH0fk4hqN46XPCOF9MnzCRfmgxXO9nti1HlpkSKPM/s1600/30.jpg
 Installation is in process (it will take few minutes depends on selected packages)

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGr-rp_ogSjDd5bCTeLiFvSbC0YlonhaRGUIbPxfCSHAjy4bi4M79mYZ5bYXN7P_GhuL9t1mGSfxh1RZEMlXpFjDCY3nycpbdA90PelB3Zk6WHW_zDDDWjod8ivhRIZ6ArB6xYZPq6yY4/s1600/31.jpg

After completion creating partitions and installing packages it will ask you to reboot the server. Click on Reboot
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhksGW1iUSQS_rGjXImqjVtcFEDKZ4IGqHWN-krZosldGA0tcSQgdmocBYqT7Z8H2WuSWXSBWRxCSaaudDGdxabrGUYDFAJPHim054O6Yg0QFbs38VGp6hn_8wUAbXe0XWlo3Rrp84d0QQ/s1600/32.jpg

After reboot it will ask you to complete next options click on FORWARD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4K1a0YBKgLNi0c7X9K3mC3VoR3WmTtBQtcx-O-KD-y-7M7V0jMz7uiRoeYzY5rlCXdfhrQx7BXivsoNp4zzAivmlenGkkpOfq8zvARls4c9JxraqHXOUVZijPT2OpbQnieLo2bj4urRU/s1600/33.jpg

Select Yes I agree to the license agreement and click FORWARD
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfLaD4vv_KbxtCwlSoGARHZBF6AhZmilgmRQfhqwolC5yvDf3dJmFSqfW0sKKuQ1hGmjdzdt9BsSc_perc4g8T8AUPN0V-iZKognjmdmjaFzuMe-EEJ_vKJAOgcnTZP2DePrdZtNUTet4/s1600/34.jpg

Firewall enabled and disabled
If you enable the firewall you have to allow the services and ports as you required
If you want to enable security click on Enable or else disable and click FORWARD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDIRiUX1k3Ynp5u0uftr8D2V5HHEPMPagSfvs9FdM9swr6VmqDtOv69_uDKWDBn16YjJiPIDeWjoJC4JAnQpTuhd7UVfgS702tsC3fJWh2NiDNW2BBkfviFF393iO79Y706gey6j6praE/s1600/35.jpg

Disable the SELinux if you don’t know the usage. Click on FORWARD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKfoAq1ITPjc6cyPEpKTLgiQ4K4kKp9WmEJQCKo4P981uewCez2B8klphL27L_hShVN4FfOQHX6PmM5cRC8uvDbElPIv8Cl0-8PZ-hGLZBvf5XycUftLRktgssRYBur7D8sb1UEfD5KYY/s1600/36.jpg
 Click YES
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrZqWNcoAPSIfUVWyHLsgPBrb5d-1QPDorwF2__8m9XKp508skZ-uXtPCROrEDLSOOyegkrcCxjVdgNK1g9KQ1BI80NL-3HvAbk5nPRm7jigiXm3Qs3ABMOMZlAGoX3SBis9VSiYBJXyU/s1600/37.jpg
 click Forward
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6xduKoqTlwIeOr0rw2tmt0NcYBejYcjF7iQ7NJ8hHXtk3-oxQMUC1ouMjLm_Rs7Xx_zz3nZDl6qBj9URvxcjGrHD9-DDZEAP8wFvoeCZ3u5ANrrTBo6ssNNwBZKSwOyFAq0ljjPriDkk/s1600/38.jpg
 Select Date & Time Click forward
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPNBnNI6f191-T2jo54J3gPl7MnDLrXi7NKGUKp88l1H-ICYpK3JdmPcNSaCuuwfOVJSI-3ynfx40zMhyphenhyphenG82sIuU5sGRt13jQeolhzzLlGEwH8dt0dfRFKzhkqgypBJKtqqnWjj2iYreM/s1600/39.jpg
 Select Yes Click Forward
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2KzzKidJ7YDgZ8AckgBUA62qUjuSUQLB3jgpLZhsajOpEdwfx5vN5WfAD8Mmr28evW2xzvqRBnEqicb9f33hWmx5Zo4xF9d3e-gnkhZSLTtJKEhZM6UcEQCJantJIg4tKdGY2vo8u9Rs/s1600/40.jpg
 Click on No Thanks
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUw9xWJqmUyeOg5R9rsYxTVEtjcQumTCyGfHD_Xod5Hg0oUVL7uMvR2yo5-JlUp-3xcEJKOR3bpPebZYaVMtNGtHxutBoArxkmci8_PxEiu-pFB3iqGkL-Y7Rq9NWa7KwqRdUYi1Y0xV8/s1600/41.jpg
 Click FORWARD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtBSwrLU4JB5XS_tVSDavc-K_QUN8Ady4fm0t-IVq2Vmscd9l7AKhKN0pkiPh41-lecG4CRZEqs82A2CVH0PnP0jRvgJP7d_BMmXwayposL8APsq3oLgjEgerhLDALbB2ffY21oDdbAG8/s1600/42.jpg

Provide additional username to create and provide password click on FORWARD 
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwDSqdceNw4jywA_t1iwoBSI11T3hVT70guDL_Xfg6glG6qPR3o4hZwloek-uBjEnfl06SaIjc97dgzNGg7Crcfzd8XqXUQWsfBqN1HT_p8cUl8nzRqKS8FQRxmynaOl4Y6OTrSNjQQQY/s1600/43.jpg

Test your sound then click on FORWARD

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0wFmxrbWGSiUT9aVw2m8rwqN5mDHmyRLv-OOcuJJnklRqqS1ss3TaIAN75oNgoiApW8VsCFFclLC-gRBTFAlgyWrLAPADzK7ZrFFgBEOxg4-rFNRyO-FXg1s75bZRxKUH6DY6yQTxAJM/s1600/44.jpg

Click on Finish

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg1Nfthke8wzFmSwmRtE9WKgtguHL_2mxe0FNtpjBR1S7YURJ4E5bG57-AP0QLR_G22ll7TWlPNNdzyRXj4_ewuIoTCuPXTGuZQZkN6tccr-uPRjh_VmoXDYDc3ilF1FgKnOdZtxgb3X4/s1600/45.jpg

It will ask you to reboot click OK
Your server installation is successfully completed now you can use it.


Profile Management


A user profile is a visual display of personal data associated with a specific user, or a customized desktop environment. A profile refers therefore to the explicit digital representation of a person's identity. A user profile can also be considered as the computer representation of a user model.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzvl2YtuoCAiTlq_-U6wyjIPk2Xn_zKxV2uhFACn7dSNcglN1uesowygD7DVpQOAPwilxaE7G9fGE8bbkWioEn6lyZ-3geymK65mqGLnqLnFhR3IYqYHVRp1Nh20CcKJx12pQ9hHO3sVA/s640/user-profile-mgmt.png


/etc/profile                 -           it contains system void variables, if you do any modification in this file it will effect to the administrator and local user profiles.
~/.bash_profile         -           it contains user specific variables, if you do any modification in this file it will effect to that particular account only.
/etc/bashrc                 -           it contains system void alias variables
~/.bashrc                   -           it contains user specific alias variables
.bash_history           -           it contains all executed commands history
Commands:
# alias                        -           it will show the aliases 
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLaaZFxw4r-Nv4sO1j_InzRzGj9QgNuK05usFaVDuZtZs6vI9HfNGRW_rIhm3wQcIHW1Qb9OZCWRjatTcv1JcqXlQuO6ehDYzLbv0FbB6eR0emGRxdhagI-vGXKRfqcB6yKaUjiKCdmXc/s640/alias.png
ailas Command Output

# unalias <alias name>     -           it will remove mentioned alias
Note: you can always define an alias using /etc/bashrc OR .bashrc files
File Permissions:
Permission
Value
Number
Read
r
4
Write
w
2
Execute
x
1

Default permissions when you create a file or directory
File Permissions
File
644
Directory
755

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgphdSy8VFM-jnogI49tWrUC25uLu8TiuxqzuQTbWRa7G-NKmf7P2VnXGp1_0x_Sz3KPpiflOizOWircEu_Q-aEi4DEYIwJtcBwz6WiTL-QsXDFpYVprWMcfEJcZBdTQ69ZcmxpzjUaKXo/s640/permissions.jpg
File and Directory Permissions

In above image explained about file permissions
Commands to Change file/directory permissions
Symbolic permissions
u          -           user/owner
g          -           Group
o          -           Others
w         -           Write
x          -           Execute
+          -           Allow
-           -           deny
# chmod [options] <mode/permissions> <file/directory> - to change permissions file/folder
            Example: chmod 744 file1
# chmod u+rwx file or directory : in case of user only
                        # chmod ug+rwx file or directoty : in case of user and group
                        # chmod u+w,g+r,o+x directory/file
                        # chmod u+rw,g+rw directory/file
                        # chmod u-r, g-w,o-rw directory/file
                        # chmod ugo+rwx file/directory
                        # chmod ugo-rwx file/directory

# chown [options] <new owner> <file/directory> - to change ownership of file/folder
            Example: chown user2 file1
                            chown user1:group1 file2

# chgrp [options] <new group> <file/directory> - to change group of file/folder
            Example: chgrp gorup2 file2

User Administration

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZAA0lrRBt8Q3c_xeAVAmkkAYv7Xafw8mtM_xPK2RUoTBPbxqiCvKVGJT-QXiw6RXykklvNW9UYVjQNItJ3lDfKIXKfTKB7iui-nYZ90gFoT_qXgdQcc8tjY2CzQedXBiA47Bfr4cF71M/s1600/rhcva-banner.jpg



Type of Users:
Root user                -           Default user highly privileged UID is 0. This will create while installing the operating system
System users         -           is nothing but services, at the time of installing particular package. UID starts from 1 to 499.
Local users            -           after installing of the operating system admin user will create these users. UID starts from 500 to 65534.
Ø  After creating a user, user home directory will be created in default path /home.
Ø  One group is will be created with same user name (primary group)
Ø  Files from /etc/skel will be copied automatically to user home directory
Ø  /etc/passwd file is updated with user information
Ø  /etc/group file is update with primary group information
Important files
/etc/passwd     User Information
/etc/shadow     User Passwords
/etc/group      Group Information
/etc/gshadow    Group Passwords


User Administration Commands:
# useradd <user name>     -           To create specified local user
# useradd –d <home directory> <user name>  - create a user with specified home path
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5DcJHdHTddix-P-A3zVXPG9uguSMz7vUFNDx5XE3LnwgYW0FfLLyVGcHa_i5gjtFIuy8jSCylvirTE3F21Eg4ZyImiacRT3XCTpkfGB92Buu5UoJp4GIV3gSfAs637Cdra8S2m2A3IRA/s640/useradd.png

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3l-6cVkC9KOYNNHVcXKnWuxOWuoGDdx9Q-8ZKdTie17QLjDnTTuEk865wEn4RlLm8My6sPpk20sKuIYyA8ffC9uXn4HFSAhNo3-1tbBP29Uco3KTwjXA5DSBYbSNvKBcAsy0_kZUZOBU/s640/useradd-1.png

# useradd –u <UID> <user name>         - create user with specific UID.
# passwd <user name>      -           change the user password
# userdel <user name>      -           delete user
# userdel <user name>      -           delete user including home directory
# finger <user name>         -           See user properties
# chfn <user name>            -           Change user information
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPZ0wbcj8zpKXt3OIayARTHbxLPmJkZTmmfXG-uZON7iB5WfJbRQ3Xf-9H7_sLV7IZCgrHQSim8ZSyu0xxQaZqZIhDoKjKq-8pC1IhRzttiU-aj1ZRvZWSlPYyQT7neO469rhQWXLf_Wc/s640/chfn.jpg
chfn Command Output

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgECWz-zcIR26HB7I4VKUfBjiKwZNra1innIz44PzwfalSxKyWAlhoS06e8NOHxFpc0Z1OvkMYsq8amHLkR7sFPbojH0D9Pm8sLZTI9dvaANQrQvJ3_OMWaslTT0h4SvR9NG0v2nk4eZU/s640/etc-passwd.jpg
/etc/passwd file user entry

 # chage –l <user name> - to check user password expiry and account expiry information
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiexEqvk-D1v7g3KZIJ5-fFF4Pz2g9tFDN3ondGSjzxsOCENLIufEGjdRIqpNbntGaxhCOulQRv92-Ex-jqypaf-QA-4WzmzU2s1NgDd_WFDHd657Tfd0ZGJU3S_6GQCUAtxT-n4UNaJUc/s640/chage-l.png
chage -l Command Output

# su - <user name> -           Switch to other user account
# id <user name>    -           it will show the user id
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTDkDRBDW4jSTJK80Rc1BzKHey_Yl3DKYrWEN9-ijGjW-eJEPTnF0ErufaKQ_V1jbuooM6neGl2AJb0Pz6HSje_QjlFuLk7owCXY6iYZJx9kz3tY3VBHo8ws9N535pbroZxHqOfchi50U/s640/id.png
id Command Output

# system-config-users         -           create and manage user account in GUI

Usermod command options:
-c = We can add comment field for the user account.
-d = To modify the directory for any existing user account.
-e = Using this option we can make the account expiry in specific period.
-g = Change the primary group for a User.
-G = To add a supplementary groups.
-a = To add anyone of the group to a secondary group.
-l = To change the login name
-L = To lock the user account. This will lock the password so we can’t use the account.
-m = moving the contents of the home directory from existing home dir to new dir.
-p = To Use un-encrypted password for the new password. (NOT Secured).
-s = Create a Specified shell for new accounts.
-u = Used to Assigned UID for the user account between 0 to 999.
-U = To unlock the user accounts. This will remove the password lock and allow us to use the user account.

Creating Groups:
Group information is located/stored on /etc/group file.
# groupadd <group name>           - Create a group with specified name
# usermod –G <group name> <user name> - Add user to group
# gpasswd –a ravi Administrators – Adds the user ravi to the group Administrators
# gpasswd –A ravi Administrators – give user ravi administrative rights to the group
# gpasswd –d ravi Administrators – remove user ravi from the group Administrators
# groupdel <group name> - Delete group name
# groupmod –n <new group name> <old group name> - change group name
# newgrp - <group name> - Login into the group if successful, re-initializes the user environment


Access Control List ACL Linux / Unix

POSIX Access Control List ACL : To manage file security using  POSIX (Portable Operating System Interface) access control list ( ACL ).
ACLs allows to assign different permissions for different users and groups.  ACL allows fine-grained permissions to be allocated to a file. Users or groups as well as users and groups identified by a UID or GUID can be granted permissions.
The same permissions we can use below flags apply on files and directories.
Alpha Symbols   r: Read, w: Write,  x: Execute
Numeric   symbols   4 – Read, 2 – Write, 1 – Execute
§  Permissions restricting access to a file to the file owner, membership of a single group or everyone.
§  The file owner can set ACLs on individual files or directories.
§  XFS file systems have built in ACL support.
§  EXT4 file systems created on RHEL7 have ACL enabled by default.

POSIX Access Control List two types:

1.     Access ACLs: we can use access ACLs to grant permissions for a particular file or directory.
2.     Default ACLs: We can use default ACLs only on a directory but if  a file inside that directory does not have an ACL, it inherits the permissions of the default ACLs of the directory.

When ACL’s are required..?

We are going to see about ACL usage in detailed in below explanation, In this example we are going to use four users and three groups.
§  User Names : ravi, kumar, acl and root

§  Groups : finance, engineering and root
To create user and assign password use below command. Repeat the same command to create multiple users.
[root@Techtutorials ARK-ACL]# useradd ravi
[root@Techtutorials ARK-ACL]# passwd ravi
Changing password for user ravi.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
To create group and add users to group, repeat the same steps create and add multiple groups
[root@Techtutorials ARK-ACL]# groupadd finance
 
[root@Techtutorials ARK-ACL]# usermod -G finance ravi
[root@Techtutorials ARK-ACL]# cat /etc/group |grep finance
finance:x:1005:ravi
File Permissions explanation
File Permissions
As per above screenshot permission of the file / directory can only given to User, Group and Others. User ownership and Group ownership.
§  How to restrict particular user, group has full permissions to file / directory
§  How to provide an file / directory permissions to user / group without chaning existing ownership
All the above conditions will be possible by using POSIX Access Control List – ACL
Let’s see how can we acheive above conditions practically

Check ACL permission of file / directory

[root@Techtutorials ARK-ACL]# getfacl test1
# file: test1
# owner: root
# group: root
user::rw-
group::r--
other::r--
 
[root@Techtutorials ARK-ACL]# getfacl /root/ARK-ACL/
getfacl: Removing leading '/' from absolute path names
# file: root/ARK-ACL/
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
Assign POSIX Access Control List to perticular user
Before assigning ACL permissions example is below
[root@Techtutorials ARK-ACL]# chmod 770 test1
[root@Techtutorials ARK-ACL]# ls -l test1
-rwxrwx--- 1 root root 0 Jul 15 15:46 test1
[root@Techtutorials ARK-ACL]# su - ravi
Last login: Fri Jul 15 17:05:16 IST 2016 on pts/1
[ravi@Techtutorials ~]$ cd /ARK-ACL/
[ravi@Techtutorials ARK-ACL]$ vi test1
[ravi@Techtutorials ARK-ACL]$ cat test1
cat: test1: Permission denied
As we see above output we have add full permissions to test1 file for user (owner) and group. We have restricted all others with no access. I have logged in as ravi user and trying to access the test1 file but it is giving an error saying permission denied
Let’s assing ACL permission to particular user and see how it works
Assigned Read permissions using ACL
[root@Techtutorials ARK-ACL]# setfacl -m u:ravi:r test1
Verify ACL is working as excepcted
[root@Techtutorials ARK-ACL]# su - ravi
Last login: Fri Jul 15 17:06:27 IST 2016 on pts/1
[ravi@Techtutorials ~]$ cd /ARK-ACL/
[ravi@Techtutorials ARK-ACL]$ cat test1
[ravi@Techtutorials ARK-ACL]$ cat > test1
-bash: test1: Permission denied
As per above output we are able to read test1 file but we are not able to write test1 file
Let’s provide write access and see
[root@Techtutorials ARK-ACL]# setfacl -m u:ravi:rw test1
[root@Techtutorials ARK-ACL]# getfacl test1
# file: test1
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
 
[root@Techtutorials ARK-ACL]# su - ravi
Last login: Fri Jul 15 17:11:44 IST 2016 on pts/1
[ravi@Techtutorials ~]$ cat > /ARK-ACL/test1
Test
^C
[ravi@Techtutorials ~]$ cat /ARK-ACL/test1
Test

Assign ACL to Group

[root@Techtutorials ARK-ACL]# setfacl -m g:finance:rwx acltest
[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rw-
group::r--
group:finance:rwx
mask::rwx
other::r--
 
[root@Techtutorials ARK-ACL]# cat /etc/group |grep finance
finance:x:1005:ravi
 
[root@Techtutorials ARK-ACL]# su - ravi
Last login: Fri Jul 15 17:32:09 IST 2016 on pts/1
[ravi@Techtutorials ~]$ cat > /ARK-ACL/acltest
Test
^C
[ravi@Techtutorials ~]$ cat /ARK-ACL/acltest
Test
ravi user part of finance group so when we provide permission to finance group automatically user ravi will get an access
Restrict particular user from group has full permissions
In this scenario restrict particular user from group. Group finance has full access but member of finance group kumar user restricted. See below example
[root@Techtutorials ARK-ACL]# usermod -G finance kumar
[root@Techtutorials ARK-ACL]# cat /etc/group |grep finance
finance:x:1005:ravi,kumar
[root@Techtutorials ARK-ACL]# setfacl -m u:kumar:--- acltest
[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
group:finance:rwx
mask::rwx
other::---
 
[root@Techtutorials ARK-ACL]# su - kumar
[kumar@Techtutorials ~]$ cat /ARK-ACL/acltest
cat: /ARK-ACL/acltest: Permission denied

Revoke POSIX Access Control List permissions from user / group

[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
group:finance:rwx
mask::rwx
other::---
 
[root@Techtutorials ARK-ACL]# setfacl -x g:finance acltest
[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
mask::r--
other::---
removing acl from particular file we have to use -x flag along with setfacl command
Replicate file ACL permissions to another file


To replicate one of the file ACL permissions to another file. In this example we are going to replicate test1 file ACL to acltest file.
[root@Techtutorials ARK-ACL]# getfacl test1
# file: test1
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
 
[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rwx
user:kumar:---
group::r--
mask::r--
other::---
 
[root@Techtutorials ARK-ACL]# getfacl test1 | setfacl --set-file=- acltest
[root@Techtutorials ARK-ACL]# getfacl acltest
# file: acltest
# owner: root
# group: root
user::rwx
user:ravi:rw-
group::rwx
mask::rwx
other::---
Copying the access ACL into the Default ACL
[root@TechTutorials ~]getfacl --access /ARK-ACL/ | setfacl -d -M- /root/ARK-ACL/
Conclusion
POSIX Access Control List is extended permissions which are used provide access to more users / groups, who are not owners of user:group.

String Related Commands


String related commands will help you to print/search file text as required
HEAD: Head prints the first N number of data of the given input. By default, it prints first 10 lines of each given file.

Example:       head file2
                      head –n 2 file3  #number of lines
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE8Et5Dcr3783dXtlXPfMAY7_mDLFu5qeGI4jChzpbmavRaFs5qyGU4R0HtIaBbHA3BJF3j4CwIbJdNa2dMdDG-ieR2Pj_2JytUBf85NmA5nh-1lkwuWUOJOfldq5TlyVvdoNw_zXLKkA/s640/head-n.png
head -n Command Output

SORT:   Sort is a simple and very useful command which will rearrange the lines in a text file so that they are sorted, numerically and alphabetically. By default, the rules for sorting are:
ü  Lines starting with a number will appear before lines starting with a letter.
ü  Lines starting with a letter that appears earlier in the alphabet will appear before lines starting with a letter that appears later in the alphabet.
ü  Lines starting with a lowercase letter will appear before lines starting with the same letter in uppercase.

Example:       sort –r file2
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn6gq6tBGi75SKmwGScZKuEEZcavPREGW_uSwReJSrxTA7dmmjCQ4TjwAlIbFYvX8ZMampquStkSFuVS4Z7G91Vma_0nZByst5mwBo_G0ejog_tD-wcd0b7QlWc_Hm_ElLvfmv1fUhDJk/s640/sort-r.png
sort -r Command Output

Options
  -b         ignores leading blanks
  -d         considers only blanks and alphanumeric characters
  -f          fold lower case to upper case characters
  -g         compare according to general numerical value
  -i          consider only printable characters
  -M       compare (unknown) < `JAN' < ... < `DEC'
  -n         compare according to string numerical value
  -r        reverse the result of comparisons
  -c         check whether input is sorted; does not sort
  -k         start a key at POS1, end it at POS2 (origin 1)
  -m        merges already sorted files; do not sort
  -o         write result to FILE instead of standard output
  -s         stabilize sort by disabling last-resort comparison
  -S         use SIZE for main memory buffer
  -t         use SEP instead of non-blank to blank transition
  -T        use DIR for temporaries, not $TMPDIR or /tmp
  -z         end lines with 0 byte, not newline

UNIQ:   Uniq command is helpful to remove or detect duplicate entries in a file.
                         
Example: uniq <file name> - it will print uniq values
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXKatCkqcwLNVTSQx1XP9tUnTfsOLOOvo2rLCl4MRSCAyE-dA3HWKJpy3qD0gutqZTdxaQK_PlNwKODZCXdtJ072DxYFvQgbMqXPCY27WbPuC5v2SJDOx3EIs8UiAXThx0PFxOjuEqgM/s640/uniq.png
uniq Command Output

PASTE:   It is very useful for merging a single file and also for merging set of files as well.
ü  paste command examples for single file handling
ü  paste command examples for multiple files handling

Example: paste –s file1       #All the separate lines are printed as one line
                paste –d, -s file1  #Combined the 'file1' and 'file2' with comma (,) separated.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmhmHQM42rMgxOS-SVGea8s58vyD7jwZI2cOIf04TP0FJQ938oyYxUOs2OTtdn9k0qDqwAtqf4GpQ9d3sG4LrH0FFZm2V7DjuVUpCVBvITIi77w3PsPIEgnOXuSk-5BGwZI6AdcUHrZK4/s640/paste-d.png

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBGNdONLPNiDoJuRsZhS66zCihatJARNqECZQJP1wEEQe_N2ElO6zwX-SonJTAQ5gJwyPZUa6Dk0rl29b0QhmAhDW5oygp-8Pv09Jl83yNCX-Ac140dWb24XI6Z0dWvZ7x_rpEWaiSHek/s640/paste-s.png

CUT:   Cut is used for text processing. You can use this command to extract portion of text from a file by selecting columns.

Example: Below screenshot is the best example, first i have used cat command to see the content of file'testcut'. In next highlighted cut command i have cut the 4 characters from the text.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgimKILGMXvB0OmfM-boFhMWOu70xK8jsz49UJNP5QrRoPMVisdFIxeQBFgQc472kEZC8IOk04iow6Y28ct6Ijz_NYz__fLyyUeq6kuFkyQzry2fycfeRNxf3WfO6kVdAYHhLog1n5ZKZg/s640/cut-c1-4.png
cut Command Output

TR: It will translate content of the file from one case to another case vice versa. Upper case to Lower case.
Note: if you want to change the file text to caps then redirect the output to another file.

Example: in below example i have used 'file1' content to convert to caps lock characters.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6RfPzAEVeroG48NfN7hZc31UwzSlSI26JvBOxwCGn6h3FUSw5Qv6cmDbYYr2rY_9yAP55WRLsoj8a7k9iGwfOM1Hp5mchN_kmtzynSmw1rbnryu2HXYJXo8Mne474sNWKfjvKOVeOL3Y/s640/tar-a-z.png
tr Command Output

SED:  Sed is a Stream Editor used for modifying the files in unix (or linux). Whenever you want to make changes to the file automatically, sed comes in handy to do this. Most people never learn its power; they just simply use sed to replace text. You can do many things apart from replacing text with sed.

Example: In below screenshot i have replaced the 'linux' string to 'unix' .
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_Vf5SX5UJ0_FtyQB1Ja5Eilr0B5_xqnFhoPdWzmVnQg8yopy8cQWLtyBR7cetkmvnRpYx5-MzhZCX2a-8CXoKbH4KsZyJGeGjjVD9aqTyJQZ2wHwE6H3dEehk4cqx_ooRdu2IWER5ULA/s640/sed.png
sed Command Output

DIFF: To compare the difference between two files text you can use this command
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUYajEKSiitxqYVbRGptrll3QsxZmt70UdTQYQJktBghXoEHaeSPmxekYPNn-_cBimuJIfhF63Wii3bjqSar37Y7qO7lMEesAckJCn431i4zxly7Trg5hut61nniwLBNL41FR1995FXCE/s640/diff.png

File Links

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggs1-XUf4XwNRLAbYnmhl8wgusqIM_FU9WoxeLpehIvB0CmJtsAYm-11Bc9fz1Uj4Y4DLO7pDba2Fhp3BvNgmParJ1Ygfkg_WBg9-FIaGsYY8O-_tN91Lq4fgd2GbMs6enplkOgun9eOc/s320/Ribbon-Banner-PSD-File.jpg



File Types
            -b         -           block device file Example: HDD and pen drive
            -d         -           directory file
            -           -           common file
            c          -           Character device file Example: terminal
            l           -           Linked file
Linking means reflecting to the original file, In case of copy command updating is not possible after copying the file from the source to destination. In link updating is possible for both the files. 
HARD Link
SOFT Link
1.    The destination file is exact image of the source file.
1.    The destination file size is length of the source file name
2.    If source got deleted also even we can access the destination file
2.  if source got deleted we can’t access destination file
3.    inode numbers of source and destination are same
3. inode numbers of source and destination are different
4.    We can’t put the hard link to different file system (partitions) because it will different.
4. we can put a link between different file systems
5.    Ex: cp –l <source> <destination>
Ex: cp –s <source> <destination>

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh21IOFQ85FZWcERSNcS0SfY-KlBCqa43ampou05R-5mR6qLd5qw1v1dCQvlcnob5LYFrfdwJPg_v8n7E7rWat0f75y7srlfD-C-oMpst6pEl526j7O-v-Z4N_rruoGSSekvFOCVo6MRlM/s640/links.png

Search related commands


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjuqN36DMstwhhOuRUyNbUorodB76oiJ40vse0ndJEV-aRvevbmz_axEcUVgX9qraHHifkEk59MgKyLs3OQYtOp4s42qcqGvOyjeQV85HsMlrbzLOoJEwK9uq4-AysBHUlUmGzCjUReco/s640/9TzEzpe8c.png


Search commands will help you to search files/directories and file content.

Command GREP
            Grand regular expression, it is used to search the file name and content of the file
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHe8KoFXLCCltNu9xFvq9A6tWEGpWjIYbhWZp98m0fL281JSFJIjgJKdAYt7yyi7rbygMSqkgnqtSwpzc2Iqs7ddrrPJVU2Asb0fGmFBnqe6jq3u6yQrd_S-hGOfwTGoCTyLeTovibrL0/s640/grep.png

 Command FIND
            It is command to find files with different options.
# find / -iname <file name>           - to search files with file name
# find / -perm 770                            - to search files with their permissions
# find / -user <user name>            - to search files with user ownership
# find / -size 10M                             - to search files with their size
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh_htpYehhF3j5lAcuGUbTFi-AnBSqO_OPIarBwJys2ScRJSEy9fXMgGqoHXYqmiD2iiqEE-5qLLLGPvVgmNFSv9OD42Yv-AV_wh-lQ6O3VUJkb5O0WwzoaYpCQYzNIQurVnBlzCiapcc/s640/find.png
find Command Output

Command LOCATE
            Locate command can be used to searching for the file based on the string name from / onwards.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ3IscHkf1EKGOJBUaxQfqmDxU-WKFqMcwdF4_4R5Q0cClonH5ZUaCDpJGllSw1G9X0mH8IMljBCgyS8bfrxYRO1ixUOvC2g6YrpcX4MrOSx45HlX6NB0KmMolBlW-Tz3a2_yMk_nH_Xk/s640/locate.png


Task Automation and Task Scheduling



Scheduling is very useful when you prefer do some automation jobs.

For scheduling the tasks in Linux we are using at and crontab

Command AT:
$ at – it is used to scheduled one are more jobs (commands) for a single execution.
                        Example:       $ at 10:30
                                                $ at now+5 minutes
                                                $ at tomorrow
                                                $ at 10:30 july 15 2015
The expression
Would translate to
noon
12:00 PM October 18 2014
midnight
12:00 AM October 19 2014
teatime
4:00 PM October 18 2014
tomorrow
10:00 AM October 19 2014
noon tomorrow
12:00 PM October 19 2014
next week
10:00 AM October 25 2014
next monday
10:00 AM October 24 2014
fri
10:00 AM October 21 2014
NOV
10:00 AM November 18 2014
9:00 AM
9:00 AM October 19 2014
2:30 PM
2:30 PM October 18 2014
1430
2:30 PM October 18 2014
2:30 PM tomorrow
2:30 PM October 19 2014
2:30 PM next month
2:30 PM November 18 2014
2:30 PM Fri
2:30 PM October 21 2014
2:30 PM 10/21
2:30 PM October 21 2014
2:30 PM Oct 21
2:30 PM October 21 2014
2:30 PM 10/21/2014
2:30 PM October 21 2014
2:30 PM 21.10.14
2:30 PM October 21 2014
now + 30 minutes
10:30 AM October 18 2014
now + 1 hour
11:00 AM October 18 2014
now + 2 days
10:00 AM October 20 2014
4 PM + 2 days
4:00 PM October 20 2014
now + 3 weeks
10:00 AM November 8 2014
now + 4 months
10:00 AM February 18 2015
now + 5 years
10:00 AM October 18 2019

$ atq   - is a command to see scheduled jobs
$ atrm <job number> – is a command to remove the schedules jobs

CRONTAB:  Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times. crontab if your name does not appear in the file /usr/lib/cron/cron.deny. If only cron.deny exists and is empty, all users can use crontab.
            The crontab is a list of commands that you want to run on a regular schedule, and also the name of the command used to manage that list.
                        Example:       crontab –e     - to edit the jobs
                                                crontab –l      - to list the scheduled jobs
                                                crontab –c –u <user name> - to see particular user jobs
                                                crontab –r     - to remove crontab file
  
crontab format
# * * * * *  command to execute
 #
 #
 # └───── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
 # └────────── month (1 - 12)
 # └─────────────── day of month (1 - 31)
 # └──────────────────── hour (0 - 23)
 # └───────────────────────── min (0 - 59)

Example: 5,10,15 * * * * mail –s “Mail from root” aravikumar48@gmail.com
  
This above example will send a mail yet every 5th 10th and 15th minute of every hour


File System



A file system is the underlying structure a computer uses to organize data on a hard disk. If you are installing a new hard disk, you need to partition and format it using a file system before you can begin storing data or programs.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwOGqro9qlnK7tM0t7_QK1wESvlK0UuYVEFr2Wh3RPfs58mjOUwzKeJlZgZCvFvd6ZqhGoCgCH3-Ar5v563QeQCBkgrVBhFN9GybDMlTIKbgjnni-jue1H2bKAA-2VP9q7mpQMhyphenhyphenp3Uqw/s320/filesystem.jpg

Minix -           14 characters, 64MB of storage
Ext     -           Extended file system, 255 characters, 2GB of storage

When you’re going to format the Linux file system using  extend file system it will create blocks.

1). Master Block/Boot Block
2). Super Block
3). Inode Block
4). Data Block



  1. Master block entry is located at partition table, only boot partition contains master blocks data. Remaining partitions master blocks are empty.
  2. Super block just like an index to the book and it will holds to the information as follows


a.    Utilized inode numbers
b.    Free inode numbers
c.     Utilized data blocks
d.    Free data blocks 

            Super block holds all this information.

                    3. Inode table (index table) which holds all the information about files/directories like permissions, owner, group name, size and time stamps.

4096 bytes default block size

15 data blocks = inode

If data size is more than 100MB block size is 4096bytes. If data size is less than 100MB block size is 1024bytes.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEici9l6jzvugqY09DzbtwFzbBjT7P4zbgr4LPao6CW9LJMrKhGvUWYJV974IotrFVmsG-GphYVgOBd3-5kTdUHEWMQVZ4hQTrYtPU8txmmlQ6kKeziezPrM_Wru0WTXhwmzln7WGgiFVtM/s640/filesystem1.png

Directory holds Inode number of file and file name

            4.    Data block storage of files

Table Now below is a very brief comparison of the most common file systems in use with the Linux world
File System
Max File Size
Max Partition Size
Journal-ling
Notes
Fat16
2 GB
2 GB
No
Legacy
Fat32
4 GB
8 TB
No
Legacy
NTFS
2 TB
256 TB
Yes
(For Windows Compatibility) NTFS-3g is installed by default in Ubuntu, allowing Read/Write support
ext2
2 TB
32 TB
No
Legacy
ext3
2 TB
32 TB
Yes
Standard linux filesystem for many years. Best choice for super-standard installation.
ext4
16 TB
1 EB
Yes
Modern iteration of ext3. Best choice for new installations where super-standard isn't necessary.
reiserFS
8 TB
16 TB
Yes
No longer well-maintained.
JFS
4PB
32PB
Yes (metadata)
Created by IBM - Not well maintained.
XFS
8 EB
8 EB
Yes (metadata)
Created by SGI. Best choice for a mix of stability and advanced journaling.
GB = Gigabyte (1024 MB) :: TB = Terabyte (1024 GB) :: PB = Petabyte (1024 TB) :: EB = Exabyte (1024 PB)



Journaling:
A journaling file system is more reliable when it comes to data storage. Journaling file systems do not necessarily prevent corruption, but they do prevent inconsistency and are much faster at file system checks than non-journaled file systems. If a power failure happens while you are saving a file, the save will not complete and you end up with corrupted data and an inconsistent file system. Instead of actually writing directly to the part of the disk where the file is stored, a journaling file system first writes it to another part of the hard drive and notes the necessary changes to a log, then in the background it goes through each entry to the journal and begins to complete the task, and when the task is complete, it checks it off on the list. Thus the file system is always in a consistent state (the file got saved, the journal reports it as not completely saved, or the journal is inconsistent (but can be rebuilt from the file system)). Some journaling file systems can prevent corruption as well by writing data twice.

                                    Journalling
            ______________________________________
         |                                   |                             |
Writable more                      ordered more            journal

i.             Write block – metadata is stored in HDD
ii.            Ordered more – metadata and actual data
iii.          Journal will maintain more space to do journalling

Network File System (NFS):  A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.

SAMBA (SMB): Samba is a software it is used to share the file and printer between Linux to Windows vice verse



Creating Standard Partition: Disk partitioning is the act of dividing a hard disk drive (HDD) into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks, so that a different file system can be used on each partition.

All the device files are stored in /dev/ directory. If your Hard disk is connected

                                                SATA DRIVE                                  IDE DRIVE
Primary master                   /dev/sda                                             /dev/hda
Primary slave                      /dev/sdb                                             /dev/hdb
Secondary master               /dev/sdc                                              /dev/hdc
Secondary slave                  /dev/sdd                                             /dev/hdd

# fdisk            - it is a utility used for creating, deleting, listing and checking partitions

In this situation i am using vmware environment so just added one disk 5GB in size to server.

# ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done         -            To scan new hardware changes.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNbCzHBfm66DZPT1cbjlEs9hbvsbZ_3_IR7MsPnIuIc2QkKoLZ1OCUCXLnG0xPSQDszEeruH05KOJCr_VlddK6Dm2USmknT9HAH22P1eRLjaaYgSeaQpNJ-2W34Hwf4N6Fi0ooAyyBC0M/s640/filesystem2.png

In above image we can able to see new hard disk is found it does not have valid partitions

To create a partition we have to identify HDD name we can use fdisk utility to find.

# fdisk –l – to identify HDD name

In this case our disk name is /dev/sdb

# fdisk /dev/sdb

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzM3EI3xdpt-zIfY50hdEAjPlGZI5RubdL5ulq2if5F6iC0n_PFR_sJm6KpbJbr9J7R5GNiPO94377YfsxDQ-IoCdY32E1qLr7qgzsk96ti9njEDG9uxncO9IDw4WUELkxhiaJ8rEvugs/s640/filesystem3.png

List the options using m option

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif9FwtaXDvsobnB5-RkpKkysZ45qJOA0WFuAUCcYkDDuP0KMFkfde5RMtDFQ3IuUEuJtVILZHkKv-2j2lx0FCtIr0rxBHjp_DSyrXwsqHP6AocsicMVlgolP6FUgw3153UVaSivOcVlD0/s640/filesystem4.png

: p        -    print the partition list in fdisk utility

n – to create a new partition

mention the partition type primary of extended.

Note: (one extended OR 3 Primary 1 Extended) if you create extended partition first you can’t able to create a one more partition in same disk. We can create 3 primary and 1 extended partition.

p for primary

enter the partition number (there is no partitions in our scenario entered 1)

if want to enter the space in first step then calculate cylinders (7.8MB*number)

if you want to provide the space using MB, KB and GB then just hit enter

+1G

Now see partition is created or not using p

p

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiqfExppWmHjVz1sBxW-iL1z00TvbHVif23n61_joDbkhQ7-m0NhOO_SjjE8tr0hxAZz6Ow195Y08wQAeRsitc-1z2Dhzx4VzMWFlxHmGTA7BGgmOWF6hEbTKuf0lGSajEcGSbl34Z1ME/s640/filesystem5.pngTo save the partition information :wq

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEaetcz5c01YOj5NqTNofdd5MvUecWzibsviFI67CicYp540ToGWdBThziQN8M7DW5UpRqd2pE8a5rrAnVHNBqIPW9kAM8-rVXF4457iNCjHkiiOtvkhMkrSFh0NpUdSzm2ArUhSW_HIQ/s640/filesystem6.png


To update partition information to kernel 

# partprobe /dev/sdb – to update partition information to partition table without reboot

Partition created now we have to create a file system in partition

# mkfs.ext3 /dev/sdb1         - make file system in partition

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxv49hwkeJ23NTw0z3AqGp2GV8_jiCmNVNdgsgFu8adcgZMo3zBEnSG-qejRbhml_tNQPdHeYWYVYeO1pDNFi3He9al8wWpCj7pgo4fZwp4PIoiG-tPX11Pw8P5Kx-VXFhnk4wPJG_RVA/s640/filesystem7.png

After completion of creating a file system we have to mount the partition for use

Create a directory to mount # mkdir /arkit

# mount /dev/sdb1 /arkit    - to mount the file system

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgISn9yejFiH9syNzSAq3MmaEORQZgM90S7IYfVm65Auni7CC6645zhnCr68trdMsjE092BpIubvc1NOK2KXhHNRRs5NbIM8674tlOCrstE0uBONCYx2Y1mAxfgyTLjB1UgDWuTZGTZJBE/s640/filesystem8.png

To check filee system size # df –h            - check file system size

Note: SATA and SCSI we can create a 15 partitions and IDE 64 partitions only

To access partition of windows in linux

#mount –t vfat /dev/hdax /mnt

in order to check the label of any partition

#e2label /dev/hdax

where x is number



Mounting CD Rom 

# mount –t auto /dev/hdc /media/cdrom

-t : file type

auto : file type

in order to check where cdrom is attached we can open the file fstab

#vi /etc/fstab

now in case of RHEl 3.0 we have to use command in order to unmount.
# umount /media/cdrom

and then eject the cdrom in case of RHEL 4.0 we simply type
# eject

Mounting Floppy
#mount –t auto /dev/fd0 /media/floppy
in case of floppy we have to umount first then only we remove floppy otherwise all content of floppy may be lost or floppy may be physically damaged.
# umount  /media/floppy

Permanent mount file system we have to edit /etc/fstab/ file.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy23dJAELz7yhGLuhz8xGcf8XrP5mG0_oYDRwCkw6qwagwigdzdSqe-5PNqkHpSw4RsupE2zjjisPyRreXzIADhKAVvfY4kdKxj10B03sJNJF-wmzid76gdi9qQG7xd2hJ1xoohw9gIB8/s640/filesystem9.png

add the entry as mentioned in above screenshot

# mount –a   - to verify mentioned entry is correct, if not it will give you error message

# e2label /dev/sdb1 RAVI  - to add label to partition

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghwY7Y3xF6uCy0eBGWHG4b9x53gEWwbyJJrZu2EH4zfxu_1XJQlGc7_03MudAgFHRuQ_m-msj-H_dAdiVL-o-FCPaZx7hQ8BZDtGgtBPgtY5BZ3QGMB88paZPFLcb5hC4JZ2MzceXyDB4/s640/filesystem10.png

# e2label /dev/sdb1  - to check disk label

DELETING PARTITION:

            Deleting the partition will lead to lose the important data

Remove the entry from /etc/fstab if it is mounted as permanent

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRL2bH4dyKjZ0dNoeOcIE_3yguLKT3YjS1TZAYd_-IGiAEw1qYZSb4SOSbluM5SXdf7t8HB1BIP6LFfGyGI_Oad8KCEw1dQxWJrX6DQGkQBD6oCKj4JzMtZikOjifufnutoHqKVSvVApg/s640/filesystem11.png

# fdisk /dev/sdb

:d

If you have more than one partition it will ask for the partition id

:wq

# partprobe /dev/sdb

# fdisk –l /dev/sdb 


Extending the Swap:

Create a partition

            Change the partition type ID to 82 using t option in fdisk utility

# mkswap /dev/sdb2            - it will format in swap file system

# free  -           to check swap size

Options:       -m in MB format
                      -G in GB format

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoH4CZgAPchamwUYmUQ58ehKyjThyMMPjtCKwnFw65kFXSht2J0cwnnSYnFb9ygy6czMy_6y6W0RjLeyTOz8KLu81-8P_dJRNyHzDYFSnW1kuwJpE4jZ3qt_mZtDKSqcDlex1W7A-exxo/s640/filesystem12.png
            
# swapon /dev/sdb2 – in your case it may different.

To make permanent mount of swap file system edit the /etc/fstab file and add the entry

# mount –a   - to refresh the /etc/fstab mounts

 

Logical Volume Manager
LVM is a logical volume manager for the Linux kernel that manages disk drives and similar mass-storage devices. Using logical volume manager will give more flexibility to increase/reduce file system in more effective way and no loss of data.

Advantages

LVM gives you more flexibility than just using normal hard drive partitions: 
  • Use any number of disks as one big disk.
  • Have logical volumes stretched over several disks.
  • Create small logical volumes and resize them "dynamically" as they get filled up.
  • Resize logical volumes regardless of their order on disk. It does not depend on the position of the LV within VG, there is no need to ensure surrounding available space.
  • Resize/create/delete logical and physical volumes online. File systems on them still need to be resized, but some (such as ext4) support online resizing.
  • Online/live migration of LV being used by services to different disks without having to restart services.
  • Snapshots allow you to back up a frozen copy of the file system, while keeping service downtime to a minimum.
Support for various device-mapper targets, including transparent file system encryption and caching of frequently used data. 

 


To make LVM’s we will first create physical volumes, we will combine all the PV’s into the volume group and top of the VG’s we will create LVM’s.

Let’s create Partitions



[root@ARK-IT-Solutions ~]# fdisk /dev/sdb

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652): +1G

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@ARK-IT-Solutions ~]# partprobe /dev/sdb

Repeat the above step for remain partition creations.



Creating Physical volumes
  

# pvcreate /dev/sdb1 /dev/sdb2 /dev/sdb3 – to create PV’s
# pvscan        -           to see if any PV’s are there
# pvdisplay   -           to see PV properties, attributes of a physical volume
# pvs               -           to see the PV’s information, produces formatted output about PV’s


# vgcreate /dev/sdb1 /dev/sdb2 /dev/sdb3


# vgdisplay   -           It will display all VG properties
# vgscan        -           It will scan for all existing volume groups and rebuild caches


# vgextend <pv name>      - allows you to add one or more initialized physical volumes to an  existing volume group to extend it in size.


# vgremove <vg name>     - to delete VG
  

# vgreduce <vg name> <pv name>         - to remove PV from VG


Note: Volume Group reducing will lead to data loss, we have to take a backup of complete VG then do above step. Do not practice above step in any production environment.

#vgrename   <old vg name> <new vg name>   - to rename VG name


#vgmerge <vg1> <vg2>    - To merge two VG’s as one group


# lvcreate –n <lv name> -L +<size> <vg name> - create a logical volume in an existing VG


# lvdisplay    - allows you to see the attributes of a logical volume like size, read/write status, snapshot information etc.


# lvextend –L +500M <lv path>  - to extend the LV space


# lvreduce –L -500M <lv path>   - to reduce the LV space



Note: reducing the logical volume space will lead to data loss, before reducing the lv space we have to take lv snapshot to restore back to same state. Do not practice this command until unless it’s required.

Logical Volume Management (LVM) Part-2

Continuation...... of Logical Volume Management.

Command options:
lvchange       Change the attributes of logical volume(s)
lvconvert       Change logical volume layout
lvcreate         Create a logical volume
lvdisplay       Display information about a logical volume
lvextend        Add space to a logical volume
lvmchange    With the device mapper, this is obsolete and does nothing.
lvmdisks        can List devices that may be used as physical volumes
lvmsadc         Collect activity data
lvmsar           Create activity report
lvreduce        Reduce the size of a logical volume
lvremove       Remove logical volume(s) from the system
lvrename       Rename a logical volume
lvresize          Resize a logical volume
lvs                   Display information about logical volumes
lvscan                        List all logical volumes in all volume groups


# lvm  -           to enter into the logical volume mode
  


# lvrename   -           to rename the lv name
  


# lvremove    -           to delete the LV
  


# lvmdump   - to collect all the information about LV’s, VG’s and PV’s
  


# lvmdiskscan          -           to see LV’s, VG’s and PV’s info with size
# lvs                            -           to check logical volumes info

# lvcreate –size 100m –snapshot –name snap /dev/data/lv0 - creates a snapshot logical volume named /dev/data/snap which has access to the contents of the original  logical  volume  named /dev/data/lv0 at snapshot logical volume creation time. If the original logical volume contains a file system, you can mount the snapshot logical  volume  on  an  arbitrary directory  in  order  to  access  the  contents  of the file system to run a backup while the original file system continues to get updated.
  


# mkfs.ext3 /dev/data/lv0  - to make file system in lv
  


# mount <lv path> <mount point>         - to mount the lv
To example of snapshot


To restore the snapshot data mount the snapshot to mount point and copy the files from snapshot to original path

In order to delete the logical volume
#umount /lv0
#lvremove /dev/data/lv0
#vgremove data
#pvremove /dev/sdb1
#pvremove /dev/sdb2

Disk Quota Management

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2v7ggvKISAT8Yku_UILJ8FY8HuRHHNTFX0_lblipfLHskfCZP4KgGFQMZZR-SXqnkQMXuQODtBr5cUvSQc_HmIlMi86NrCBgIPiGEKrt2TR8ymMOR1Sgi1LDFbDbtk2DeJI4Hhfpbqyw/s320/images.jpg
Disk Quota Management


     Disk quotas are commonly used by ISPs, by Web hosting companies, on FTP sites, and on corporate file servers to ensure continued availability of their systems.

         Quotas are used to limit a user’s or a group of user’s ability to consume disk space. This prevents a small group of users from monopolizing disk capacity and potentially interfering with other users or the entire system.

·         Soft limit

This is the maximum amount of space a user can have on that partition. If you have set a grace period, this will act as an alarm. The user will then be notified she is in quota violation. If you have set a grace period, you will also need to set a hard limit. A grace period is the number of days a user is allowed to be above the given quota. After the grace period is over, the user must get under the soft limit to continue. By default grace period have seven days limits.

·         Hard limit

Hard limits are necessary only when you are using grace periods. If grace periods are enabled, this will be the absolute limit a user can use. Any attempt to consume resources beyond this limit will be denied. If you are not using grace periods, the soft limit is the maximum amount of available space for each user.

·         Grace Periods

Linux has provided the default of seven days for both inode and block usage. That is, a user may exceed the soft limit on either resource for up to seven days. After that, further requests by that user to use files will be denied.
    To do quota we will use edquota, repquota and quotacheck tools to create modify and report quota management.

Quota can be applied to users and groups, block size and inode number.

We have to install/verify quota packages is installed.


~]# rpm –qa |grep quota      - to verify quota rpm is installed or not 
 

Now open /etc/fstab to open quota
/dev/sdb1    /qcheck   ext3    defaults,usrquota,grpquota 1 2
 

Either reboot or remount the file system to enable quota
~]# mount –o remount,usrquota,grpquota,rw /qcheck
 


In this case /qcheck is the mount point.

To enable or create a quota file we have to run
~]# quotacheck –cugm /qcheck

  quotacheck command options
                     -v scans and prints verbose
                     -c performs a new scan
                      -g scan quota for groups
                      -m remount the scanned file system
                      -u scan quota for users
                      -a Check all quota-enabled, locally-mounted FS

Switch on the quota using below command
~]# quotaon –avug

 

Now quota is on. Add quota soft and hard limits to any user
 


Now verify writing some dump data (dd command).

Login as a ravi user then
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=10
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=21
 

In above screenshot it is showing that warning and exceeded limits for user ravi.

To verify the quota settings
~]# quota –u <user name>

 

To increase a grace period for a user
~]# edquota –T <user name>
 



Enable the quota for a group.
~]# edquota –g <group name>
 

In this case quota is group name

Removing quota
Switchoff the quota
~]# quotaoff –avug
 


Then clear the entry in /etc/fstab 



Remount the partition using
~]# mount –o remount,rw <mountpoint>

 
 RPM is a powerful software manager. It can install, remove, query, and verify the software on your system. Setup of applications is called as package.
Packages Types














Core Packages: These packages are available with you installation media

Extra Core Packages: These extra core packages mean after OS installation,  upgrade of package OR release is called as extra core packages.


RPM Explanation


Above is the explanation about rpm structure

# rpm <options> <package name>          - to install, remove, query and upgrade RPM

Options:
                        -I         -           install
                        -v         -           verbose
                        -q         -           query
                        -e         -           deleting/erasing
                        -U        -           upgrade
                        -a         -           all
                        -h        -           hashes ‘#’ s
# rpm –import <key file name>   -           to import the rpm license key

Drawbacks of RPM:
1.    Distribution packages
2.    Architecture specific
3.    Dependency

# rpm -ivh <package name>         -           to install package

Installing rpm


# rpm –import <key file path>     - to import license key
Importing RPM Key


# rpm –ev <package name>         -           to delete/erase rpm



# rpm –qa |grep telnet      -           to query the rpm 
Searching rpm
# rpmbuild <file name>     - to RPM from source code

Source Code: source code is the external packages which we are writing some scripts OR software packages.

Note: when we are installing some of the packages using package manager it will ask you to install dependency packages, installing all the packages manually will eat most of your time. To resolve these types of dependencies we have to configure YUM server.

YUM: yellow-dog updater modified

Some of the advantages of YUM include

• Automatic resolution of software dependencies.

• Command-line and graphical versions. YUM can install or upgrade software by using either the command-line version (yum command) or one of two graphical programs:

• Adding and removing software.

• Package updater that only shows software updates available from RHN.

• Multiple software locations at one time. YUM can be configured to look for software packages in more than one location at a time.

• Ability to specify particular software versions or architectures.

          YUM downloads software from repositories located over the network, either on the local network or over the Internet. The files, including the RPM package files, in these repositories are organized in a specific way so that they can be found by the YUM client.

Configure YUM server we have to install createrepo RPM in server

# rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm
Installing createrepo Package


Copy all the RPM packages to one location local path (in this case I have copied to /yum location)

Edit the file
# vi /etc/yum.repos.d/rhel-debuginfo.repo
YUM sample configuration file content



Save the file and exit

Create a repository

# createrepo –v /yum/         - to create a repository database





Repo data path (repository files)


 # yum list all            - to check packages are fetching from YUM server
# yum install <package name>   - to install packages



 Like above all the packages and there dependencies will be installed.
 # yum remove <package name>  - to remove package its dependencies



# yum clean all        -           it will clean all the cache data of yum server

# yum update <package name>  - to update/upgrade mentioned package

If you want make this YUM as centralized server for all the local domain servers. We have to share this using FTP and HTTP protocol.

SERVER SIDE
[rhel-debuginfo]
name=ARK-IT
baseurl=ftp://yum/
enabled=1
gpgcheck=1
gpgkey=ftp://yum/rpm-gpg/RPM-GPG-KEY-redhat-release

CLIENT SIDE
[rhel-debugino]
Name=ARK-IT
Baseurl=ftp://SERVERIP/PATH
Enabled=1
Gpgcheck=0

Redundant array of independent disk


RAID (originally redundant array of inexpensive disks; now commonly redundant array of independent disks) is a data storage virtualization technology that combines multiple disk drive components into a logical unit for the purposes of data redundancy or performance improvement.

In RAID we have different RAID levels

1.    Level 0           -           striped disk array without fault tolerance
2.    Level 1           -           mirroring and duplexing
3.    Level 2           -           error-correcting coding
4.    Level 3           -           bit-interleaved parity
5.    Level 4           -           dedicated parity drive
6.    Level 5           -           block interleaved distributed parity
7.    Level 6           -           independent data disks with double parity
8.    Level 10        -           a stripe of mirrors

RAID Level 0:  It’s just stripping. RAID Level 0 requires a minimum of 2 drives to implement.

  • RAID 0 implements a striped disk array, the data is broken down into blocks and each block is written to a separate disk drive
  • I/O performance is greatly improved by spreading the I/O load across many channels and drives
  • Best performance is achieved when data is striped across multiple controllers with only one drive per controller
  • No parity calculation overhead is involved
  • Very simple design
  • Easy to implement
RAID Level 1: For Highest performance, the controller must be able to perform two concurrent separate Reads per mirrored pair or two duplicate Writes per mirrored pair. Raid level 1 requires a minimum of 2 drives to implement.




  • ·         One Write or two Reads possible per mirrored pair
  •  
  • ·         Twice the Read transaction rate of single disks, same Write transaction rate as single disks
  •  
  • ·         100% redundancy of data means no rebuild is necessary in case of a disk failure, just a copy to the replacement disk
  •  
  • ·         Transfer rate per block is equal to that of a single disk
  •  
  • ·         Under certain circumstances, RAID 1 can sustain multiple simultaneous drive failures
  •  
  • ·         Simplest RAID storage subsystem design

RAID Level 2:  Each bit of data word is written to a data disk drive each data word has its Hamming Code ECC word recorded on the ECC disks. On Read, the ECC code verifies correct data or corrects single disk errors.




  • ·         "On the fly" data error correction
  •  
  • ·         Extremely high data transfer rates possible
  •  
  • ·         The higher the data transfer rate required, the better the ratio of data disks to ECC disks
  •  
  • ·         Relatively simple controller design compared to RAID levels 3,4 & 5

RAID Level 3: Byte-level striping with dedicated parity, data block is subdivided ("striped") and written on the data disks. Stripe parity is generated on Writes, recorded on the parity disk and checked on Reads. Requires minimum 3 disks to implement





  • ·        Very high Read data transfer rate
  •  
  • ·        Very high Write data transfer rate
  •  
  • ·        Disk failure has an insignificant impact on throughput
  •  
  • ·        Low ratio of ECC (Parity) disks to data disks means high efficiency
RAID Level 4:  Block-level striping with dedicated parity. Each entire block is written onto a data disk. Parity for same rank blocks is generated on Writes, recorded on the parity disk and checked on 

Reads. Requires minimum 3 disks
·    
    


  •         Very high Read data transaction rate
  •  
  • ·        Low ratio of ECC (Parity) disks to data disks means high efficiency
  •  
  • ·        High aggregate Read transfer rate

RAID Level 5: Block-level striping with distributed parity. Each entire data block is written on a data disk; parity for blocks in the same rank is generated on Writes, recorded in a distributed location and checked on Reads. Requires minimum 3 disks to implement


·         


  •      Highest Read data transaction rate
  •  
  • ·        Medium Write data transaction rate
  •  
  • ·        Low ratio of ECC (Parity) disks to data disks means high efficiency
  •  
  • ·        Good aggregate transfer rate
RAID Level 6:  Block-level striping with double distributed parity. Two independent parity computations must be used in order to provide protection against double disk failure. Two different algorithms are employed to achieve this purpose. Requires minimum 4 disks implement     


·         


  •      RAID 6 is essentially an extension of RAID level 5 which allows for additional fault tolerance by using a second independent distributed parity scheme (dual parity)
  •  
  • ·        Data is striped on a block level across a set of drives, just like in RAID 5, and a second set of parity is calculated and written across all the drives; RAID 6 provides for an extremely high data fault tolerance and can sustain multiple simultaneous drive failures
  •  
  • ·        RAID 6 protects against multiple bad block failures while non-degraded
  •  
  • ·        RAID 6 protects against a single bad block failure while operating in a degraded mode
  •  
  • ·        Perfect solution for mission critical applications
RAID Level 10: Disks within the group are mirrored and groups are stripped, required minimum 4 disks to implement





  • ·        RAID 10 is implemented as a striped array whose segments are RAID 1 arrays
  •  
  • ·        RAID 10 has the same fault tolerance as RAID level 1
  •  
  • ·        RAID 10 has the same overhead for fault-tolerance as mirroring alone
  •  
  • ·        High I/O rates are achieved by striping RAID 1 segments
  •  
  • ·        Under certain circumstances, RAID 10 array can sustain multiple simultaneous drive failures
·         
      Excellent solution for sites that would have otherwise gone with RAID 1 but need some additional performance boost

Implementing the RAID will be two types 1.Software RAID and 2.Hardware RAID
Let’s see the difference between those

SOFTWARE RAID
HARDWARE RAID
1.    It will use computer system CPU
1.    It will use its own CPU
2.    Low cost compare to H/W RAID
2.More cost compare to S/W RAID
3.    It has data integrity issues due to system crashes
     3.No data integrity issues
4.    No write-back cache
4.It is capable of write-back cache
5.    Limited operating system migrations
5.Can be migrated to any OS type
6.    Unprotected at boot (cannot manage or protect data at boot):Drive failure or corrupted data during boot and before the RAID software become active leads to an inoperable system
6. Protected at boot: No negative impact on data availability
when boot drive has medium errors or fails completely
7.    Performance issues will be there
7.No performance issues compare to S/W RAID

Add new disks for RAID Creation


Create partitions using disks, partition type should be Linux raid AutoDetect (fd)



Creating RAID Device
# mdadm --create /dev/md0 --level=5 --raid-disk=3 /dev/sdb1 /dev/sdb2 /dev/sdb3


# mkfs.ext3 /dev/md0         - to make file system in RAID device


Mounting and using raid device

# mdadm –detail     /dev/md0        - to see the raid device details







https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1iiYBmBykDci_xGab6GmBatwRws2oMrWSr3I5fSSpkYYYQRsK1r27uBBVaDYM8f3kIhB8eNosEXa0HAxNh8dbqKnSObQOcOF4ME8KJlaFLDq22t4_zDJJSd0u7brNC0-5Cl8PIAYVoPc/s1600/architecture.jpg# mdadm /dev/md0 --fail /dev/sdb3          - to do manual failure of disk
  



To see the detail of raid device and any failed disks
  




# mdadm /dev/md0 --remove /dev/sdb3               - Removing failed drive from RAID
  



# mdadm /dev/md0 --add /dev/sdb4         - Adding New disk to RAID Device
  



To Destroy RAID Device and its related disk completely wipe
# umount /raid         - to un mount the file system
# mdadm –stop /dev/md0   - Stopping RAID Device
# mdadm –remove /dev/md0         - to remove RAID Device
# fdisk /dev/sdb        use d to delete all the disks from OS
  

No comments :

Post a Comment