SHELL腳本之配置遠(yuǎn)程yum源及安裝yum倉(cāng)庫(kù)

遠(yuǎn)程yum倉(cāng)庫(kù)

1.遠(yuǎn)程服務(wù)器yum源腳本如下:

#!/bin/bash

#掛載鏡像文件
mount /dev/sr0 /mnt

#安裝ftp服務(wù)
yum install vsftpd -y

#創(chuàng)建ftp站點(diǎn)
cd /var/ftp
mkdir centos7
mkdir other
cp -rf /mnt/* centos7/ &
createrepo -g /mnt/repodata/repomd.xml other/

#開(kāi)啟服務(wù)
systemctl start vsftpd

#關(guān)閉防火墻
systemctl stop firewalld.service
setenforce 0

2.本地服務(wù)器安裝yum倉(cāng)庫(kù)腳本如下

#!/bin/bash

#安裝ftp服務(wù)
yum install ftp -y

#備份文件
cd /etc/yum.repos.d
mkdir bak
mv *.repo bak

#清除yum緩存
yum clean all
yum list

#設(shè)置yum倉(cāng)庫(kù)軟件包來(lái)源
echo "[base]
name=centos7.Packages
baseurl=ftp://192.168.102.128/centos7
enable=1
gpgkey=1
gpgkey=ftp://192.168.102.128/centos7/RPM-GPG-KEY-CentOS-7
[other]
name=other.Packages
baseurl=ftp://192.168.102.128/other
enable=1
gpgkey=0
" > centos7.repo

#重新加載yum倉(cāng)庫(kù)
yum list

當(dāng)前題目:SHELL腳本之配置遠(yuǎn)程yum源及安裝yum倉(cāng)庫(kù)
網(wǎng)站路徑:http://muchs.cn/article48/gpjihp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、營(yíng)銷型網(wǎng)站建設(shè)網(wǎng)站導(dǎo)航、響應(yīng)式網(wǎng)站、App開(kāi)發(fā)ChatGPT

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司