1拭抬、自建yum倉庫,分別為網(wǎng)絡(luò)源和本地源
一耻涛、本地源
[root@centos7 /etc/yum.repos.d]#systemctl start autofs
[root@centos7 /etc/yum.repos.d]#systemctl enabled autofs
[root@centos7 /etc/yum.repos.d]#mkdir /etc/yum.repos.d/bak
[root@centos7 /etc/yum.repos.d]#mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
[root@centos7 /etc/yum.repos.d]#vim /etc/yum.repos.d/base.repo
name=cdrom repo
baseurl=file:///misc/cd
gpgcheck=1
gpgkey=file:///misc/cd/RPM-GPG-KEY-CentOS-7
[epel]
name=EPEL
baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch
gpgcheck=0
enabled=0??
[root@centos7 /etc/yum.repos.d]#yum clean all
[root@centos7 /etc/yum.repos.d]#yum repolist all
二醇王、網(wǎng)絡(luò)源
[root@centos7 /etc/yum.repos.d]#systemctl stop firewalld
[root@centos7 /etc/yum.repos.d]#systemctl disable
服務(wù)器配置
[root@centos7 /etc/yum.repos.d]#yum install httpd -y
[root@centos7 /etc/yum.repos.d]#cd /var/www/html/
[root@centos7 /var/www/html]#mkdir -pv centos/{6,7}/os/x86_64/
[root@centos7 /data]#mount -o loop /data/CentOS-6.9-x86_64-bin-DVD1.iso /var/www/html/centos/6/os/x86_64/
[root@centos7 /var/www/html]#mount /dev/sr0 centos/7/os/x86_64/
客戶端配置
[root@centos6 /etc/yum.repos.d]#vim test.repo
[test]
name=base yum
baseurl=http://192.168.17.140/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://192.168.17.140/centos/$releasever/os/$basearch/RPM-GPG-KEY-CentOS-$releasever
[root@centos6 /etc/yum.repos.d]#yum clean all
[root@centos6 /etc/yum.repos.d]#yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
test? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 4.0 kB? ? 00:00? ?
test/primary_db? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | 4.7 MB? ? 00:00? ?
repo id? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? repo name? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? status
test? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base yum? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 6,706
repolist: 6,706
2、編譯安裝http2.4班缎,實(shí)現(xiàn)可以正常訪問,并將編譯步驟和結(jié)果提交她渴。
[root@centos7 /app/httpd24]#yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel -y
[root@centos7 /app/httpd24]#./configure \
--prefix=/apps/httpd24 \
--enable-ssl? \
--enable-so
[root@centos7 /app/httpd24]#make
[root@centos7 /app/httpd24]#make?install
[root@centos7 /app/httpd24]#./bin/apchectl start
3达址、創(chuàng)建一個2G的文件系統(tǒng),塊大小為2048byte趁耗,預(yù)留1%可用空間,文件系統(tǒng)?ext4沉唠,卷標(biāo)為TEST,要求此分區(qū)開機(jī)后自動掛載至/test目錄对粪,且默認(rèn)有acl掛載選項(xiàng)右冻。
[root@centos6 ~]#fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
? ? ? ? switch off the mode (command 'c') and change display units to
? ? ? ? sectors (command 'u').
Command (m for help): n^H^H
Command action
? e? extended
? p? primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +2G
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos6 ~]#mkfs.ext4 -b 2048 -L TEST -m 1 /dev/sdb
sdb? sdb1?
[root@centos6 ~]#mkfs.ext4 -b 2048 -L TEST -m 1 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131560 inodes, 1052240 blocks
10522 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=538968064
65 block groups
16384 blocks per group, 16384 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816
Writing inode tables: done? ? ? ? ? ? ? ? ? ? ? ? ? ?
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.? Use tune2fs -c or -i to override.
[root@centos6 ~]#blkid /dev/sdb1
/dev/sdb1: LABEL="TEST" UUID="90b033ca-347b-4e1c-8d7c-79f4c45f4484" TYPE="ext4"
[root@centos6 ~]#mkdir /test
[root@centos6 ~]#vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Nov 16 15:52:40 2019
#
# 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=ba1dfc35-a669-463f-8a6a-30d495c12066 /? ? ? ? ? ? ? ? ? ? ? ext4? ? defaults? ? ? ? 1 1
UUID=bfd5b98b-cf6b-41b2-a3fb-da248364dfbb /boot? ? ? ? ? ? ? ? ? ext4? ? defaults? ? ? ? 1 2
UUID=0fafe696-f947-4529-add7-b7e58817125c /data? ? ? ? ? ? ? ? ? ext4? ? defaults? ? ? ? 1 2
UUID=2ebf3929-5fd6-4033-a1fd-5b3aca7a74a6 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
UUID=90b033ca-347b-4e1c-8d7c-79f4c45f4484 /test? ? ? ? ? ? ? ? ? ext4? ? acl? ? ? ? ? ? 1 2
[root@centos6 ~]#lsblk
NAME? MAJ:MIN RM? SIZE RO TYPE MOUNTPOINT
sda? ? ? 8:0? ? 0? 200G? 0 disk
├─sda1? 8:1? ? 0? ? 1G? 0 part /boot
├─sda2? 8:2? ? 0 97.7G? 0 part /
├─sda3? 8:3? ? 0 48.8G? 0 part /data
├─sda4? 8:4? ? 0? ? 1K? 0 part
├─sda5? 8:5? ? 0? ? 2G? 0 part [SWAP]
└─sda6? 8:6? ? 0? ? 2G? 0 part
sdb? ? ? 8:16? 0? 20G? 0 disk
└─sdb1? 8:17? 0? ? 2G? 0 part /test
sr0? ? 11:0? ? 1? 3.7G? 0 rom?
[root@centos6 ~]#mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sda3 on /data type ext4 (rw)
/dev/sdb1 on /test type ext4 (rw,acl)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
4、創(chuàng)建一個至少有兩個PV組成的大小為20G的名為testvg的VG;要求PE大小?為16MB,?而后在卷組中創(chuàng)建大小為5G的邏輯卷testlv;掛載至/users目錄
[root@centos7 ~]#fdisk /dev/sdb? ? ? ? ? ? ? ? ?#劃分一10G大小的分區(qū)著拭,需修改ID(8e)纱扭,同時增加一個10G大小的磁盤
root@centos7 ~]#lsblk
NAME???MAJ:MIN RM??SIZE RO TYPE MOUNTPOINT
sda??????8:0????0??200G??0 disk
├─sda1???8:1????0????1G??0 part /boot
├─sda2???8:2????0??100G??0 part /
├─sda3???8:3????0???50G??0 part /data
├─sda4???8:4????0????1K??0 part
└─sda5???8:5????0????4G??0 part [SWAP]
sdb??????8:16???0??200G??0 disk
├─sdb1???8:17???0????4G??0 part [SWAP]
├─sdb2???8:18???0???20G??0 part /home
└─sdb3???8:19???0???10G??0 part
sdc??????8:32???0???10G??0 disk
sr0?????11:0????1??3.7G??0 rom??/run/media/chen/CentOS_6.9_Final
sr1?????11:1????1??4.4G??0 rom??/run/media/chen/CentOS 7 x86_64
[root@centos7 ~]#pvcreate /dev/sd{b3,c}? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#創(chuàng)建物理卷設(shè)備pv
??Physical volume "/dev/sdb3" successfully created.
??Physical volume "/dev/sdc" successfully created.
[root@centos7 ~]#pvs
??PV?????????VG Fmt??Attr PSize??PFree
??/dev/sdb3?????lvm2 ---??10.00g 10.00g
??/dev/sdc??????lvm2 ---??10.00g 10.00g
[root@centos7 ~]#vgcreate??testvg /dev/sd{b3,c} -s 16M? ? ? ?#創(chuàng)建物理卷組vg,-s是指定大小
??Volume group "testvg" successfully created
[root@centos7 ~]#vgdisplay
[root@centos7 ~]#lvcreate -n testlv testvg -L 5G? ? ? ? ? ? ? ? ? ?#創(chuàng)建名字為testlv名字的邏輯卷儡遮,從卷組名為testvg的卷組中取大小
[root@centos7 ~]#mkfs.xfs /dev/testvg/testlv? ? ? ? ? ? ? ? ? ? ? ? ? ?#創(chuàng)建文件系統(tǒng)
meta-data=/dev/testvg/testlv? ? isize=512? ? agcount=4, agsize=327680 blks
? ? ? ? =? ? ? ? ? ? ? ? ? ? ? sectsz=512? attr=2, projid32bit=1
? ? ? ? =? ? ? ? ? ? ? ? ? ? ? crc=1? ? ? ? finobt=0, sparse=0
data? ? =? ? ? ? ? ? ? ? ? ? ? bsize=4096? blocks=1310720, imaxpct=25
? ? ? ? =? ? ? ? ? ? ? ? ? ? ? sunit=0? ? ? swidth=0 blks
naming? =version 2? ? ? ? ? ? ? bsize=4096? ascii-ci=0 ftype=1
log? ? ? =internal log? ? ? ? ? bsize=4096? blocks=2560, version=2
? ? ? ? =? ? ? ? ? ? ? ? ? ? ? sectsz=512? sunit=0 blks, lazy-count=1
realtime =none? ? ? ? ? ? ? ? ? extsz=4096? blocks=0, rtextents=0
[root@centos7 ~]#blkid
/dev/sda2: UUID="dc77c4ea-c483-4a79-9f71-6ef54514d36d" TYPE="xfs"
/dev/sda1: UUID="0f96f938-6ed7-438c-b8b2-bca89880f409" TYPE="xfs"
/dev/sda3: UUID="ec2d2c3f-9382-4ebe-894d-72e34866bfea" TYPE="xfs"
/dev/sda5: UUID="3912dc4c-f135-482c-a2a3-fb425bc885ca" TYPE="swap"
/dev/sr0: UUID="2017-03-28-13-24-36-00" LABEL="CentOS_6.9_Final" TYPE="iso9660" PTTYPE="dos"
/dev/sdb1: UUID="24b5f3fc-d882-46b6-b827-f613a6c2a6e3" TYPE="swap"
/dev/sdb2: UUID="328dc3ec-f221-4533-945b-2751168b6204" TYPE="xfs"
/dev/sr1: UUID="2019-09-11-18-50-31-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sdb3: UUID="so7tOF-K1Br-RTKg-3Vu5-t4yc-Xr4t-YuWCvE" TYPE="LVM2_member"
/dev/sdc: UUID="OQsST7-5lj8-Anzp-LPFC-yf7D-2DX5-jPHR8N" TYPE="LVM2_member"
/dev/mapper/testvg-testlv: UUID="e16179d9-1a59-40a9-99e9-493cc255f9df" TYPE="xfs"
[root@centos7 ~]#mkdir /users
[root@centos7 ~]#mount /dev/testvg/testlv? /users/? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 臨時掛載
[root@centos7 ~]#vim /etc/fstab? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?永久掛載
# /etc/fstab
# Created by anaconda on Sat Nov 16 15:29:21 2019
#
# 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=dc77c4ea-c483-4a79-9f71-6ef54514d36d /? ? ? ? ? ? ? ? ? ? ? xfs? ? defaults? ? ? ? 0 0
UUID=0f96f938-6ed7-438c-b8b2-bca89880f409 /boot? ? ? ? ? ? ? ? ? xfs? ? defaults? ? ? ? 0 0
UUID=ec2d2c3f-9382-4ebe-894d-72e34866bfea /data? ? ? ? ? ? ? ? ? xfs? ? defaults? ? ? ? 0 0
UUID=3912dc4c-f135-482c-a2a3-fb425bc885ca swap? ? ? ? ? ? ? ? ? ? swap? ? defaults? ? ? ? 0 0
UUID=24b5f3fc-d882-46b6-b827-f613a6c2a6e3 swap? ? ? ? ? ? ? ? ? ? swap? ? defaults? ? ? ? 0 0
/swapfile? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? swap? ? ? ? ? ? ? ? ? ? swap? ? defaults? ? ? ? 0 0
UUID=328dc3ec-f221-4533-945b-2751168b6204 /home? ? ? ? ? ? ? ? ? xfs? ? defaults? ? ? ? 0 0
UUID=e16179d9-1a59-40a9-99e9-493cc255f9df /users? ? ? ? ? ? ? ? ? xfs? ? defaults? ? ? ? 0 0
[root@centos7 ~]#df -h
Filesystem? ? ? ? ? ? ? ? Size? Used Avail Use% Mounted on
devtmpfs? ? ? ? ? ? ? ? ? 895M? ? 0? 895M? 0% /dev
tmpfs? ? ? ? ? ? ? ? ? ? ? 910M? ? 0? 910M? 0% /dev/shm
tmpfs? ? ? ? ? ? ? ? ? ? ? 910M? 11M? 900M? 2% /run
tmpfs? ? ? ? ? ? ? ? ? ? ? 910M? ? 0? 910M? 0% /sys/fs/cgroup
/dev/sda2? ? ? ? ? ? ? ? ? 100G? 6.3G? 94G? 7% /
/dev/sda3? ? ? ? ? ? ? ? ? 50G? 4.4G? 46G? 9% /data
/dev/sda1? ? ? ? ? ? ? ? 1014M? 179M? 836M? 18% /boot
tmpfs? ? ? ? ? ? ? ? ? ? ? 182M? 8.0K? 182M? 1% /run/user/42
/dev/sdb2? ? ? ? ? ? ? ? ? 20G? 40M? 20G? 1% /home
tmpfs? ? ? ? ? ? ? ? ? ? ? 182M? ? 0? 182M? 0% /run/user/0
tmpfs? ? ? ? ? ? ? ? ? ? ? 182M? 32K? 182M? 1% /run/user/1000
/dev/sr1? ? ? ? ? ? ? ? ? 4.4G? 4.4G? ? 0 100% /run/media/chen/CentOS 7 x86_64
/dev/sr0? ? ? ? ? ? ? ? ? 3.7G? 3.7G? ? 0 100% /run/media/chen/CentOS_6.9_Final
/dev/mapper/testvg-testlv? 5.0G? 33M? 5.0G? 1% /users