技术标签: linux 服务器 centos7 centos
网络安装至少需要两个系统:
网络引导配置步骤在不同的系统中有所不同,具体看要安装 Linux 的系统是使用 BIOS
还是UEFI
。
# 关闭并禁用防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 在防火墙中允许某服务的连接(本次不使用此方式)
[root@localhost ~]# firewall-cmd --add-service=tftp
# 查看SELinux状态
[root@localhost ~]# getenforce
Enforcing
# 设置SELinux为permissive模式,1 是Enfocing模式
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
# 彻底禁用SELinux
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
使用ISO镜像搭建本地仓库,提升安装软件包的速度。
# ISO文件挂载
[root@localhost ~]# mount -o loop,ro -t iso9660 CentOS-7-x86_64-DVD-1810.iso /media
# cdrom光盘挂载(根据自己的情况二选一)
[root@localhost ~]# mount /dev/cdrom /media
# 备份原有文件
[root@localhost ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d_bak
[root@localhost ~]# rm -f /etc/yum.repos.d/*
# yum配置文件
[root@localhost ~]# cat /etc/yum.repos.d/local.repo
[development]
name=local
baseurl=file:///media/
gpgcheck=0
[root@localhost ~]# yum makecache
[root@localhost ~]# yum install -y httpd
# 启动HTTP服务
[root@localhost ~]# systemctl start httpd
# 设置开机启动
[root@localhost ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
# 系统通过网络安装时需要指定安装源,这里使用HTTP服务提供安装源,也可以通过FTP服务提供
# 将ISO文件挂载后复制到/var/www/html目录即可
[root@localhost ~]# mount -o loop,ro -t iso9660 CentOS-7-x86_64-DVD-1810.iso /media
# cdrom光盘挂载(根据自己的情况二选一)
[root@localhost ~]# mount /dev/cdrom /media
[root@localhost ~]# cp -r /media /var/www/html/centos7.6
[root@localhost ~]# yum install -y tftp-server
# 在 /etc/xinet.d/tftp 配置文件中,将 disabled 参数从 yes 改为 no
[root@localhost ~]# vim /etc/xinetd.d/tftp
[root@localhost ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
# 启动服务
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[root@localhost ~]# systemctl status tftp
[root@localhost ~]# yum install -y dhcp
# subnet字段为局部设置,优先级高于全局。option在全局和局部都可设置
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
subnet 192.168.22.0 netmask 255.255.255.0 {
option routers 192.168.22.2; # 网关
range 192.168.22.190 192.168.22.199; # 可分配的起始IP~结束IP
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.22.132; # 提供引导文件的服务器IP地址,即tftp服务器地址
if option architecture-type = 00:07 {
filename "uefi/shim.efi"; # 采用shim打包的EFI引导映象
} else {
filename "pxelinux/pxelinux.0"; # SYSLINUX打包的BIOS引导映像
}
}
}
# 启动服务并设置开机自启
[root@localhost ~]# systemctl start dhcpd.service
[root@localhost ~]# systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
[root@localhost ~]# systemctl status dhcpd.service
需要软件包 SYSLINUX
中的 pxelinux.0
文件
[root@localhost ~]# cp /media/Packages/syslinux-4.05-15.el7.x86_64.rpm ./
# 提取软件包
[root@localhost ~]# rpm2cpio syslinux-4.05-15.el7.x86_64.rpm | cpio -dimv
[root@localhost ~]# ls -lrt usr/share/syslinux/pxelinux.0
-rw-r--r--. 1 root root 26759 10月 31 2018 usr/share/syslinux/pxelinux.0
在 tftpboot
中创建 pxelinux
目录,并将 pxelinux.0
复制到该目录中
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux
[root@localhost ~]# cp usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux
在 pxelinux/
目录中创建目录 pxelinux.cfg
,添加名为 default
的配置文件
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg
# 可根据/media/isolinux/isolinux.cfg修改
## 设置背景图片,如 menu background splash.png,要将splash.png文件放在pxelinux目录下
## 设置菜单风格,如 default vesamenu.c32,要将vesamenu.c32文件放在pxelinux目录下
## 这里直接指定从哪个label启动,省去了进入菜单的时间
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux/pxelinux.cfg/default
default linux
prompt 1
timeout 600
label linux
menu label ^Install system
kernel vmlinuz
append initrd=initrd.img ip=dhcp inst.repo=http://192.168.22.132/centos7.6 inst.ks=http://192.168.22.132/ks.cfg
将引导映像复制到 pxelinux/
目录下
[root@localhost ~]# cp /media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/
[root@localhost ~]# tree /var/lib/tftpboot/pxelinux/
/var/lib/tftpboot/pxelinux/
├── initrd.img
├── pxelinux.0
├── pxelinux.cfg
│ └── default
└── vmlinuz
重新载入已运行服务 tftp
、xinetd
和 dhcp
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart tftp httpd dhcpd
# 将用到的服务设置为开机自启(已设置过请忽略)
[root@localhost ~]# systemctl enable tftp httpd dhcpd
需要软件包 shim
中的 shim.efi
文件,和软件包 grub2-efi
的 grubx64.efi
文件
[root@localhost ~]# cp /media/Packages/shim-x64-15-1.el7.centos.x86_64.rpm ./
[root@localhost ~]# cp /media/Packages/grub2-efi-x64-2.02-0.76.el7.centos.x86_64.rpm ./
# 提取软件包
[root@localhost ~]# rpm2cpio shim-x64-15-1.el7.centos.x86_64.rpm | cpio -dimv
[root@localhost ~]# rpm2cpio grub2-efi-x64-2.02-0.76.el7.centos.x86_64.rpm | cpio -dimv
[root@localhost ~]# ls -l boot/efi/EFI/centos/shim.efi
-rwx------. 1 root root 1205224 11月 10 2018 boot/efi/EFI/centos/shim.efi
[root@localhost ~]# ls -l boot/efi/EFI/centos/grubx64.efi
-rwx------. 1 root root 1090976 11月 9 2018 boot/efi/EFI/centos/grubx64.efi
在 tftpboot/
目录中创建 uefi/
目录,并将 EFI
引导映像复制到该目录下
[root@localhost ~]# mkdir /var/lib/tftpboot/uefi
[root@localhost ~]# cp boot/efi/EFI/centos/shim.efi /var/lib/tftpboot/uefi/
[root@localhost ~]# cp boot/efi/EFI/centos/grubx64.efi /var/lib/tftpboot/uefi/
[root@localhost ~]# chmod 644 /var/lib/tftpboot/uefi/shim.efi
[root@localhost ~]# chmod 644 /var/lib/tftpboot/uefi/grubx64.efi
在 uefi/
目录中添加名为 grub.cfg
的配置文件
# 可根据/media/EFI/BOOT/grub.cfg修改
[root@localhost ~]# vim /var/lib/tftpboot/uefi/grub.cfg
set timeout=10
menuentry 'RHEL 7' {
linuxefi uefi/vmlinuz ip=dhcp inst.repo=http://192.168.22.132/centos7.6 inst.ks=http://192.168.22.132/ks_uefi.cfg
initrdefi uefi/initrd.img
}
将 pxeboot
引导映像复制到 uefi/
目录下
[root@localhost ~]# cp /media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/uefi/
[root@localhost ~]# tree /var/lib/tftpboot/uefi/
/var/lib/tftpboot/uefi/
├── grub.cfg
├── grubx64.efi
├── initrd.img
├── shim.efi
└── vmlinuz
重新载入已运行服务 tftp
、xinetd
和 dhcp
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart tftp httpd dhcpd
# 将用到的服务设置为开机自启(已设置过请忽略)
[root@localhost ~]# systemctl enable tftp httpd dhcpd
# 操作系统安装后,root家目录下有应答文件anaconda-ks.cfg,可根据要安装的机器情况修改该文件
[root@localhost ~]# cp anaconda-ks.cfg /var/www/html/ks.cfg
[root@localhost ~]# chmod +r /var/www/html/ks.cfg
[root@localhost ~]# ls -l /var/www/html/
total 4
-rw-r--r--. 1 root root 1618 Aug 11 11:23 ks.cfg
drwxr-xr-x. 8 root root 254 Aug 11 10:49 media
# 验证 Kickstart 文件,pykickstart 软件包提供的 ksvalidator 命令
[root@localhost ~]# yum install pykickstart
[root@localhost ~]# ksvalidator ks.cfg
也可以在线编辑,如果有红帽客户门户网站帐户,则可以使用 https://access.redhat.com/labs/kickstartconfig/ 中的 Kickstart Configuration Tool 完成基本配置,并下载得到的 Kickstart 文件。
使用 ksverdiff
命令显示两本版本间 Kickstart
语法的不同。
# -f 指定要比较的第一个发行本,-t 指定要比较的最后一个发行本。
[root@localhost ~]# ksverdiff -f RHEL6 -t RHEL7
system-config-kickstart
是一款图形化工具,需要桌面环境或X11服务
# 安装system-config-kickstart
[root@localhost ~]# yum install -y system-config-kickstart
# 启动system-config-kickstart
[root@localhost ~]# system-config-kickstart
# 服务端安装X11服务,需要重新登录自动生成.Xauthority文件
[root@localhost ~]# yum install -y xorg-x11-xauth
# 中文字体(可选)
[root@localhost ~]# yum install -y google-noto-sans-fonts wqy-unibit-fonts wqy-zenhei-fonts
[root@localhost ~]# yum groups list
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Basic Web Server
Virtualization Host
Server with GUI
GNOME Desktop
KDE Plasma Workspaces
Development and Creative Workstation
Installed Groups:
Legacy UNIX Compatibility
System Administration Tools
Available Groups:
Compatibility Libraries
Console Internet Tools
Development Tools
Graphical Administration Tools
Scientific Support
Security Tools
Smart Card Support
System Management
Done
[root@localhost ~]# yum groupinstall -y "Server with GUI"
[root@localhost ~]# cat /etc/inittab
# 查看默认运行级别
[root@localhost ~]# systemctl get-default
# 设置图形化为默认
[root@localhost ~]# systemctl set-default graphical.target
# startx命令切换到图形界面
软件包选择时,出现“由于下载软件包失败, 软件包选择被禁止”错误
修改Yum配置文件 local.repo
,自定义标识源改为 [development]
安装时出现 “no space left on device”
错误
PXE装机内存最少要2G
文章浏览阅读1.1k次。ubuntu默认并没有安装ssh服务,如果通过ssh链接ubuntu,就需要自己手动安装ssh-server1.判断咱们的机器是否安装ssh服务ssh localhostssh: connect to host localhost port 22: Connection refused表示没有还没有安装SSH2.安装/卸载 ssh服务安装命令:sudo apt-get insta..._ubuntu18 为什么默认不安装ssh
文章浏览阅读53次。前言春招已经接近尾声了,不知道各位小伙伴有没有收获自己心仪的offer呢。笔者疫情被裁后在家LeetCode狂刷了800多题,加之自己以为工作总结的知识、经验,系统化的整理了一下。在五一期间已经收获了字节的offer。废话不多说,下面是我的刷题分享。进程和线程的概念进程是具有独立功能的程序在一个数据集合上运行的过程。进程是系统进行资源分配的单位,实现的操作系统的并发。线程是比进程更小的能独立运行的单位,是 调度的基本单位,实现了进程内部的并发。线程成为了程序执行流的最小单位。
文章浏览阅读1.1k次。最近遇到一个问题,公司内部平台发布了一个.net的https webservices,由于项目使用的是Java,在进行安全验证时,非常麻烦,所以就采取了一个简单的措施,就是用c#做了一个console程序,打包成exe,然后由java的runtime来执行本地命令的方式做,事情就简单了很多。 可在部署时遇到问题了,c#进行程序运行时需要.net framework框架,在一些电脑上,虽..._.net framework4 运行在linux mono
文章浏览阅读293次。https://sdqali.in/blog/2016/07/16/controlling-redis-auto-configuration-for-spring-boot-session/常用的类:@ConditionalOnProperty(name = "use.redis.session.store", havingValue = "true")@ConditionalOn...
文章浏览阅读564次。整体分为五大块:前端、后端、中间件、运维和工具转载于:https://www.cnblogs.com/wynn518/p/8490322.html_互联网常用技术栈
文章浏览阅读477次。如果你想在亚马逊上销售产品,你可能会对亚马逊的哪些服务zui适合你感到困惑。例如,物流服务,是该选择亚马逊FBA还是亚马逊FBM? 如果你是一个有经验的亚马逊卖家,有充足的资金支持,或者知道如何找到最赚钱的产品,那么你可以选择FBA。FBA的优点是重量轻,有助于产品排名。当然,它也有明显的缺点。也就是说,它占用了太多的资金和存货。一旦产品无法销售,它将影响你的资金链。因此,如果你想通过FBA在亚马逊上销售,则必须谨慎进行选品。否则,你在产品上投资的每一分钱都将徒劳无功。 使用FBM,它不会占_2023中国卖家fba和fbm占比
文章浏览阅读546次。在编译一些旧项目的时候,gradle和Android gradle插件的版本一直以来由于更新问题,总是会出现各种各样的错误,加上国内网速的原因,各种不爽。鉴于网上的各种信息已经过时,这里我就更新一下记录,以后用到的时候就好办了。主要就是build.gradle文件和gradle-wrapper.properties文件,修改好这两个文件中关于gradle插件和gradle的版本就可以进入下一步了。..._gradle 5.4.1 对应 stduio
文章浏览阅读98次。题意:1 x C 将第x个小段的木棒替换成C型,C只会是’X’,’(‘,’)’中的一种2 l r 询问妖梦从第l段到第r段之间(含l,r),有多少个完整的木棒完整的木棒左右两端必须分别为’(‘和’)’,并且中间要么什么都没有,要么只能有’X’。题解:典型的线段树维护区间合并问题 (特别注意query中的合并)开三个数组,ls代表左端是否拥有右括号,rs代表右端是否有左括号,ishave用来代表区间中是否有括号。代码:#include<bits/stdc++.h>#define _妖梦斩木棒
文章浏览阅读775次。Revit每年都会出下一年为号的新版本,今年也不例外,前一阵子就出了revit2021的新版本,对于大家来说,都想试试新版本尝尝鲜,但是奈何找不到好的地方下载,别担心,小编这就给你方法!Revit2021新功能1、衍生式设计2、实时逼真的视图3、倾斜墙4、PDF和图像链接及卸载5、用于连接桥梁工作流的桥梁类别6、Dynamo2.5集成7、钢筋建模增强8、集成的预制自动化9、集成的钢结构连接节点10..._linux版revit
文章浏览阅读1k次。不要选择第一个,因为权限太高。不要选,保存,100%报错;凶巴巴!!!_$.messager is undefined
文章浏览阅读3.6k次。日常生活中,在我们上网的时候,都会需要一个IP地址,那这些IP地址是如何来的呢?目前我们知道的是静态IP地址和自动分配IP地址,那自动分配IP地址又是如何分配的呢?今天我们就来简单了解一下这位IP地址的荷官——DHCP动态主机配置协议。DHCP(Dynamic Host Configuration Protocol):动态主机配置协议,是由Internet工作任务小组设计开发的,专门用于为TCP/IP网络中的计算机自动分配TCP/IP参数的协议,是一个应用层协议,使用UDP67和68端口。DHCP的前身是B_dhcp地址池
文章浏览阅读2k次。华为推送服务测试发送平台https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myProject/101704409/9249519184595935885发送文档https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/android-client-dev-0000001050042041AD7Xe0uLQbeoJVaw_华为快应用推送测试