Create a yum warehouse and logical disk partition

1. Build your own yum warehouse, which is network source and local source respectively.
Network Source:
1. First create a yum warehouse:

[centos@localhost ~]$ yum install createrepo

2. Disable the original yum network source.

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

3. Edit CentOS-Base.repo

[base]
name=Base Repo on mirrors.bjtu.edu.cn
baseurl=http://mirror.bjtu.edu.cn/centos/$releasever/os/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[updates]
name=Base Repo on mirrors.bjtu.edu.cn
baseurl=http://mirror.bjtu.edu.cn/centos/$releasever/updates/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[extras]
name=Base Repo on mirrors.bjtu.edu.cn
baseurl=http://mirror.bjtu.edu.cn/centos/$releasever/extras/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[centosplus]
name=Base Repo on mirrors.bjtu.edu.cn
baseurl=http://mirror.bjtu.edu.cn/centos/$releasever/centosplus/$basearch
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Local source:
1. Mount the disc and mirror it locally.

[centos@localhost ~]$ mount -r /dev/cdrom /home/os

2. Modify CentOS-Media.repo

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///home/os/
        file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3. Disable network yum source

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Media.repo.Bak

2. Compile and install http2.4 for normal access and submit compilation steps and results.
1. Check if httpd2.4 is installed

[root@nihao ~]# rpm -qa | grep httpd

2. Install development tools

[root@nihao ~]# yum groupinstall 'Development Tools'

3. Download the httpd2.4 installation package
Web site link: https://httpd.apache.org/download.cgi
4. Unzip to Local

[root@nihao sources]# tar xvf httpd-2.4.43.tar.gz 

5. Download and install the apr package

[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
[root@localhost download]# tar -xvf ./apr-1.7.0.tar.gz 
[root@localhost ~]# ./configure prefix=/usr/local/apr
[root@localhost download]# make && make install

6. Download and install the apr-util package
[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-util-1.3.4.tar.gz
[root@localhost download]# tar -xvf ./apr-util-1.3.4.tar.gz
[root@localhost ~]# ./configure prefix=/usr/local/apr --with-apr=/usr/local/apr/bin
[root@localhost download]# make && make install
7. Download the pcre package
Web site link: https://ftp.pcre.org/pub/pcre/
8. Install the pcre package

[root@localhost download]# unzip pcre2-10.35.zip 
[root@localhost pcre2-10.35]# ./configure prefix=/usr/local/pcre
[root@localhost pcre2-10.35]# make && make install

9. Install http2.4
Note: During installation:

exports.c:2436:13: error: redefinition of 'ap_hack_apr_xml_quote_elem'
 const void *ap_hack_apr_xml_quote_elem = (const void *)apr_xml_quote_elem;
             ^
exports.c:2048:13: note: previous definition of 'ap_hack_apr_xml_quote_elem' was here
 const void *ap_hack_apr_xml_quote_elem = (const void *)apr_xml_quote_elem;
             ^
exports.c:2437:13: error: redefinition of 'ap_hack_apr_xml_insert_uri'
 const void *ap_hack_apr_xml_insert_uri = (const void *)apr_xml_insert_uri;
             ^
exports.c:2049:13: note: previous definition of 'ap_hack_apr_xml_insert_uri' was here
 const void *ap_hack_apr_xml_insert_uri = (const void *)apr_xml_insert_uri;
             ^
exports.c:2446:13: error: redefinition of 'ap_hack_apu_version'
 const void *ap_hack_apu_version = (const void *)apu_version;
             ^
exports.c:2058:13: note: previous definition of 'ap_hack_apu_version' was here
 const void *ap_hack_apu_version = (const void *)apu_version;
             ^
exports.c:2447:13: error: redefinition of 'ap_hack_apu_version_string'
 const void *ap_hack_apu_version_string = (const void *)apu_version_string;

Solution: Installing apr-util1.4.1 or above caused an error when I installed apr-util1.3.4.

[root@localhost httpd-2.4.43]# ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr-util=/usr/local/apr-util 
[root@localhost httpd-2.4.43]# make && make install

10. Start the httpd service to verify successful installation

[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]# curl http://localhost:80
<html><body><h1>It works!</h1></body></html>

3. Create a 2G file system with a block size of 2048byte, 1% free space reserved, file system ext4, volume labeled TEST, which requires that this partition be automatically mounted to the / test directory after booting up, and has the acl mount option by default
1. Create a 2G file system partition

[root@localhost ~]# fdisk /dev/sdb 
Command (m for help): n
Select (default p): p
First sector (4196352-20971519, default 4196352): 
Using default value 4196352
Last sector, +sectors or +size{K,M,G} (4196352-20971519, default 20971519): +20G

2. Set block size to 2048 byte, reserve 1% free space, file system ext4, volume labeled TEST

[root@localhost ~]# mke2fs -t ext4 -L 'TEST' -m 1 -b 2048 /dev/sdb1

3. Automatically mount to / test directory after boot-up, with acl mount option by default

[root@localhost etc]# cat /etc/fstab
UUID=TEST  /home/other             ext4    defaults,acl    0 0

4. Create a 20G VG named testvg with at least two PV s; require a PE size of 16MB, and then create a 5G logical volume testlv in the volume group; mount in the / users directory
1. Creating a 20G VG named testvg with two PV s requires a PE size of 16MB

[root@localhost ~]# pvcreate /dev/sdc1 /dev/sdc2
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdc2" successfully created.
[root@localhost ~]# vgcreate --physicalextentsize 16M testvg /dev/sdc1 /dev/sdc2
  Volume group "testvg" successfully created

2. Create a 5G logical volume testlv; mount to / users directory

[root@localhost ~]# lvcreate -L 5G -n testlv testvg
[root@localhost testvg]# mount /dev/testvg/testlv /users/

Tags: Linux CentOS RPM yum Apache

Posted on Tue, 16 Jun 2020 18:20:31 -0400 by joshberm