Deploy YUM warehouse and NFS shared services

Posted by Imperialdata on Fri, 18 Feb 2022 02:32:24 +0100

YUM(yellow dog updater modified)

1. Software update mechanism based on RPM package

2. Dependency can be solved automatically

3. All software packages are provided by the centralized YUM software warehouse

Prepare for installation

How to provide software warehouse

1. FTP service: FTP: / /

2. HTTP service: http: / /

3. Local directory: file: / /

Source of RPM package

1. Collection of RPM packages released by centos

2. Collection of RPM packages released by third-party organizations

3. User defined RPM package set

Building CentOS 7 software warehouse

1. RPM package comes from DVD disc

2. Provide it to the client through FTP

Add unofficial RPM packages to the software warehouse

1, including all RPM packages with dependencies

1. Use the createrepo tool to create a warehouse data file

Access YUM warehouse

Specify the YUM warehouse location for the client

Configuration file: / etc / yum.com repos. D / name repo

[base]                                     Identification name
name=CentOS 7.3                            name
baseurl=ftp://192.168.4.254/centos7 package path
enabled=1                                  Enable
gpgcheck=1                                 Do you want to check the key
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


[other]
name=Other RPM Packages
baseurl=ftp://192.168.4.254/other
enabled=1
gpgcheck=0 

Using centos 7 CD as software warehouse directly

Put the centos 7 disc into the CD-ROM drive

Mount the image to the warehouse location. The URL address is file: / / / media/cdrom

[local]
name=CnetOS 7.3	
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0

Configuration file for YUM

1. Basic settings: / etc / yum conf

2. Warehouse settings: / etc / yum repos. d/*. repo

3. Log file: / var / log / yum kog

Software installation, upgrade, uninstall

install

yum install  [Software name]
yum groupinstall  <Package group name>

Upgrade software

yum updatea
yum groupupdate

uninstall

yum remove <Software name>
yum groupremove <Package group name>

NFS shared storage service

NFS (network file system)

1. RPC dependent (remote procedure call)

2. Install NFS utiles Rpcbind package

3. System service: nfs, rpcbind

4. Shared configuration file: / etc/exports

Publishing shared resources using NFS

Install NFS utils, rpcbind

[root@localhost ~]# yum -y install nfs-utils rpcbind
[root@localhost ~]# systemctl enable nfs
[root@localhost ~]# systemctl enable rpcbind

Set shared directory

[root@localhost ~]# mkdir -p /opt/wwwroot
[root@localhost ~]# vi /etc/exports
/opt/wwwroot    192.168.7.0/24(rw,sync,no_root_squash)
/var/ftp/pub    192.168.4.11(ro) 192.168.4.110(rw)

Enable services for NFS

[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs

Accessing NFS shared resources in clients

Install the rpcbind package and start the rpcbind service

[root@localhost ~]# yum -y install rpcbind nfs-utils
[root@localhost ~]# systemctl enable rpcbind
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# showmount -e 192.168.7.250
Export list for 192.168.7.250:
/opt/wwwroot 192.168.7.0/24
/var/ftp/pub 192.168.4.110,192.168.4.11

Manually mount NFS shared directory

 mount 192.168.7.250:/opt/wwwroot /var/www/html

fstab auto mount settings

[root@localhost ~]# vi /etc/fstab
...... //Omit some information
192.168.7.250:/opt/wwwroot /var/www/html nfs  defaults,_netdev 0 0

Force NFS unmount

[root@localhost ~]# umount /mnt
umount: /mnt: device is busy 
[root@localhost ~]# umount -lf /mnt
[root@localhost ~]# 

experiment

Experimental environment: two CentOS 7

Turn off the firewall

Client configuration IP address

vim /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.152.100
NETMASK=255.255.255.0
GATEWAY=192.168.152.2

Server configuration IP

vim /etc/sysconfig/network-scripts/ifcfg-ens33 

TYPE=Ethernet
BOOTPROTO=static
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.152.110
NETMASK=255.255.255.0
GATEWAY=192.168.152.2
DNS=202.96.134.133

Configure yum source

mkdir /backup/
mkdir: Unable to create directory"/backup/": file already exist

ls /etc/yum.repos.d/
local.repo

vim /etc/yum.repos.d/local.repo

 [local]
name=local
enabled=1
baseurl=file:///mnt
gpgcheck=0

Mount the CD and download vsftpd

mount /dev/cdrom /mnt

yum -y install vsftpd

Copy the file to ftp

cp -rd /mnt/* /var/ftp/centos7

ls
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

Start vsftpd service

 systemctl start vsftpd
netstat -nultp|grep vsftpd
tcp6       0      0 :::21                   :::*                    LISTEN      82866/vsftpd        

Go back to the client and configure the yum source

vim /etc/yum.repos.d/local.repo

[local]
name=local
enabled=1
baseurl=file:///mnt
gpgcheck=0

[ftp]
name=ftp
enabled=1
baseurl=ftp://192.168.152.110/centos7
gpgcheck=0

Check whether the

Manage installation using yum or up2date

yum -y install httpd

Realize automatic mounting of CD

vim /etc/fstab

/dev/cdrom     /mnt     iso9660    defaults    0 0

Restart for testing

Experiment completed

Topics: Linux CentOS server