Linux本地网络软件仓库搭建
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                Linux本地网络软件仓库搭建
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
                                文章目錄
- 1.網(wǎng)絡(luò)環(huán)境的搭建
- (1)本地主機(jī)網(wǎng)絡(luò)搭建
- 新建網(wǎng)卡
- 修改網(wǎng)卡ip
 
- (2)遠(yuǎn)程主機(jī)網(wǎng)絡(luò)搭建
- 遠(yuǎn)程主機(jī)網(wǎng)絡(luò)設(shè)置
- 測試連接外網(wǎng)主機(jī)
 
 
- 2.本地軟件倉庫的搭建
- 創(chuàng)建掛載目錄并掛載
- 編寫軟件倉庫文件
- westos.repo文件內(nèi)容
 
 
- 3.網(wǎng)絡(luò)軟件倉庫的搭建
- 安裝軟件
- 打開防火墻
- 建立共享目錄&重新掛載
- 更改westos.repo內(nèi)容
- 設(shè)置開機(jī)自動掛載
 
 
- 4.第三方軟件倉庫搭建
- westos.repo添加文件內(nèi)容
 
 
- 5.在遠(yuǎn)程主機(jī)中訪問資源并書寫repo文件
- 寫入repo文件
- 安裝epel擴(kuò)展源
- 安裝yumdownloader
- 在本地主機(jī)下載ansible及其依賴
- 在遠(yuǎn)程主機(jī)下載安裝ansible
- 查看ansible安裝版本
 
 
 
1.網(wǎng)絡(luò)環(huán)境的搭建
(1)本地主機(jī)網(wǎng)絡(luò)搭建
新建網(wǎng)卡
修改網(wǎng)卡ip
[root@localhost Desktop]# nm-connection-editor [root@localhost Desktop]# nmcli connection reload [root@localhost Desktop]# nmcli connection up ens224 [root@localhost Desktop]# ip aip及網(wǎng)關(guān)已經(jīng)設(shè)置
 
(2)遠(yuǎn)程主機(jī)網(wǎng)絡(luò)搭建
[root@localhost Desktop]# nm-connection-editor
 # 自動ip獲取(DHCP)
 
