When maintaining a large cluster, the operating system versions are often the same, and the need for yum to install software is often encountered. Here is a way to configure the company’s exclusive YUM source
1. Install an FTP server in the cloud 1
Download or upload the ISO file of the fixed CentOS version to the cloud 1
Configure automatic mounting 2
2. Synchronize local YUM source with other servers 3
The current machine takes effect 3
3. Restore to the old YUM source 3
1. Install FTP server in the cloud
Install FTP service
yum install vsftpd
service vsftpd restart
chkconfig vsftpd on
Download or upload an ISO file of a fixed CentOS version to the cloud
For example, the fixed Centos version is Centos6.8
In / var / ftp create 2 Ge pub2 pub folders
Download or upload DVD Centos6.8 ISO file
The centos 6.8 64.DVD1 DVD2 are downloaded pub pub2
Reference download link: http://mirrors.yun-idc.com/centos/6.8/isos/x86_64/
3.6G http://mirrors.yun-idc.com/centos/6.8/isos/x86_64/CentOS-6.8-x86_64-bin-DVD1.iso
2.1G http://mirrors.yun-idc.com/centos/6.8/isos/x86_64/CentOS-6.8-x86_64-bin-DVD2.iso
Configure manual mount
mount -o loop /var/ftp/CentOS-6.8-x86_64-bin-DVD1.iso /var/ftp/pub
mount -o loop /var/ftp/CentOS-6.8-x86_64-bin-DVD2.iso /var/ftp/pub2
Configure automatic mounting
Modify /etc/fstab to add
/var/ftp/CentOS-6.8-x86_64-bin-DVD1.iso /var/ftp/pub iso9660 loop,defaults 0 0
/var/ftp/CentOS-6.8-x86_64-bin-DVD2.iso /var/ftp/pub2 iso9660 loop,defaults 0 0
Mount activation
Among them, the automatic mounting configuration will take effect in the next restart
mount -a
Boot up and see the mount succeeded!
2. Synchronize local YUM sources with other servers
The other servers here are any servers managed in the cloud deployment management system.
Clear all yum sources
cd /etc/yum.repos.d/
mkdir ~/oldrepo
mv ./* ~ / oldrepo /
Add Centos local source
Assume that the cloud deployment management server address is 192.168.0.105
Then:
/etc/yum.repos.d/centos_local.repo
[centos]
name=centos
baseurl = ftp: //192.168.0.105/pub
ftp://192.168.0.105/pub2
enabled=1
gpgcheck=0
The current machine takes effect
yum clean all
yum makecache
3. Restore to the old YUM source
cd /etc/yum.repos.d/
rm /etc/yum.repos.d/centos_local.repo
mv ~ / oldrepo / *.
yum clean all
yum makecache