创建yum仓库与逻辑磁盘分区
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创建yum仓库与逻辑磁盘分区相关的知识,希望对你有一定的参考价值。
一、自建yum仓库,分别为网络源和本地源。
网络源:
1、首先创建yum仓库:
[centos@localhost ~]$ yum install createrepo
2、将原来的yum网络源禁用。
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
3、编辑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
本地源:
1、挂载光盘镜像到本地。
[centos@localhost ~]$ mount -r /dev/cdrom /home/os
2、修改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、禁用网络yum源
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Media.repo.Bak
二、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
1、检查是否已安装httpd2.4
[root@nihao ~]# rpm -qa | grep httpd
2、安装开发工具
[root@nihao ~]# yum groupinstall ‘Development Tools‘
3、下载httpd2.4安装包
网址链接:https://httpd.apache.org/download.cgi
4、解压至本地
[root@nihao sources]# tar xvf httpd-2.4.43.tar.gz
5、下载apr包并安装
[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、下载apr-util包并安装
[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、下载pcre包
网址链接:https://ftp.pcre.org/pub/pcre/
8、安装pcre包
[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、安装http2.4
注意:安装过程中出现:
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;
解决:安装apr-util1.4.1版本以上的,我安装了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、启动httpd服务,验证安装成功
[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]# curl http://localhost:80
<html><body><h1>It works!</h1></body></html>
三、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统?ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
1、创建2G的文件系统分区
[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、设置块大小为2048byte,预留1%可用空间,文件系统?ext4,卷标为TEST
[root@localhost ~]# mke2fs -t ext4 -L ‘TEST‘ -m 1 -b 2048 /dev/sdb1
3、开机后自动挂载至/test目录,且默认有acl挂载选项
[root@localhost etc]# cat /etc/fstab
UUID=TEST /home/other ext4 defaults,acl 0 0
四、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小?为16MB,?而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
1、创建两个PV组成的大小为20G的名为testvg的VG要求PE大小?为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、创建大小为5G的逻辑卷testlv;挂载至/users目录
[root@localhost ~]# lvcreate -L 5G -n testlv testvg
[root@localhost testvg]# mount /dev/testvg/testlv /users/
以上是关于创建yum仓库与逻辑磁盘分区的主要内容,如果未能解决你的问题,请参考以下文章