In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
YUM Overview YUM
Software update mechanism based on RPM package construction
Dependencies can be resolved automatically
All software packages are provided by a centralized YUM software repository
The way the software repository is provided
FTP service: ftp://...
HTTP service: http://...
Local directory: file://...
The source of RPM software package
Collection of RPM packages released by CentOS
A collection of RPM packages released by third-party organizations
User-defined collection of RPM packages
Building CentOS 7 Software Repository
The RPM package is from CentOS 7 CD.
Provided to the client through FTP, HTTP, or local directory
FTP service name: vsftpd
FTP site: / var/ftp/centos7
Join the unofficial RPM package group in the software repository
Includes all RPM packages that have dependencies
Using createrepo tool to build warehouse data file
Check YUM package yum info [software name] view service information yum list [software name] check yum warehouse yum search to find whether there is software update YUM package yum update update package, update software and system kernel yun upgrade update package, only update software Demo to build a remote YUM repository
1. Open two CentOS 7 virtual machines in VMware 15, one as a server to build a local YUM repository and FTP service, and one as a client to use server remote services. The server is renamed demo01 and the client is renamed demo02.
[root@localhost ~] # hostnamectl set-hostname demo01 [root@localhost ~] # su [root@demo01] # [root@localhost ~] # hostnamectl set-hostname demo02 [root@localhost ~] # su [root@demo02 ~] #
2. Mount the CentOS 7 image file to the mnt directory in demo01
[root@demo01 ~] # df-hT / / View disk information See whether the image file is added to the optical drive file system type capacity available mount point / dev/sda2 xfs 20G 3.3G 17G 17% / devtmpfs devtmpfs 898M 0898m 0% / devtmpfs tmpfs 912m 0912m 0% / dev/shmtmpfs tmpfs 912m 9.0M 903M 1% / runtmpfs Tmpfs 912M 0912M 0% / sys/fs/cgroup/dev/sda5 xfs 10G 37M 10G 1% / home/dev/sda1 xfs 6.0G 174M 5.9G 3% / boottmpfs tmpfs 183M 12K 183M 1% / run/user/42tmpfs tmpfs 183M 24K 183M 1% / run/user/0/dev/sr0 iso9660 4.3G 4.3G 0100% / run/media/root/CentOS 7 x86room64 / / read the image file [root@demo01 ~] # mount / dev/sr0 / mnt / / Mount the image file to the mnt directory mount: / dev/sr0 write protection [root@demo01 ~] # ls / mnt / / CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL will be mounted read-only
3. Install the FTP service in demo01 and often see whether the FTP site is created successfully.
[root@demo01 ~] # yum install vsftpd-y loaded plug-in: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.zju.edu.cn * extras: mirrors.zju.edu.cn * updates: mirrors.zju.edu.cn is resolving dependencies-> checking transactions-- > package vsftpd.x86_64.0.3.0.2-25.el7 will be installed. / / omit some of the contents. In the process of installation: vsftpd-3.0.2-25.el7.x86_64 1amp 1 verification: vsftpd-3.0.2-25.el7.x86_64 1Action1 has been installed: vsftpd.x86_64 0pur3.0.2-25.el7 Over! [root@demo01 ~] # ls / var / / View directory information account cache db ftp gopher lib lock mail opt run target ypadm crash empty games kerberos local log nis preserve spool tmp / / successfully create a FTP site
4. First, create a directory in the FTP site as the source point of the YUM repository, and copy the mounted image files to the YUM repository source directory, then create a directory and use the createrepo tool to create an extended directory.
[root@demo01 ~] # cd / var/ftp / / enter the FTP site directory [root@demo01 ftp] # ls / / View directory information pub [root@demo01 ftp] # mkdir centos7 / / create a directory As the YUM warehouse source point [root@demo01 ftp] # ls / / check whether the centos7 pub [root@demo01 ftp] # cp-rf / mnt/* centos7/& / / has been created successfully. Copy all the mounted image files into the YUM warehouse source directory, and execute [1] 2997 [root@demo01 ftp] # mkdir other / / create the directory in the background. As an extension directory [root@demo01 ftp] # ls / / check whether the centos7 other pub [root@demo01 ftp] # createrepo-g / mnt/repodata/repomd.xml other/ is created successfully using createrepo to create an extended data file Saving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete [1] + complete Cp-I-rf / mnt/* centos7/ copy image file task completed [root@demo01 ftp] # ls centos7/ check whether the file has been successfully copied into the directory CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL [ Root@demo01 ftp] # cd other/repodata/ enter the extended data file directory [root@demo01 repodata] # ls / / to check whether the data file has successfully created 01a3b489a465bcac22a43492163df43451dc6ce47d27f66de289756b91635523-filelists.sqlite.bz2401dc19bda88c82c403423fb835844d64345f7e95f5b9835888189c03834cc93-filelists.xml.gz5dc1e6e73c84803f059bb3065e684e56adfc289a7e398946574d79dac6643945-primary.sqlite.bz25f62201963ee83e178738d9f88078560377cc06f972a4c0094ab3be00cae515f-repomd.xml6bf9672d0862e8ef8b8ff05a2fd0208a922b1f5978e6589d87944c88259cb670-other.xml.gz7c36572015e075add2b38b900837bcdbb8a504130ddff49b2351a7fc0affa3d4-other.sqlite.bz2c48538ac0f65ece36eb71d41b76f1eb1f98c58cc26777348490feaed8f38ab56-repomd.xml.gzdabe2ce5481d23de1f4f52bdcfee0f9af98316c9e0de2ce8123adeefa0dd08b9-primary.xml.gzrepomd.xml
5. Enable the FTP service, check whether the port is opened successfully, and then turn off the firewall and enhanced security features to facilitate client access to the server.
[root@demo01 repodata] # cd ~ / / return to the home directory [root@demo01 ~] # systemctl start vsftpd / / enable the FTP service [root@demo01 ~] # netstat-ntap | grep 21 / / check whether port 21 is enabled or not tcp 0 0127.0.0.1 root@demo01 6010 0.0.0.0 LISTEN 1621/sshd: root@pts tcp 0 192.168.144.133 ESTABLISHED 1621/sshd 22 192.168.144.1 ESTABLISHED 1621/sshd: tcp6 0 0: 21: * LISTEN 3183/vsftpd / / successfully opened tcp6 0 0:: 1 LISTEN 1621/sshd: root@pts [root@demo01 ~] # systemctl stop firewalld.service / / turn off firewall function [root@demo01 ~] # setenforce 0 / / turn off enhanced security feature
6. Install the FTP tool in the client demo02 and use the FTP tool to access the server FTP site.
[root@demo02 ~] # yum install ftp-y / / install FTP tool loaded plug-in: fastestmirror Langpacksbase | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1amp 4): base/7/x86_64/group_gz | 166kB 00:00:25. / / omit some contents. In the process of installation: ftp-0.17-67.el7.x86_64 1amp 1 verification: ftp-0.17-67.el7.x86_64 1Action1 has been installed: ftp.x86_64 0pur0.17-67.el7 Over! [root@demo02 ~] # ftp 192.168.144.133 / / visit the server FTP site Connected to 192.168.144.133 (192.168.144.133) .220 (vsFTPd 3.0.2) Name (192.168.144.133:root): ftp / / prompt for a user name Use anonymous users to access 331 Please specify the password.Password: / / prompt for password, anonymous users do not have a password, you can directly enter 230 Login successful.Remote system type is UNIX.Using binary mode to transfer files. / / successfully visit ftp > ls / / View the server FTP site information: 227 Entering Passive Mode (192 Here comes the directory listing.drwxr-xr-x 168, 144, 133, 94209). 150 Here comes the directory listing.drwxr-xr-x 8 00 220 Sep 17 09:00 centos7 / / the established YUM source directory drwxr-xr-x 3 00 22 Sep 17 09:00 other / / extended data information drwxr-xr-x 20 06 Oct 30 2018 pub226 Directory send OK.ftp > bye / / exit access to 221 Goodbye.
7. Enter the local YUM directory in the client, create a new directory in the directory, move the files in the source directory to the new directory, and then clear the YUM cache to test whether you can use YUM to install the software at this time.
[root@demo02 ~] # cd / etc/yum.repos.d/ enter the local yum warehouse [root@demo02 yum.repos.d] # ls / / View CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repoCentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [root@demo02 yum.repos.d] # mkdir bak / / Create a new directory [root@demo02 yum.repos.d] # mv * .repo bak/ move all files with the suffix repo to the bak directory [root@demo02 yum.repos.d] # ls / / View directory information bak [root@demo02 yum.repos.d] # ls bak/ View bak directory information CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repoCentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo / / successfully moved to the bak directory [root@demo02 yum.repos.d] # yum clean all / / cleared the yum cache loaded plug-in: fastestmirror LangpacksLoading mirror speeds from cached hostfileThere are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription Management repositories: subscription-manager repos-- enable To enable custom repositories: yum-config-manager-- enable [root@demo02 yum.repos.d] # yum install httpd / / enable installation of http services with yum loaded plug-ins: fastestmirror, langpacksLoading mirror speeds from cached hostfileThere are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription Management repositories: subscription-manager repos-- enable To enable custom repositories: yum-config-manager-- enable / / cannot be installed
8. Recreate the yum configuration file in the client yum repository directory
[root@demo02 yum.repos.d] # vim centos7.repo / / Edit yum configuration file [base] name=centos7.Packagesbaseurl= ftp://192.168.144.133/centos7 / / write yum repository software location enabled=1gpgcheck=1 / / enable key verification gpgkey= ftp://192.168.144.133/centos7/ RPM-GPG-KEY-CentOS-7 / / enter key location [other] name=other.Packagesbaseurl= ftp://192.168.144.133/other / / write yum warehouse extension data file location enabled=1gpgcheck=0~ ~ ~ ~ : wq / / Save and exit after completion
9. Use the yum list command to reload the yum repository software information, and use yum to install the HTTP service to see if the yum repository is recreated.
[root@demo02 yum.repos.d] # yum list / / Reload yum repository loaded plug-ins: fastestmirror, langpacks Loading mirror speeds from cached hostfile...// omitted part of the content. [root@demo02 yum.repos.d] # yum install httpd-y / / install the http service using yum loaded plug-ins: fastestmirror LangpacksLoading mirror speeds from cached hostfile is resolving dependencies-- > checking transactions-> the package httpd.x86_64.0.2.4.6-67.el7.centos will be installed. / / omit some of the contents. Installed: httpd.x86_64 0 3.el7 apr-util.x86_64 2.4.6-67.el7.centos is installed as a dependency: apr.x86_64 0 1. 4. 8-3.el7 apr-util.x86_64 0 1. 2-6.el7 httpd-tools. X8634 0 2.4.6-67.el7.centos mailcap.noarch 0v 2.1.41-2.el7 over! / / successful installation of NFS shared Services Network File System network file system
Dependent on RPC (remote procedure call)
Nsf-utils and rpcbind packages need to be installed.
System Services nfs, rpcbind
Shared profile: / etc/exports
Publish shared resources using NFS
Install nfs-utils and rpcbind software packages
Yum install nfs-utils rpccbind
Systemctl enable nfs
Systemctl enable rpcbind
View service commands
Showmount-e to see if shared services are available
Demo builds NFS service
1. Open two CentOS 7 virtual machines in VMware 15, one as a server and one as a client. The server provides storage space for the client. The server is renamed tast01 and the client is renamed tast02;. Add a disk in the service to provide storage services.
[root@localhost ~] # hostnamectl set-hostname tast01 [root@localhost ~] # su [root@tast01] # [root@localhost ~] # hostnamectl set-hostname tast02 [root@localhost ~] # su [root@tast02 ~] #
2. Partition the newly added disk in the server, format the disk, and then mount the disk settings in the mnt directory automatically.
[root@tast01 ~] # ls / dev/ View the device directory See if you can read the newly added hard disk agpgart hugepages port sr0 tty23 tty42 tty61 vcs5autofs hwrng ppp stderr tty24 tty43 tty62 vcs6block initctl ptmx stdin tty25 tty44 tty63 vcsabsg input pts stdout tty26 tty45 tty7 vcsa1btrfs-control kmsg random tty tty27 Tty46 tty8 vcsa2bus log raw tty0 tty28 tty47 tty9 vcsa3cdrom loop-control rtc tty1 tty29 tty48 ttyS0 vcsa4char lp0 rtc0 tty10 tty3 tty49 ttyS1 vcsa5console lp1 sda tty11 tty30 tty5 ttyS2 vcsa6core lp2 Sda1 tty12 tty31 tty50 ttyS3 vfiocpu lp3 sda2 tty13 tty32 tty51 uhid vga_arbitercpu_dma_latency mapper sda3 tty14 tty33 tty52 uinput vhcicrash mcelog sda4 tty15 tty34 tty53 urandom vhost-netdisk mem sda5 tty16 tty35 tty54 usbmon0 vmcidri mqueue sdb Tty17 tty36 tty55 usbmon1 vsockfb0 net sg0 tty18 tty37 tty56 usbmon2 zerofd network_latency sg1 tty19 tty38 tty57 vcsfull network_throughput sg2 tty2 tty39 tty58 vcs1fuse null shm tty20 tty4 tty59 vcs2hidraw0 nvram snapshot tty21 tty40 tty6 vcs3hpet Oldmem snd tty22 tty41 tty60 vcs4 [root@tast01 ~] # fdisk / dev/sdb / / Welcome to use fdisk (util-linux 2.23.2) to create a disk partition. The changes remain in memory until you decide to write them to disk. Think twice before using the write command. Device does not contain a recognized partition table uses the disk identifier 0xa928f95d to create a new DOS disk label. Command (enter m for help): n Partition type: P primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response p partition number (1-4, default 1): start sector (2048-83886079, default is 2048): the default 2048Last sector will be used, + sector or + size {Kje Magi G} (2048-83886079) Default is 83886079): use the default value of 83886079. Partition 1 has been set to Linux type and the size is set to 40 GiB command (enter m for help): wThe partition table has been altered calling ioctl () to re-read partition table. Synchronizing disks. [root@tast01 ~] # mkfs.xfs / dev/sdb1 / / format disk information meta-data=/dev/sdb1 isize=512 agcount=4, agsize=2621376 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0data = bsize=4096 blocks=10485504 Imaxpct=25 = sunit=0 swidth=0 blksnaming = version 2 bsize=4096 ascii-ci=0 ftype=1log = internal log bsize=4096 blocks=5119, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime = none extsz=4096 blocks=0 Rtextents=0 [root@tast01 ~] # vim / etc/fstab / / enter the edit auto-mount configuration file # # / etc/fstab# Created by anaconda on Sat Aug 10 03:42:29 2019 August # 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=729c9a26-dfdc-40f9-ae91-1ade55be51bb / xfs defaults 0 0UUID=9559d8d9-8f6a-4adb-a41f-02862b167946 / boot xfs defaults 0 0UUID=5ed35562-b598-43e0-8f8a-db788aa06d40 / home xfs defaults 0 0UUID=bcc2cc5c-4f4e-4e1d-b4e1-245cfed5cf9d swap swap Defaults 0 0/dev/sdb1/ / mnt xfs defaults 0 / / sets automatic mount of sdb1 disk ~ ~ ~: wq / / Save exit [root@tast01 ~] # mount-a / / load automatic mount file [root@tast01 ~] # df-h / / View disk information file system capacity available available mount point / dev/sda2 20G 3.3G 17G 17% / devtmpfs 898M 0898M 0 % / devtmpfs 912M 0912M 0% / dev/shmtmpfs 912M 9.0M 903M 1% / runtmpfs 912M 0912M 0% / sys/fs/cgroup/dev/sda5 10G 37M 10G 1% / home/dev/sda1 6.0G 174M 5.9G 3% / boottmpfs 183M 12K 183M 1% / run/user/42tmpfs 183m 0183m 0% / run/user/0/dev/sdb1 40G 33m 40G 1% / mnt / / mount successfully
3. Install the NFS package in the server and set the service to boot automatically.
[root@tast01 ~] # yum install nfs-utlis rpcbind-y / / installation software loaded plug-in: fastestmirror Langpacksbase | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1amp 4): base/7/x86_64/group_gz | 166kB 00:00:25. / / omit some contents. Verifying: rpcbind-0.2.0-47.el7.x86_64 1amp 2 verifying: rpcbind-0.2.0-42.el7.x86_64 2Accord 2 updated: rpcbind.x86_64 0VOUR 0.2.0-47. El7, over! [root@tast01 ~] # systemctl enable nfs / / set boot Created symlink from / etc/systemd/system/multi-user.target.wants/nfs-server.service to / usr/lib/systemd/system/nfs-server.service. [root@tast01 ~] # systemctl enable rpcbind / / set to enable Created symlink from / etc/systemd/system/multi-user.target.wants/rpcbind.service to / usr/lib/systemd/system/rpcbind.service.
4. Edit the NFS service configuration file and start the service to see if the service is enabled; turn off the firewall and enhanced security features; and then use the command to see if the service is provided.
[root@tast01 ~] # vim / etc/exports / / Edit shared service configuration file / mnt 192.168.144.0lap24 (rw,sync,no_root_squash) / / configure shared disk, network segment information that can be used, read and write permissions, synchronization information There is no need to downgrade ~ : wq / / Save exit [root@tast01 ~] # systemctl start nfs / / start service [root@tast01 ~] # systemctl start rpcbind / / start service [root@tast01 ~] # netstat-ntap | grep rpc / / check whether the service starts tcp 00 0.0.0.020048 0.0.0.0: * LISTEN 3774/rpc.mountd tcp 00 0.0.0.0 LISTEN 3774/rpc.mountd tcp6 37286 0.0.0.0 LISTEN 3774/rpc.mountd tcp6 00: 20048:: 52041: * LISTEN 3773/rpc.statd / / successfully start [root@tast01 ~] # systemctl stop firewalld.service / / close the firewall [root@tast01 ~] # setenforce 0 / / turn off the enhanced security function [root@tast01 ~] # showmount-e / / check whether the service is provided with Export list for tast01:/mnt 192.168.144.0 Universe 24 / / successfully.
5. Turn off the firewall function and enhanced security function in the client, because you want to use the client to provide website services to facilitate our access to the website, and then install the http service.
[root@tast02 ~] # systemctl stop firewalld.service [root@tast02 ~] # setenforce 0 [root@tast02 ~] # yum install httpd-y loaded plug-in: fastestmirror LangpacksLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.cn99.com is resolving dependencies-- > checking transactions-- > the package httpd.x86_64.0.2.4.6-89.el7.centos.1 will be installed. / / omit some of the contents. Installed: httpd.x86_64 0 3.el7_4.1 apr-util.x86_64 2.4.6-89.el7.centos.1 is installed as a dependency: apr.x86_64 0 1. 4.8-3.el7_4.1 apr-util.x86_64 0 1. 2-6.el7 httpd-tools .x86 _ 64 0vl 2.4.6-89.el7.centos.1 mailcap.noarch 0vir 2.1.41-2.el7 over!
6. The client http service site uses the disk added in the server to store the website information, and automatically mounts the disk settings added by the server to the http service site in the client.
[root@tast02 ~] # vim / etc/fstab / / Edit auto-mount configuration file # # / etc/fstab# Created by anaconda on Sat Aug 10 03:42:29 2019 August # 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=729c9a26-dfdc-40f9-ae91-1ade55be51bb / xfs defaults 0 0UUID=9559d8d9-8f6a-4adb-a41f-02862b167946 / boot xfs defaults 0 0UUID=5ed35562-b598-43e0-8f8a-db788aa06d40 / home xfs defaults 0 0UUID=bcc2cc5c-4f4e-4e1d-b4e1-245cfed5cf9d swap swap Defaults 0 0192.168.144.133:/mnt / var/www/html nfs defaults _ netdev 0 0 / / add auto mount entry ~ : wq / / Save exit [root@tast02 ~] # mount-a / / reload mount information [root@tast02 ~] # df-hT file system type capacity used available% mount point / dev/ Sda2 xfs 20G 3.4G 17G 17% / devtmpfs devtmpfs 898M 0898M 0% / devtmpfs tmpfs 912M 0912M 0% / dev/shmtmpfs tmpfs 912M 9.0M 903M 1% / runtmpfs tmpfs 912M 0912M 0% / sys/fs/cgroup/dev/sda5 xfs 10G 37M 10G 1% / home/dev/sda1 xfs 6.0G 174M 5.9G 3% / boottmpfs tmpfs 183M 12K 183M 1% / run/user/42tmpfs tmpfs 183M 0 183M 0% / run/user/0192.168.144.133:/mnt nfs4 40G 33M 40G 1% / var/www/html / / mount successfully
7. Edit the index.html file in the http service site, and then enable the http service.
[root@tast02 ~] # cd / var/www/html/ enter the site [root@tast02 html] # ls / / check if there is a file [root@tast02 html] # vim index.html / / Edit index.html file this is nfs web / / Edit content ~ ~: wq / / Save and exit [root@tast02 html] # cat index.html / / View index.html content this is nfs web / / display content information [root@tast02 html] # systemctl start httpd / / enable http service
8. Visit the http website built by the client in the host to see if the service has been successfully built.
9. Go back to the server to see if there is an index.html file we edited in the mnt directory, and then check to see if the content of the file is what we edited.
[root@tast01 ~] # cd / mnt / / enter the mnt directory [root@tast01 mnt] # ls / / View the contents of the directory index.html / / display the file we created [root@tast01 mnt] # cat index.html / / View the contents of the file this is nfs web / / display the content we wrote Note: the server is down when you are using the NFS feature At this time, when using the client operation, there will be a jam phenomenon, unable to complete the operation, we need to open a new client terminal, unmount the disk mounted in the http service site can operate normally, in the new terminal unmount must not use the tab key to complete the directory information, must be hit by hand, if you use the tab key to complete the operation will still card, remember! Remember!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.