制作离线yum源 + NFS挂载

# 1 查看配置好的网络源
yum repolist
# 2 将指定网络源拉到本地,这里的例子是base和docker-ce-stable
reposync -r base -p /root/base
reposync -r docker-ce-stable -p /root/docker-ce

# 3 停用原有yum源,将原有yum源文件备份
mkdir /etc/yum.repos.d/backup/
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup/

# 4 创建新yum源
cat docker-local.repo
[docker-local]
name=Docker Local Repository
baseurl=file:///root/liu_yums/docker-ce/docker-ce-stable
gpgcheck=0
enabled=1

 cat local.repo
[base]
name=centos-base
baseurl=file:///root/liu_yums/base/base
gpgcheck=0
enabled=1

# 5 生成本地yum源缓存,将本地同步下来的源文件生成缓存数据库文件
createrepo /root/liu_yums/base/base
createrepo /root/liu_yums/docker-ce/docker-ce-stable
# 执行后会在/root/ownyum/base文件夹中生成一个叫repodata的文件,很重要!
# 它包含各软件包之间的依赖关系、版本信息等。
# 如需安装 createrepo
cd /root/liu_yums/createrepo
rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm
109 rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm
110 rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm
114 rpm -ivh libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm
115 rpm -ivh libxml2-2.9.1-6.el7_9.6.x86_64.rpm
116 rpm -ivh libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm
117 rpm -Uvh libxml2-2.9.1-6.el7_9.6.x86_64.rpm
118 rpm -ivh libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm
119 rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm

单独下载包

# 比如下载 ntfs-3g
yumdownloader --destdir=./ ntfs-3g

2 NFS挂载

112 上

yum install -y nfs-utils
systemctl start nfs-server
systemctl enable nfs-server

cat /etc/exports
/dfsdata 10.xxx.xxx.111(rw,sync)

两台机器 systemctl stop firewalld.service

111 上

mount -t nfs -o sync,actimeo=1 10.xxx.xxx.112:/dfsdata /dfsdata
echo “10.xxx.xxx.112:/dfsdata /dfsdata nfs sync,actimeo=1 0 0” >> /etc/fstab

你可能感兴趣的:(项目笔记,linux,运维)