How to build local and network yum sources?
1. Self-built yum repository, which is the network source and the local source respectively.
1) Mount the CD image
[root@centos7 ~] # mount / dev/sr0 / mnt/
[root@centos7] # df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/mapper/centos-root 60G 5.2G 55G 9% /
Devtmpfs 983M 0 983M 0% / dev
Tmpfs 1000M 0 1000M 0% / dev/shm
Tmpfs 1000M 75M 926M 8% / run
Tmpfs 1000M 0 1000M 0% / sys/fs/cgroup
/ dev/sda1 1014M 166M 849M 17% / boot
Tmpfs 200m 52K 200m 1% / run/user/1008
/ dev/sr0 11G 11G 0100% / mnt
Tmpfs 200m 0 200m 0% / run/user/0
2) build local sources
[root@centos7 yum.repos.d] # cat > local.repo name=centos7.6
Baseurl= file:///mnt
> enabled=1
> gpgcheck=0
> EOF
3) install httpd and build network yum source
[root@centos7 yum.repos.d] # yum install httpd-y # successful installation means that the local source takes effect
[root@centos7 html] # cd / var/www/html
[root@centos7 html] # ln-s / mnt centos7.6
[root@centos7 html] # ls centos7.6/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
4) verify the network yum source (on another centos7)
Configure to use a network yum source:
[root@jumpserver yum.repos.d] # cat local.repo
[local]
Name=centos7.6
Ip/centos7.6 of yum source for baseurl=http:// network
Enabled=1
Gpgcheck=0
[root@jumpserver yum.repos.d] #
Successful installation of httpd indicates that the network yum source is available
[root@jumpserver yum.repos.d] # yum install httpd-y
2, compile and install http2.4, the implementation can be accessed normally, and submit the compilation steps and results.
1) decompression
[root@centos7 bin] # rpm-qi httpd
Package httpd is not installed
[root@centos7 src] # tar-xf httpd-2.4.41.tar.gz
2) Configure
[root@centos7 src] # cd httpd-2.4.41/
[root@centos7 httpd-2.4.41] #. / configure
Checking for chosen layout... Apache
Checking for working mkdir-p. Yes
Checking for grep that handles long lines and-e. / usr/bin/grep
Checking for egrep... / usr/bin/grep-E
Checking build system type... X86_64-pc-linux-gnu
Checking host system type... X86_64-pc-linux-gnu
Checking target system type... X86_64-pc-linux-gnu
Configure:
Configure: Configuring Apache Portable Runtime library...
Configure:
Checking for APR... No
Configure: error: APR not found. Please read the documentation.
Install the missing dependency packages:
[root@centos7 httpd-2.4.41] # yum install apr* pcre*-y
[root@centos7 src] # cd httpd-2.4.41/
3) compilation
[root@centos7 httpd-2.4.41] # make
4) installation
[root@centos7 httpd-2.4.41] # make install
5) start and verify
[root@centos7 bin] # pwd
/ usr/local/apache2/bin
[root@centos7 bin] #. / apachectl-k start
[root@centos7 bin] # ps aux | grep apache
Root 14751 0.0 0.1 103732 2728? Ss 18:34 0:00 / usr/local/apache2/bin/httpd-k start
Daemon 14754 0.0 0.1 392644 2416? Sl 18:34 0:00 / usr/local/apache2/bin/httpd-k start
Daemon 14755 0.0 0.1 392644 2424? Sl 18:34 0:00 / usr/local/apache2/bin/httpd-k start
Daemon 14756 0.0 0.1 458180 2424? Sl 18:34 0:00 / usr/local/apache2/bin/httpd-k start
[root@centos7 bin] # curl localhost
It works!
[root@centos7 bin] #
3. Create a 2G file system with a block size of 2048byte and reserve 1% free space. The file system ext4 and the volume label are TEST. This partition is required to be automatically mounted to the / test directory when powered on, and there is an acl mount option by default.
1) add a hard disk to the virtual machine and let the system recognize the hard disk immediately
[root@centos7 ~] # echo "- -" > / sys/class/scsi_host/host0/scan
[root@centos7 ~] # fdisk-l
Disk / dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0003e74f
Device Boot Start End Blocks Id System
/ dev/sda1 * 2048 2099199 1048576 83 Linux
/ dev/sda2 2099200 136333311 67117056 8e Linux LVM
Disk / dev/mapper/centos-root: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk / dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk / dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
2) create a 2G partition
[root@centos7 ~] # fdisk / dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xfbaa7750.
Command (m for help): n
Partition type:
P primary (0 primary, 0 extended, 4 free)
E extended
Select (default p): P
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048):
Using default value 2048
Last sector, + sectors or + size {KMagne Mpeng} (2048-104857599, default 104857599): + 2G
Partition 1 of type Linux and of size 2 GiB is set
Command (m for help): W
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
3) create a partition and mount it as required
[root@centos7] # mke2fs-t ext4-b 2048-L 'TEST'-M1 / dev/sdb1
[root@centos7 ~] # echo "/ dev/sdb1 / test ext4 acl 0" > > / etc/fstab
[root@centos7 ~] # mkdir / test
[root@centos7] # mount-a
4. Create a 20G VG; named testvg consisting of at least two PV requires that the PE size be 16MB, and then create a 5G logical volume testlv; in the volume group and mount it to the / users directory 1) create two 10G partitions
[root@centos7 ~] # fdisk / dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): P
Disk / dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfbaa7750
Device Boot Start End Blocks Id System
/ dev/sdb1 2048 4196351 2097152 83 Linux
Command (m for help): n
Partition type:
P primary (1 primary, 0 extended, 3 free)
E extended
Select (default p): P
Partition number (2-4, default 2):
First sector (4196352-104857599, default 4196352):
Using default value 4196352
Last sector, + sectors or + size {KMagne Mpeng} (4196352-104857599, default 104857599): + 10G
Partition 2 of type Linux and of size 10 GiB is set
Command (m for help): P
Disk / dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfbaa7750
Device Boot Start End Blocks Id System
/ dev/sdb1 2048 4196351 2097152 83 Linux
/ dev/sdb2 4196352 25167871 10485760 83 Linux
Command (m for help): n
Partition type:
P primary (2 primary, 0 extended, 2 free)
E extended
Select (default p): P
Partition number (3pr 4, default 3):
First sector (25167872-104857599, default 25167872):
Using default value 25167872
Last sector, + sectors or + size {KMagne Mpeng} (25167872-104857599, default 104857599): + 10G
Partition 3 of type Linux and of size 10 GiB is set
Command (m for help): P
Disk / dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfbaa7750
Device Boot Start End Blocks Id System
/ dev/sdb1 2048 4196351 2097152 83 Linux
/ dev/sdb2 4196352 25167871 10485760 83 Linux
/ dev/sdb3 25167872 46139391 10485760 83 Linux
Command (m for help): W
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
[root@centos7 ~] #
2) create a pv
[root@centos7 ~] # pvcreate / dev/sdb2 / dev/sdb3
Physical volume "/ dev/sdb2" successfully created.
Physical volume "/ dev/sdb3" successfully created.
[root@centos7 ~] #
3) create a logical volume group
[root@centos7 ~] # vgcreate-s 16MB testvg / dev/sdb2 / dev/sdb3
Volume group "testvg" successfully created
[root@centos7 ~] # vgdisplay testvg
-Volume group
VG Name testvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size