雲端計算學習路線教程大綱課件:使用自建源

千鋒雲端計算發表於2019-09-20

雲端計算學習路線教程大綱課件:使用自建源:

雲端計算學習路線教程大綱課件:使用自建源

====================================================================================

綜合案例:建立YUM伺服器

1. 提供基礎軟體包Base [光碟]

2. 提供update軟體包

3. 提供其它軟體包如nginx, zabbix, docker, hadoop, openstack

配置防火牆

[root@yum-server ~]# firewall-cmd --permanent --add-service=ftp

[root@yum-server ~]# firewall-cmd --reload

關閉SELinux

[root@yum-server ~]# setenforce 0

[root@yum-server ~]# vim /etc/sysconfig/selinux

SELINUX=disabled

FTP

[root@yum-server ~]# yum -y install vsftpd

[root@yum-server ~]# systemctl start vsftpd

[root@yum-server ~]# systemctl enable vsftpd

實現目標1:提供基礎軟體Base

掛載centos映象

[root@yum-server ~]# mkdir /var/ftp/{centos6u8,centos7u3}

[root@yum-server ~]# mount /home/centos7u3.iso /var/ftp/centos7u3

[root@yum-server ~]# echo "mount /home/centos7u3.iso /var/ftp/centos7u3" >> /etc/rc.d/rc.local

[root@yum-server ~]# chmod +x /etc/rc.d/rc.local

Yum client測試

[root@yum-client ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo

[root@yum-client ~]# vi /etc/yum.repos.d/centos7u3.repo //新增Yum源

[centos7u3]

name=centos7u3

baseurl=ftp://192.168.122.202/centos7u3

gpgcheck=0

enabled=1

[root@yum-client ~]# yum makecache

[root@yum-client ~]# yum repolist

[root@yum-client ~]# yum -y install wget lftp bash-com* vim-enhanced

實現目標2: 提供update

啟動yum快取

[root@yum-server ~]# vim /etc/yum.conf

[main]

cachedir=/var/cache/yum/$basearch/$releasever

keepcache=1

[root@yum-server ~]# yum clean all

[root@yum-server ~]# yum -y update

[root@yum-server ~]# mkdir /var/ftp/update

[root@yum-server ~]# find /var/cache/yum/x86_64/7/ -iname "*.rpm" -exec cp -rf {} /var/ftp/update \;

[root@yum-server ~]# yum -y install createrepo

[root@yum-server ~]# createrepo /var/ftp/update

Yum client測試

[root@yum-client ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo

[root@yum-client ~]# vi /etc/yum.repos.d/update.repo

[update]

name=centos update

baseurl=ftp://192.168.122.202/update

gpgcheck=0

enabled=1

[root@yum-client ~]# yum repolist

Loaded plugins: fastestmirror

repo id repo name status

update centos update 75

repolist: 75

[root@yum-client ~]# yum -y update

實現目標3: 提供其它軟體包如nginx, zabbix

--downloadonly

1. 配置nginx及zabbix源

[root@yum-server ~]# vim /etc/yum.repos.d/nginx.repo

[nginx]

name=nginx repo

baseurl=

gpgcheck=0

enabled=1

2. downloadonly

[root@yum-server ~]# yum clean all

[root@yum-server ~]# yum install nginx --downloadonly

[root@yum-server ~]# mkdir /var/ftp/{nginx,zabbix}

[root@yum-server ~]# find /var/cache/yum/x86_64/7/ -iname "*.rpm" -exec cp -rf {} /var/ftp/nginx

3. 建立reopdata:

[root@yum-server ~]# createrepo /var/ftp/nginx //如果加入新軟體包,重新建立

Yum client測試

[root@yum-client ~]# vi /etc/yum.repos.d/nginx.repo

[nginx]

name=nginx

baseurl=ftp://192.168.122.202/nginx

gpgcheck=0

enabled=1

[root@yum-client ~]# yum repolist

repo id repo name status

nginx nginx 1

update centos update 75

[root@yum-client ~]# yum -y install nginx

客戶端使用YUM源:

新增base,update,nginx,zabbix yum源

0. 手動

1. Shell

2. Saltstack, Asible, Puppet

本地源:例如使用安裝光碟 [瞭解]

1. 掛載安裝光碟(臨時):

[root@tianyun ~]# mount /dev/cdrom /media

[root@tianyun ~]# mount -o loop centos7u3.iso /media

2. 新增yum源

[root@tianyun ~]# vim /etc/yum.repos.d/centos7u3.repo

[centos7u3]

name=centos7u3

baseurl=file:///media

gpgcheck=0

enabled=1

====================================================================================


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69916964/viewspace-2657726/,如需轉載,請註明出處,否則將追究法律責任。

相關文章