Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Scenario: 1
============================================
How to configure Yum Server Repository & Yum Client:
====================================================
A) Configure the server1.example.com as Yum server for RHEL6.
- You can find the RHEL6 ISO Image at /media/rhel6.iso
B) Configure the Yum Client to use local YUM Repository.
Repository url = ftp://server1.example.com/pub/rhel6/repo
====================================================
1) Mount the CD or ISO Image to Directory.
# mkdir -p /rhel6/iso
# cp /media/rhel6.iso /rhel6/iso/
# mkdir -p /rhel6/iso_mount
# mount -o loop /rhel6/iso/rhel6.iso /rhel6/iso_mount
2) Install FTP server by installing vsftpd rpm.
# cd /rhel6/iso_mount/Packages/
# rpm -ivh vsftpd-2.2.2-6.el6.i686.rpm
# service vsftpd status
vsftpd is stopped
# service vsftpd start
Starting vsftpd for vsftpd:
# chkconfig vsftpd on
# chkconfig --list vsftpd
vsftpd
0:off
1:off
[ OK ]
2:on
3:on
4:on
5:on
6:off
gpgcheck=0
plugins=1
installonly_limit=3
******************************************************************
6.2) # vim /etc/yum.repos.d/rhel6.repo
******************************************************************
[rhel6]
name=rhel6_repo
# Note: While using local repository using file need to use /// [three times].
baseurl=file:///var/ftp/pub/rhel6/repo
#baseurl=http://server1.example.com/rhel6/repo
#baseurl=ftp://server1.example.com/pub/rhel6/repo
enabled=1
gpgcheck=0
*****************************************************************
6.3) # yum clean all
6.4) # mkdir -p /var/cache/yum/i386/6Server
6.5) # yum clean all
******************************************************************
Loaded plugins: refresh-packagekit, rhnplugin
Cleaning up Everything
******************************************************************
6.6) # yum update all
******************************************************************
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
rhel6
| 1.3 kB
00:00 ...
rhel6/primary
| 1.3 MB
00:00 ...
rhel6
2679/2679
Setting up Update Process
No Match for argument: all
No package all available.
No Packages marked for Update
******************************************************************
6.7) Verify Yum Server & Client Configuration
# yum -y install firefox
************************************************************************************************
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package firefox.i686 0:3.6.9-2.el6 set to be updated
--> Processing Dependency: system-bookmarks for package: firefox-3.6.9-2.el6.i686
--> Running transaction check
---> Package redhat-bookmarks.noarch 0:6-1.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package
Arch
Version
Repository
Size
==================================================================================
Installing:
firefox
i686
3.6.9-2.el6
rhel6
14 M
Installing for dependencies:
redhat-bookmarks
noarch
6-1.el6
rhel6
4.2 k
Transaction Summary
==================================================================================
Install
2 Package(s)
Upgrade
0 Package(s)
Total download size: 14 M
Installed size: 17 M
Downloading Packages:
-----------------------------------------------------------------------------------------------Total
120 MB/s | 14 MB
00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing
: redhat-bookmarks-6-1.el6.noarch
1/2
Installing
: firefox-3.6.9-2.el6.i686
2/2
Installed:
firefox.i686 :3.6.9-2.el6
Dependency Installed:
redhat-bookmarks.noarch 0:6-1.el6
Complete!
************************************************************************************************
cached
1477
b) # swapon -s
Filename
/dev/dm-1
Type
partition 4030456
Size
0
Used
-1
Priority
c) # cat /proc/swaps
Filename
/dev/dm-1
Type
partition 4030456
Size
0
Used
-1
Priority
Start
32.3kB
105GB
105GB
105GB
160GB
End
105GB
105GB
105GB
160GB
160GB
Size
Type
105GB primary
682kB
524MB primary
54.7GB primary
877kB
File system
ntfs
Free Space
ext4
lvm
Free Space
Flags
boot
Metadata Areas
1
Metadata Sequence No 5
VG Access
read/write
VG Status
resizable
MAX LV
0
Cur LV
4
Open LV
4
Max PV
0
Cur PV
1
Act PV
1
VG Size
50.90 GiB
PE Size
4.00 MiB
Total PE
13031
Alloc PE / Size
10805 / 42.21 GiB
Free PE / Size
2226 / 8.70 GiB
VG UUID
fGpkBe-01gA-yblA-dwsm-z2Eb-zctm-DlHash
2.1) Create LVM partition & Configure System to use additional SWAP Space.
**************************************************************************
1.3) Create Logical Volume of 512 MB for SWAP
# lvcreate -L 512M -n lv_swap2 vg_1
Logical volume "lv_swap2" created
1.4) Format the Partition as SWAP.
# mkswap -f /dev/vg_1/lv_swap2
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=23925fe4-a533-4f4d-b214-a38803ff0138
1.5) Configured the SWAP LV to use as SWAP SPACE.
# swapon /dev/vg_1/lv_swap2
1.6) Verify the SWAP Space:
1.6.1) # free -m
total
used
free
shared buffers
Mem:
1952
1787
165
0
6
-/+ buffers/cache:
293
1658
Swap:
4447
0
4447
Priority
Priority
1.6.2) # swapon -s
Filename
/dev/dm-1
/dev/dm-4
1.6.3) # cat /proc/swaps
Filename
/dev/dm-1
/dev/dm-4
Type
partition 4030456
partition 524280 0
Type
partition 4030456
partition 524280 0
cached
1486
Size
0
-2
Size
0
-2
Used
-1
Used
-1
1.7) Configure SWAP2 partition in FSTAB entry to have additional space available post reboot.
#
# /etc/fstab
# Created by anaconda on Sun Jun 24 15:39:01 2012
#
# 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
#
/dev/mapper/vg_1-lv_root
/ ext4
defaults
1
1
UUID=791eacef-480a-49ed-8f89-a1538a2bfc35 /boot ext4 defaults 1 2
/dev/mapper/vg_1-lv_home
/home ext4
defaults 1 2
/dev/mapper/vg_1-lv_var
/var
ext4
defaults 1 2
/dev/mapper/vg_1-lv_swap
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/vg_1/lv_swap2
swap
swap
defaults
0 0
1.8) Restart the Machine and Verify:
1.8.1) # free -m
total
used
Mem:
1952
1787
-/+ buffers/cache:
293
Swap:
4447
0
free
165
1658
4447
shared
0
buffers
6
cached
1486
1.8.2) # swapon -s
Filename
/dev/dm-1
/dev/dm-4
Type
partition
partition
Type
partition
partition
Type
partition 5242872
Type
cached
122
Size
0
Size
Used
-1
Used
/dev/sda2
partition 5242872
-1
1.1) # fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000abf0b
Device Boot
Start
End
Blocks Id System
/dev/sda1 *
1
64
512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2
64
717 5242880 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3
717
3328 20971520 83 Linux
/dev/sda4
3328
5222 15215616 5 Extended
/dev/sda5
3328
4372
8388608 83 Linux
1.2) # parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End
Size Type
File system
Flags
32.3kB 1049kB 1016kB
Free Space
1
1049kB 525MB 524MB primary ext4
boot
2
525MB 5894MB 5369MB primary linux-swap(v1)
3
5894MB 27.4GB 21.5GB primary ext4
4
27.4GB 42.9GB 15.6GB extended
5
27.4GB 36.0GB 8590MB logical ext4
36.0GB 42.9GB 6989MB
Free Space
1.4) # partx -a /dev/sda [First Time it will show only existing Resource]
BLKPG: Device or resource
error adding partition 1
BLKPG: Device or resource
error adding partition 2
BLKPG: Device or resource
error adding partition 3
BLKPG: Device or resource
error adding partition 4
BLKPG: Device or resource
error adding partition 5
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
busy
Type
Size
partition 5242872
Used
-1
Type
partition 5242872
partition 530112 0
Size
0
-2
Used
-1
total
used
free
shared buffers
Mem:
2023
376
1646
0
132
-/+ buffers/cache:
122
1900
Swap:
5637
0
5637
cached
122
c) # cat /proc/swaps
Filename
Priority
/dev/sda2
/dev/sda6
Type
partition 5242872
partition 530112 0
Size
0
-2
Used
-1
1.9) Configure SWAP2 partition in FSTAB entry to have additional space available post reboot.
# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed May 30 01:33:24 2012
#
# 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=535d271b-f69a-4ee7-bb80-4cf9484f96b7 / ext4 defaults
11
UUID=0ff225aa-259a-4753-ba3a-8655d9ffdd0b /boot ext4 defaults
12
UUID=3c9f2b95-7ef2-4313-b803-11f5551e30bd /var ext4 defaults
12
UUID=ecc42979-0510-47c5-a14e-b5279fffaa61 swap swap defaults
00
tmpfs
/dev/shm
tmpfs defaults
00
devpts
/dev/pts
devpts gid=5,mode=620 0 0
sysfs
/sys
sysfs defaults
00
proc
/proc
proc
defaults
00
/dev/sda6
swap
swap
defaults 0 0
1.10) Restart the Machine and Verify:
a) # swapon -s
Filename
Priority
/dev/sda2
/dev/sda6
Type
partition 5242872
partition 530112 0
Size
0
-2
Used
-1
b) # free -m
total
used
free
shared buffers
Mem:
2023
376
1646
0
132
-/+ buffers/cache:
122
1900
Swap:
5637
0
5637
c) # cat /proc/swaps
Filename
Priority
/dev/sda2
/dev/sda6
Type
partition 5242872
partition 530112 0
cached
122
Size
0
-2
Used
-1
cached
129
101
b) # swapon -s
Filename
Priority
/dev/sda5
Type
partition 5242872
Size
0
Used
-1
c) # cat /proc/swaps
Filename
Priority
/dev/sda5
Type
partition 5242872
Size
0
Used
-1
4) Configured Proper Access rights for the File to be used for SWAP.
# chmod 600 /root/myswapfile
# ls -lh /root/myswapfile
-rw-------. 1 root root 512M Jun 25 15:00 /root/myswapfile
5) Format the File as SWAP FS
# mkswap /root/myswapfile
mkswap: /root/myswapfile: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=8539d349-48cd-43c2-beaa-d6e56745f009
6) Add File space to current SWAP Space.
# swapon /root/myswapfile
7) Verify the SWAP Space
a) # swapon -s
Filename
Priority
/dev/sda5
/root/myswapfile
Type
Size
partition 5242872
0
file
524280 0
Used
-1
-2
b) # free -m
total
used
free
shared buffers
Mem:
2023
874
1148
0
130
-/+ buffers/cache:
130
1892
Swap:
5631
0
5631
cached
613
c) # cat /proc/swaps
Filename
Priority
/dev/sda5
/root/myswapfile
Type
Size
partition 5242872
0
file
524280 0
Used
-1
-2
Type
Size
partition 5242872
0
file
524280 0
Used
-1
-2
b) # free -m
total
used
free
shared buffers
Mem:
2023
874
1148
0
130
-/+ buffers/cache:
130
1892
Swap:
5631
0
5631
cached
613
c) # cat /proc/swaps
Filename
Priority
/dev/sda5
/root/myswapfile
Type
Size
partition 5242872
0
file
524280 0
Used
-1
-2
12
12
00