[root@foundation50 westos]# cd /etc/yum.repos.d/ 倉庫文件指向目錄
[root@foundation50 yum.repos.d]# vim /etc/yum.repos.d/westos.repo將編寫的文件放在倉庫文件指向目錄中,并且文件的結尾必須是以repo結尾否則不識別
[ AppStream] ##倉庫名稱 應用軟件
name=AppStream ##描述
baseurl=file:///westos/AppStream ##f訪問軟件存放目錄地址 /westos 為自己掛載鏡像目錄
gpgcheck=0 ##等于0不檢測gpgkey(跳過授權檢測) =1:等于1檢測,此時需要gpgkey
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ### 去檢測軟件是不是官方授權的[BaseOS]###系統的核心:函數庫,內核
name=BaseOS
baseurl=file:///westos/BaseOS
gpgcheck=0
enable=1 ###表示啟用此庫 默認為1 =0:不啟用此庫[root@foundation50 yum.repos.d]# dnf clean all 將系統中以及讀取過軟件倉庫的信息清理掉
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
25 files removed
[root@foundation50 yum.repos.d]# cd /var/cache/dnf/ 清除的就是這個目錄里的文件
[root@foundation50 dnf]# ls
AppStream-4002311a1f8f0602 BaseOS-e603ff569954d031 last_makecache
AppStream-b0777c5f74c3405e commandline-a76fe31ae310b0c7 packages.db
AppStream-ea34aa398f56f4f0 expired_repos.json rhel8-30c83ab4ec6321af
BaseOS-5c5271346fadac6f google-chrome-eb0d6f10ccbdafba tempfiles.json
BaseOS-68a81d68eef9cce1 kolourpaint-a4a8f194f7fcf618
[root@foundation50 dnf]# dnf list gcc 列出gcc軟件
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
AppStream 32 MB/s | 5.8 MB 00:00
BaseOS 26 MB/s | 2.3 MB 00:00
Last metadata expiration check: 0:00:01 ago on Wed 25 Aug 2021 10:51:59 PM CST.
Installed Packages
gcc.x86_64 8.3.1-5.el8 @AppStream 發現已經有了gcc軟件包
[root@foundation50 dnf]# dnf install gcc -y 此時就可以安裝gcc
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:44 ago on Wed 25 Aug 2021 10:51:59 PM CST.
Package gcc-8.3.1-5.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@foundation50 yum.repos.d]# dnf repolist 列出倉庫軟件信息
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name
AppStream AppStream
BaseOS BaseOS
[root@foundation50 yum.repos.d]# cd /var/cache/dnf/ 以加載的倉庫信息文件
[root@foundation50 dnf]# ls
AppStream-4002311a1f8f0602 BaseOS-5a0b07a03f07bb81 google-chrome-eb0d6f10ccbdafba
AppStream-66c7d678d2cb8d44 BaseOS-5c5271346fadac6f kolourpaint-a4a8f194f7fcf618
AppStream-b0777c5f74c3405e BaseOS-68a81d68eef9cce1 last_makecache
AppStream-ea34aa398f56f4f0 BaseOS-e603ff569954d031 packages.db
AppStream-edd56422de0841bf BaseOS-filenames.solvx rhel8-30c83ab4ec6321af
AppStream-filenames.solvx BaseOS.solv tempfiles.json
AppStream.solv commandline-a76fe31ae310b0c7
BaseOS-380ca80269784dd9 expired_repos.json
[root@foundation50 dnf]# dnf clean all 清除以加載的倉庫信息文件
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
20 files removed
[root@foundation50 dnf]# dnf list all 列出所有軟件
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:05:06 ago on Thu 26 Aug 2021 11:17:04 AM CST.
Installed Packages
GConf2.x86_64 3.2.6-22.el8 @AppStream
ModemManager.x86_64 1.10.8-2.el8 @anaconda
ModemManager-glib.x86_64 1.10.8-2.el8 @anaconda
NetworkManager.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-adsl.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-bluetooth.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-config-server.noarch 1:1.22.8-4.el8 @anaconda
NetworkManager-libnm.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-team.x86_64 1:1.22.8-4.el8 @anaconda
。。。。。。。。
[root@foundation50 dnf]# dnf list available 列出未安裝軟件
yp-tools.x86_64 4.2.3-1.el8 AppStream
ypbind.x86_64 3:2.5-2.el8 AppStream
ypserv.x86_64 4.0-6.20170331git5bfba76.el8 AppStream
yum-utils.noarch 4.0.12-3.el8 BaseOS
zlib.i686 1.2.11-13.el8 BaseOS
zlib-devel.i686 1.2.11-13.el8 BaseOS
zlib-devel.x86_64 1.2.11-13.el8 BaseOS
zsh.x86_64 5.5.1-6.el8_1.2 BaseOS
[root@foundation50 dnf]# dnf list installed 列出已安裝軟件
xorg-x11-xinit-session.x86_64 1.3.4-18.el8 @AppStream
xorg-x11-xkb-utils.x86_64 7.7-27.el8 @AppStream
xz.x86_64 5.2.4-3.el8 @anaconda
xz-libs.x86_64 5.2.4-3.el8 @anaconda
yajl.x86_64 2.1.0-10.el8 @AppStream
yelp.x86_64 2:3.28.1-3.el8 @AppStream
yelp-libs.x86_64 2:3.28.1-3.el8 @AppStream
yelp-tools.noarch 3.28.0-3.el8 @AppStream
[root@foundation50 dnf]# dnf remove gcc 卸載軟件
[root@foundation50 dnf]# dnf reinstall gcc -y 安裝過的軟件要重新安裝需要用reinstall
[root@foundation50 dnf]# dnf search httpd 通過關鍵字搜索軟件
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:19:00 ago on Thu 26 Aug 2021 11:17:04 AM CST.
================================== Name Exactly Matched: httpd ===================================
httpd.x86_64 : Apache HTTP Server
================================= Name & Summary Matched: httpd ==================================
redhat-logos-httpd.noarch : Red Hat-related icons and pictures used by httpd
keycloak-httpd-client-install.noarch : Tools to configure Apache HTTPD as Keycloak client
[root@foundation50 dnf]# rm -fr /bin/ls 刪除了ls軟件所在文件
[root@foundation50 dnf]# ls
bash: /usr/bin/ls: No such file or directory
[root@foundation50 dnf]# rpm -qf /bin/ls 可以用rpm命令查看是那個安裝包
coreutils-8.30-6.el8.x86_64
[root@foundation50 dnf]# dnf whatprovides /bin/ls dnf命令查看需要用 whatprovides
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:22:40 ago on Thu 26 Aug 2021 11:17:04 AM CST.
coreutils-8.30-6.el8.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo : @System
Matched from:
Provide : /bin/ls
[root@foundation50 dnf]# dnf reinstall coreutils-8.30-6.el8.x86_64 -y 進行重新安裝,ls命令就可以用了
[root@foundation50 dnf]# dnf history dnf執行的歷史記錄
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------15 | reinstall coreutils-8.30 | 2021-08-26 11:40 | R | 2 14 | reinstall gcc | 2021-08-26 11:33 | R | 2 13 | install gcc -y | 2021-08-26 11:32 | Install | 7 12 | remove gcc | 2021-08-26 11:30 | Removed | 7 11 | install gcc -y | 2021-08-26 11:00 | Install | 1 <10 | install httpd -y | 2021-08-26 10:50 | Install | 9 > 9 | erase httpd | 2021-08-26 10:50 | Removed | 9 EE
[root@foundation50 dnf]# dnf history info 12 查看dnf執行的歷史詳細信息
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Transaction ID : 12
Begin time : Thu 26 Aug 2021 11:30:32 AM CST
Begin rpmdb : 1481:fcd53e2f43d907ff7a8c4af7ab86e6b003c1d2f3
End time : Thu 26 Aug 2021 11:30:37 AM CST (5 seconds)
End rpmdb : 1474:7b30c951e73b3fd01189a19cd950283a7b2577ac
User : <westos>
Return-Code : Success
Releasever : 8
Command Line : remove gcc
Packages Altered:Removed cpp-8.3.1-5.el8.x86_64 @@SystemRemoved gcc-8.3.1-5.el8.x86_64 @@SystemRemoved glibc-devel-2.28-101.el8.x86_64 @@SystemRemoved glibc-headers-2.28-101.el8.x86_64 @@SystemRemoved isl-0.16.1-6.el8.x86_64 @@SystemRemoved kernel-headers-4.18.0-193.el8.x86_64 @@SystemRemoved libxcrypt-devel-4.1.1-4.el8.x86_64 @@Syste
[root@foundation50 dnf]# dnf group list 列出軟件組
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 2:57:21 ago on Thu 26 Aug 2021 12:06:20 PM CST.
Available Environment Groups:ServerMinimal InstallWorkstationVirtualization HostCustom Operating System
Installed Environment Groups:Server with GUI
Installed Groups:Container Management
[root@foundation50 dnf]# dnf group list --installed 列出已安裝的軟件組
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:52 ago on Thu 26 Aug 2021 03:06:31 PM CST.
Installed Environment Groups:Server with GUI
Installed Groups:Container ManagementHeadless Management
[root@foundation50 dnf]# dnf group list --available 列出未安裝的軟件組
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:03:38 ago on Thu 26 Aug 2021 03:06:31 PM CST.
Available Environment Groups:ServerMinimal InstallWorkstationVirtualization HostCustom Operating System
[root@foundation50 dnf]# dnf group list --hidden 列出隱藏的軟件組
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:06:59 ago on Thu 26 Aug 2021 03:06:31 PM CST.
Available Environment Groups:ServerMinimal InstallWorkstationVirtualization HostCustom Operating System
[root@foundation50 dnf]# dnf group info "Virtualization Client" 查看虛擬化軟件組的信息
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:12:50 ago on Thu 26 Aug 2021 03:06:31 PM CST.Group: Virtualization ClientDescription: Clients for installing and managing virtualization instances.Mandatory Packages:gnome-boxesvirt-installvirt-managervirt-viewerDefault Packages:virt-topOptional Packages:libguestfs-inspect-iconslibguestfs-toolslibguestfs-tools-c
[root@foundation50 dnf]# dnf group install "Virtualization Client" 安裝虛擬化軟件組
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:16:37 ago on Thu 26 Aug 2021 03:06:31 PM CST.
Dependencies resolved.
==================================================================================================Package Architecture Version Repository Size
==================================================================================================
Installing Groups:Virtualization Client Transaction Summary
==================================================================================================Is this ok [y/N]: y
Complete!
自己電腦能上網的兩條命令
[root@foundation50 isos]# ip route add default via 172.25.254.250 enp4s0f1 加一個網關
[root@foundation50 isos]# vim /etc/resolv.conf
[root@foundation50 isos]# cat /etc/resolv.conf
nameserver 114.114.114.114
7.網絡源epel(可以下載系統里面沒有的軟件,如flameshot,pingyin)
[root@foundation50 yum.repos.d]# vim westos.repo
[aliyunrepo]
name=aliyunrepo
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/ 阿里云鏡像
gpgcheck=0
[aliyunrepo]
name=aliyunrepo
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/
gpgcheck=0[AppStream] 加上系統本地源,倉庫就全了
name=AppStream
baseurl=http://172.25.254.50/westos/AppStream
gpgcheck=0[BaseOS]
name=BaseOS
baseurl=http://172.25.254.50/westos/BaseOS
gpgcheck=0
[root@foundation50 yum.repos.d]# dnf search flameshot 搜索flameshot
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:14 ago on Thu 26 Aug 2021 04:32:58 PM CST.
================================ Name Exactly Matched: flameshot =================================
flameshot.x86_64 : Powerful and simple to use screenshot software
[root@foundation50 yum.repos.d]# dnf install flameshot -y 下載
8 、java的安裝
[root@foundation50 Desktop]# dnf install java-11-openjdk.x86_64 java-11-openjdk-devel.x86_64 -y 安裝java兩個安裝包
[root@foundation50 Desktop]# vim /etc/profile.d/java.sh 配置系統環境
export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export PATH=$PATH:$JAVA_HOME:/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools,jar
[root@foundation50 Desktop]# vim westos.java 寫java代碼
public class westos{
public static void main(string args[]){
System.out.println("hello westos");
}
}
[root@foundation50 Desktop]# javac westos.java 編譯
[root@foundation50 Desktop]# java westos java部署成功
hello westos
[root@foundation50 Desktop]# yumdownloader httpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 5:46:44 ago on Thu 26 Aug 2021 04:56:45 PM CST.
httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64.rpm
下載httpd安裝包到指定的mnt當中
[root@foundation50 Desktop]# yumdownloader httpd --destdir=/mnt
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 5:49:12 ago on Thu 26 Aug 2021 04:56:45 PM CST.
httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64.rpm
[root@foundation50 Desktop]# ls /mnt/
httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64.rpm