遠(yuǎn)程主機(jī)網(wǎng)絡(luò)設(shè)置
#!/bin/bash cd /run/media/root/RHEL-8-2-0-BaseOS-x86_64/BaseOS/Packages/# 安裝dhcp-server rpm -ivh dhcp-server-4.3.6-40.el8.x86_64.rpm # cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf# 將配置文件覆蓋寫入dhcp.conf# 將配置文件覆蓋寫入dhcp.conf # 文件寫入開始cat >/etc/dhcp/dhcpd.conf << EOF# dhcpd.conf # # Sample configuration file for ISC dhcpd ## option definitions common to all supported networks... option domain-name "westos.westos.org"; option domain-name-servers 114.114.114.114;default-lease-time 600; max-lease-time 7200;# Use this to enble / disable dynamic dns updates globally. #ddns-update-style none;# If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative;# Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7;# No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology.# This is a very basic subnet declaration.subnet 172.25.254.0 netmask 255.255.255.0 { # 子網(wǎng)設(shè)定range 172.25.254.50 172.25.254.70; # 分配ip地址范圍option routers 172.25.254.250; # 網(wǎng)關(guān) }EOF# 重啟DHCP systemctl restart dhcpd#重啟網(wǎng)絡(luò) [root@localhost Desktop]# nmcli connection reload [root@localhost Desktop]# nmcli connection up ens160
獲取到的ip屬于分配的地址池
[root@localhost Desktop]# ip a測試連接外網(wǎng)主機(jī)
2.本地軟件倉庫的搭建
創(chuàng)建掛載目錄并掛載
mkdir /rhel8.2 mount /dev/cdrom /rhel8.2編寫軟件倉庫文件
cd /etc/yum.repos.d/ # 軟件源指向文件配置目錄 [root@localhost rhel8.2]# vim /etc/yum.repos.d/westos.repo #軟件倉庫指向文件westos.repo文件內(nèi)容
[AppStream] name = Appstream baseurl = file:///rhel8.2/AppStream gpgcheck = 0 enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/PRM-GPG-KEY-redhat-release[BaseOS] name = BaseOS baseurl = file://rhel8.2/BaseOS gpgcheck = 0 enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/PRM-GPG-KEY-redhat-release3.網(wǎng)絡(luò)軟件倉庫的搭建
安裝軟件
dnf install httpd -y打開防火墻
[root@localhost rhel8.2]# systemctl enable --now httpd [root@localhost rhel8.2]# firewall-cmd --permanent --add-service=http success [root@localhost rhel8.2]# firewall-cmd --reload success建立共享目錄&重新掛載
mkdir /var/www/html/rhel8.2 umount /rhel8.2 mount /dev/cdrom /var/www/html/rhel8.2更改westos.repo內(nèi)容
[root@localhost Desktop]# vim /etc/yum.repos.d/westos.repo [root@localhost Desktop]# cat /etc/yum.repos.d/westos.repo [AppStream] name = Appstream baseurl = file:///var/www/html/rhel8.2/AppStream gpgcheck = 0 enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/PRM-GPG-KEY-redhat-release[BaseOS] name = BaseOS baseurl = file:///var/www/html/rhel8.2/BaseOS gpgcheck = 0 enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/PRM-GPG-KEY-redhat-release設(shè)置開機(jī)自動掛載
[root@localhost Desktop]# vim /etc/rc.d/rc.local ## 添加內(nèi)容 mount /dev/cdrom /var/www/html/rhel8.2 ## 打開文件權(quán)限 [root@localhost Desktop]# chmod +x /etc/rc.d/rc.local4.第三方軟件倉庫搭建
# 建立目錄 mkdir /var/www/html/software把所有的第三方軟件存放到/software中
 /software中只能存在rpm類型的文件,壓縮包是不能使用dnf管理的
 采集第三方軟件數(shù)據(jù)生成repodate目錄
westos.repo添加文件內(nèi)容
vim /etc/yum.repos.d/westos.repo [software] name=software baseurl=http://172.25.254.50/software gpgcheck=05.在遠(yuǎn)程主機(jī)中訪問資源并書寫repo文件
寫入repo文件
[root@localhost Desktop]# vim /etc/yum.repos.d/westos.repo [root@localhost Desktop]# cat /etc/yum.repos.d/westos.repo [AppStream] name=AppStream baseurl=http://172.25.254.50/rhel8.2/AppStream/ gpgcheck=0[BaseOS] name=BaseOS baseurl=http://172.25.254.50/rhel8.2/BaseOS/ gpgcheck=0[software] name=software baseurl=http://172.25.254.50/software gpgcheck=0連接本地主機(jī),訪問軟件資源
 
 
安裝epel擴(kuò)展源
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm安裝yumdownloader
查看安裝文件
 dnf whatprovides yumdownloader
安裝yum-utils-4.0.12-3.el8.noarch
在本地主機(jī)下載ansible及其依賴
yumdownloader #下載軟件包到本機(jī)指定位置
 yumdownloader httpd #下載倉庫中指定軟件的安裝包到當(dāng)前目錄
 yumdownloader --destdir=/mnt #下載倉庫中指定軟件的安裝包到指定/mnt目錄
 yumdownloader httpd --destdir=/mnt --resolve #下載倉庫中指定軟件安裝包和軟件依賴性到/mnt目錄
下載并掛載到sofrware
[root@localhost Desktop]# yumdownloader ansible --destdir=/var/www/html/ansible --resolve在遠(yuǎn)程主機(jī)下載安裝ansible
[root@localhost Desktop]# dnf install ansible -y查看ansible安裝版本
[root@localhost Desktop]# ansible --version總結(jié)
以上是生活随笔為你收集整理的Linux本地网络软件仓库搭建的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 误将系统装入D盘 原来数据如何恢复
- 下一篇: 利用FinalData恢复shift+d
