技术标签: linux 服务器 centos7 centos
网络安装至少需要两个系统:
网络引导配置步骤在不同的系统中有所不同,具体看要安装 Linux 的系统是使用 BIOS
还是UEFI
。
# 关闭并禁用防火墙
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 在防火墙中允许某服务的连接(本次不使用此方式)
[[email protected] ~]# firewall-cmd --add-service=tftp
# 查看SELinux状态
[[email protected] ~]# getenforce
Enforcing
# 设置SELinux为permissive模式,1 是Enfocing模式
[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce
Permissive
# 彻底禁用SELinux
[[email protected] ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
使用ISO镜像搭建本地仓库,提升安装软件包的速度。
# ISO文件挂载
[[email protected] ~]# mount -o loop,ro -t iso9660 CentOS-7-x86_64-DVD-1810.iso /media
# cdrom光盘挂载(根据自己的情况二选一)
[[email protected] ~]# mount /dev/cdrom /media
# 备份原有文件
[[email protected] ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d_bak
[[email protected] ~]# rm -f /etc/yum.repos.d/*
# yum配置文件
[[email protected] ~]# cat /etc/yum.repos.d/local.repo
[development]
name=local
baseurl=file:///media/
gpgcheck=0
[[email protected] ~]# yum makecache
[[email protected] ~]# yum install -y httpd
# 启动HTTP服务
[[email protected] ~]# systemctl start httpd
# 设置开机启动
[[email protected] ~]# 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目录即可
[[email protected] ~]# mount -o loop,ro -t iso9660 CentOS-7-x86_64-DVD-1810.iso /media
# cdrom光盘挂载(根据自己的情况二选一)
[[email protected] ~]# mount /dev/cdrom /media
[[email protected] ~]# cp -r /media /var/www/html/centos7.6
[[email protected] ~]# yum install -y tftp-server
# 在 /etc/xinet.d/tftp 配置文件中,将 disabled 参数从 yes 改为 no
[[email protected] ~]# vim /etc/xinetd.d/tftp
[[email protected] ~]# 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
}
# 启动服务
[[email protected] ~]# systemctl start tftp
[[email protected] ~]# systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[[email protected] ~]# systemctl status tftp
[[email protected] ~]# yum install -y dhcp
# subnet字段为局部设置,优先级高于全局。option在全局和局部都可设置
[[email protected] ~]# 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引导映像
}
}
}
# 启动服务并设置开机自启
[[email protected] ~]# systemctl start dhcpd.service
[[email protected] ~]# systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
[[email protected] ~]# systemctl status dhcpd.service
需要软件包 SYSLINUX
中的 pxelinux.0
文件
[[email protected] ~]# cp /media/Packages/syslinux-4.05-15.el7.x86_64.rpm ./
# 提取软件包
[[email protected] ~]# rpm2cpio syslinux-4.05-15.el7.x86_64.rpm | cpio -dimv
[[email protected] ~]# 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
复制到该目录中
[[email protected] ~]# mkdir /var/lib/tftpboot/pxelinux
[[email protected] ~]# cp usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux
在 pxelinux/
目录中创建目录 pxelinux.cfg
,添加名为 default
的配置文件
[[email protected] ~]# 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启动,省去了进入菜单的时间
[[email protected] ~]# 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/
目录下
[[email protected] ~]# cp /media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/
[[email protected] ~]# tree /var/lib/tftpboot/pxelinux/
/var/lib/tftpboot/pxelinux/
├── initrd.img
├── pxelinux.0
├── pxelinux.cfg
│ └── default
└── vmlinuz
重新载入已运行服务 tftp
、xinetd
和 dhcp
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl restart tftp httpd dhcpd
# 将用到的服务设置为开机自启(已设置过请忽略)
[[email protected] ~]# systemctl enable tftp httpd dhcpd
需要软件包 shim
中的 shim.efi
文件,和软件包 grub2-efi
的 grubx64.efi
文件
[[email protected] ~]# cp /media/Packages/shim-x64-15-1.el7.centos.x86_64.rpm ./
[[email protected] ~]# cp /media/Packages/grub2-efi-x64-2.02-0.76.el7.centos.x86_64.rpm ./
# 提取软件包
[[email protected] ~]# rpm2cpio shim-x64-15-1.el7.centos.x86_64.rpm | cpio -dimv
[[email protected] ~]# rpm2cpio grub2-efi-x64-2.02-0.76.el7.centos.x86_64.rpm | cpio -dimv
[[email protected] ~]# ls -l boot/efi/EFI/centos/shim.efi
-rwx------. 1 root root 1205224 11月 10 2018 boot/efi/EFI/centos/shim.efi
[[email protected] ~]# 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
引导映像复制到该目录下
[[email protected] ~]# mkdir /var/lib/tftpboot/uefi
[[email protected] ~]# cp boot/efi/EFI/centos/shim.efi /var/lib/tftpboot/uefi/
[[email protected] ~]# cp boot/efi/EFI/centos/grubx64.efi /var/lib/tftpboot/uefi/
[[email protected] ~]# chmod 644 /var/lib/tftpboot/uefi/shim.efi
[[email protected] ~]# chmod 644 /var/lib/tftpboot/uefi/grubx64.efi
在 uefi/
目录中添加名为 grub.cfg
的配置文件
# 可根据/media/EFI/BOOT/grub.cfg修改
[[email protected] ~]# 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/
目录下
[[email protected] ~]# cp /media/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/uefi/
[[email protected] ~]# tree /var/lib/tftpboot/uefi/
/var/lib/tftpboot/uefi/
├── grub.cfg
├── grubx64.efi
├── initrd.img
├── shim.efi
└── vmlinuz
重新载入已运行服务 tftp
、xinetd
和 dhcp
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl restart tftp httpd dhcpd
# 将用到的服务设置为开机自启(已设置过请忽略)
[[email protected] ~]# systemctl enable tftp httpd dhcpd
# 操作系统安装后,root家目录下有应答文件anaconda-ks.cfg,可根据要安装的机器情况修改该文件
[[email protected] ~]# cp anaconda-ks.cfg /var/www/html/ks.cfg
[[email protected] ~]# chmod +r /var/www/html/ks.cfg
[[email protected] ~]# 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 命令
[[email protected] ~]# yum install pykickstart
[[email protected] ~]# ksvalidator ks.cfg
也可以在线编辑,如果有红帽客户门户网站帐户,则可以使用 https://access.redhat.com/labs/kickstartconfig/ 中的 Kickstart Configuration Tool 完成基本配置,并下载得到的 Kickstart 文件。
使用 ksverdiff
命令显示两本版本间 Kickstart
语法的不同。
# -f 指定要比较的第一个发行本,-t 指定要比较的最后一个发行本。
[[email protected] ~]# ksverdiff -f RHEL6 -t RHEL7
system-config-kickstart
是一款图形化工具,需要桌面环境或X11服务
# 安装system-config-kickstart
[[email protected] ~]# yum install -y system-config-kickstart
# 启动system-config-kickstart
[[email protected] ~]# system-config-kickstart
# 服务端安装X11服务,需要重新登录自动生成.Xauthority文件
[[email protected] ~]# yum install -y xorg-x11-xauth
# 中文字体(可选)
[[email protected] ~]# yum install -y google-noto-sans-fonts wqy-unibit-fonts wqy-zenhei-fonts
[[email protected] ~]# 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
[[email protected] ~]# yum groupinstall -y "Server with GUI"
[[email protected] ~]# cat /etc/inittab
# 查看默认运行级别
[[email protected] ~]# systemctl get-default
# 设置图形化为默认
[[email protected] ~]# systemctl set-default graphical.target
# startx命令切换到图形界面
软件包选择时,出现“由于下载软件包失败, 软件包选择被禁止”错误
修改Yum配置文件 local.repo
,自定义标识源改为 [development]
安装时出现 “no space left on device”
错误
PXE装机内存最少要2G
element puls的select下拉选择加Tree V2 虚拟化树形控件实现简易下拉选择前言在vue3+typescript项目中,需要使用到下拉树形选择功能,npm vue3-treeselect后使用中有很多问题和不兼容ts。原本也只需要简单的选择功能,就照着网上现写了一个简易的下拉选择(element puls select + tree v2)组件的模板<template> <div class="tree_box" :style="width &&
private boolean isNumber(String n) { // 判断字符串是否为数字:正负整数、正负小数 Pattern p = Pattern.compile("^-?(\\d+|\\d+\\.\\d+)$"); return p.matcher(n).find(); } private boolean isDate(String n) { // 简单判断字符串是否为日期:年的位数小于等于四位就是...
DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some bloc
Vue写项目后台04 收缩菜单栏,全屏,头像,退出登录继上次的左边菜单栏这次加了头部,左边菜单栏收缩,和页面全屏,头像,退出登录。首先看左边的菜单栏在中自带有:collapse属性,给他设置一个collapse的值在export default{}中设置data(){return{collapse:false // 设置了collapse属性名的值为false}}这个口口使用的element-ui的字体图标口口<!-- 收缩左边菜单栏 --><div
问题概述根据要求对Solr进行升级,各个配置升级改操到位后,启动项目时,单元测试模块不通过,导致项目一直无法启动,错误信息:“org.apache.http.impl.conn.PoolingHttpClientConnectionManager.setValidateAfterInactivity(I)V ”升级的服务版本如下图所示:部分截图如下:..._1671465600
实物图及其测试效果,由于测试时没拍太多照片。高频部分的没有,只贴上低频的。由于这里用到的多是集成的芯片和模块,所以画的比较简单。图中的CH1和CH2时信号源产生的两路正弦波或方波。方波可以直接输入测量,但是注意信号源要设置偏移量,将输出方波抬高到0上。因为信号源直接出来的方波含有负电压会导致测量不准,甚至损坏I/O口。正弦波要经过整形放大模块后才能进入FPGA。进来的两路信号中,一路直接...
最近的一个项目使用的是React+React-router+Redux框架,刚开始编写代码的时候,客户的需求不明确,没有明确要求兼容IE8,当第一个版本出来之后,用户发现不能在IE8下使用,才提出兼容IE8的事情。但当时整体的代码框架和主要功能都已经实现,如果更换框架来实现,相当于放弃前面几个月的React代码重写。这带来的工作量是难以估计的。 查找网上的React兼容IE8的方
FliptileTime Limit: 2000MS Memory Limit: 65536KTotal Submissions:13542 Accepted: 4983DescriptionFarmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has ar...
vm模块在V8虚拟机上下文中提供了编译和运行代码的API
VENC 模块,即视频编码模块。本模块支持多路实时编码,且每路编码彼此独立,编码协议和编码profile 可以不同。本模块支持视频编码同时,调度 Region 模块对编码图像内容进行叠加和遮挡。本模块的输入源包括三类:第一类是用户态读取图像文件向编码模块发送数据;第二类是视频输入(VIU )模块采集的图像经视频处理子系统(VPSS)发送到编码模块;第三类是视频输入(VIU )模块采
问题产生最近,在移植 busybox 到 ARM 板,启动时报错/linuxrc: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directoryKernel panic - not syncing: Attempted to kill init!原因是缺少动态库,想到 busybox 不止依赖这一个库,想要一次把所有依赖的动态库都拷贝过去,于是使