Centos7 Redhat7使用
作者
QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118
参考
Open Source: NTFS-3G
在linux中如何解压.tgz
RedHat 挂载 NTFS
RHEL7配置中文输入法-智能拼音
redhat下软件安装
centos官方源
centos阿里源
CentOS7下内核源码下载及编译步骤
初始值设置项里有未知的字段ndo_change_mtu
Centos 7.0设置/etc/rc.local无效问题解决
CentOS7查看和关闭防火墙
配置本地yum源找不到repomd.xml的解决方法
CentOS安装相应版本的内核源码
Centos7下载linux内核源码
CentOS8 安装epel 使用阿里云镜像
centos wiki I_need_the_Kernel_Source
阿里云Centos镜像源和EPEL源
构建CentOS dwarves包
解决vncserver启动报错 Job for vncserver@:1.service failed because a configured resource limit was exceed.
安装系统
Centos7和Redhat7同版本之间是兼容的,但是不确定Centos7.4和Centos7.7之间是否兼容,而目前国内的源上已经无法下载老版本的Centos7只有最新的CentOS-7-x86_64-DVD-1908.iso
或者Centos8。Centos7.4的版本号,我安装的时候选择的是开发版本
,
$ uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
内核
下载对应内核源码3.10.0-693.el7.x86_64
,所有包的源码包rpm路径为http://vault.centos.org/centos/7.4.1708/os/Source/SPackages/
。
下载Centos8内核源码,https://vault.centos.org/8.3.2011/BaseOS/Source/SPackages/kernel-4.18.0-193.el8.src.rpm
[ ] kernel-4.18.0-193.1.2.el8_2.src.rpm 2020-06-04 13:35 110M
[ ] kernel-4.18.0-193.6.3.el8_2.src.rpm 2020-06-10 12:36 110M
[ ] kernel-4.18.0-193.14.2.el8_2.src.rpm 2020-07-29 22:04 110M
[ ] kernel-4.18.0-193.19.1.el8_2.src.rpm 2020-09-16 20:44 110M
[ ] kernel-4.18.0-193.28.1.el8_2.src.rpm 2020-10-22 03:00 110M
[ ] kernel-4.18.0-193.el8.src.rpm 2020-05-29 15:54 110M
[ ] kernel-4.18.0-240.1.1.el8_3.src.rpm 2020-11-19 23:52 113M
[ ] kernel-4.18.0-240.10.1.el8_3.src.rpm 2021-01-19 19:59 113M
[ ] kernel-4.18.0-240.15.1.el8_3.src.rpm 2021-03-02 16:27 113M
[ ] kernel-4.18.0-240.22.1.el8_3.src.rpm 2021-04-08 20:13 113M
[ ] kernel-4.18.0-240.el8.src.rpm 2020-09-28 16:45 113M
安装,在/root/rpmbuild/SOURCES
有一个压缩包linux-4.18.0-240.el8.tar.xz
即为内核源码包,
# groupadd mockbuild
# useradd mockbuild -g mockbuild
# rpm -ivh kernel-4.18.0-240.el8.src.rpm
Updating / installing...1:kernel-4.18.0-240.el8 ################################# [100%]
[root@localhost ~]# ls -l /root/rpmbuild/SOURCES/
-rw-rw-r--. 1 mockbuild mockbuild 112560684 Sep 25 2020 linux-4.18.0-240.el8.tar.xz
编译,
# yum install rpm-build asciidoc audit-libs-devel binutils-devel bison dwarves elfutils-devel flex gcc git java-devel kabi-dw libbabeltrace-devel libbpf-devel libcap-devel libcap-ng-devel llvm-toolset m4 make ncurses-devel newt-devel nss-tools numactl-devel openssl-devel pciutils-devel perl perl-devel perl-generators pesign python3-devel python3-docutils xmlto xz-devel zlib-devel
No match for argument: dwarves
No match for argument: libbabeltrace-devel
No match for argument: libbpf-devel
Error: Unable to find a match: dwarves libbabeltrace-devel libbpf-devel
# cd /root/rpmbuild/SPECS/
# rpmbuild -bp --target=$(uname -m) kernel.spec
# cd /root/rpmbuild/BUILD/kernel-4.18.0-240.el8/linux-4.18.0-240.el8.x86_64
# cp /boot/config-4.18.0-240.el8.x86_64 .config
# make -j8
安装软件
- 中文输入法
- 可挂载ntfs格式文件系统
中文输入法用于百度搜索,ntfs挂载后可以把rhel的iso烤出来,下一步配置本地软件源。
$ ./configure
$ make && make install
$ mkdir zc
$ mount -t ntfs-3g /dev/sdb1 ./zc
$ cp rhel-server-7.4-x86_64-dvd.iso ../
$ mkdir rhel-7.4-yum
$ mount rhel-server-7.4-x86_64-dvd.iso ./rhel-7.4-yum
$ ls /etc/yum.repos.d/
$ sudo mkdir /etc/yum.repos.d/backup
$ sudo mv /etc/yum.repos.d/*.repo backup
$ vim /etc/yum.repos.d/yum.repo
$ cat /etc/yum.repos.d/yum.repo
[centos7.4]
name=centos7.4
baseurl="file:///run/media/qe/CentOS 7 x86_64" #cdrom
gpgcheck=0
$ yum clean all
$ yum makecache
$ yum repolist
$ sudo yum install ftp
$ yum install minicom
$ yum install wireshark
$ yum install wireshark-gnome
$ wireshark
编译驱动,其实下面的已经安装了,
yum install gcc kernel-headers kernel-devel
可直接执行编译,
#ccflags-y += -Wno-error=date-timeifneq ($(KERNELRELEASE),)
obj-m:=pcie_ep.o
else
KERNELDIR:=/lib/modules/`uname -r`/build
PWD:=$(shell pwd)modules:$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install.PHONY: clean
clean:rm -rf *.o *.mod.c *.mod.o *.ko *.order *symvers .*.cmd
endif
网卡驱动从centos7.4迁移到centos7.6报错初始值设置项里有未知的字段ndo_change_mtu
,修改ndo_change_mtu
为ndo_change_mtu_rh74
。
配置阿里源
epel企业源,
# yum install epel-release
# cp bak/CentOS-Linux-PowerTools.repo .
[root@localhost yum.repos.d]# vim CentOS-Linux-PowerTools.repo
# CentOS-Linux-PowerTools.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.[powertools]
name=CentOS Linux $releasever - PowerTools
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
离线安装rpm
rpm -ivh *.rpm
开机自启动
由于/etc/rc.local是/etc/rc.d/rc.local的软连接,所以必须确保/etc/rc.local和/etc/rc.d/rc.local都有可执行权限,
$ ls -l /etc/rc.local
lrwxrwxrwx 1 root root 13 1月 21 2021 /etc/rc.local -> rc.d/rc.local
$ sudo chmod a+x /etc/rc.local
$ sudo chmod a+x /etc/rc.d/rc.local
systemctl enable rc-local
systemctl start rc-local
脚本中所有的路径都必须使用绝对路径,添加[Install]
字段,
[storage@localhost ~]$ cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.touch /var/lock/subsys/local
ifconfig enp14s0f0 192.168.1.10
mkdir -p /run/media/root/Kylin-Server-10
mount /home/storage/Kylin-Server-10-SP1-Build01-20210309-JUN-arm64.iso /run/media/root/Kylin-Server-10
[storage@localhost ~]$ cat /lib/systemd/system/rc-local.service
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
[Unit]
Description=/etc/rc.d/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.d/rc.local
After=network.target[Service]
Type=forking
ExecStart=/etc/rc.d/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no[Install]
WantedBy=multi-user.target
关闭防火墙
$ firewall-cmd --state
$ systemctl stop firewalld.service
本地源
可以从光盘内copy目录结构,由于我的repomd.xml抱错,使用命令重新建立repo,
$ cp /run/media/qe/CentOS 7 x86_64/* iso
$ creatrepo iso
配置网络
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-enaphyt4i0
BOOTPROTO=static
ONBOOT=no
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
NAME=enaphyt4i0
DEVICE=enaphyt4i0
$ sudo systemctl restart network
远程登录
$ yum -y install yum grouplist
$ yum groupinstall -y "GNOME Desktop"
$ systemctl set-default graphical.target
$ systemctl set-default multi-user.target
$ yum install tigervnc-server -y
$ rpm -qa|grep tigervnc-server
$ cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
$ vi /etc/systemd/system/vncserver\@\:1.service
$ cat /etc/systemd/system/vncserver\@\:1.service
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace <USER> with the actual user name and edit vncserver
# parameters appropriately
# (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
# PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target[Service]
Type=forking# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'[Install]
WantedBy=multi-user.target
$ vncpasswd
$ systemctl start vncserver@\:1.service
$ systemctl daemon-reload
$ ps -ef | grep vnc
$ netstat -ant | grep 5901
$ service iptables status
$ systemctl status iptables
$ systemctl status firewalld
$ systemctl stop firewalld
$ systemctl disable firewalld
修改分辨率,
# vi /usr/bin/vncserver
$geometry = “1920×1080″;
Centos7 Redhat7使用相关推荐
- Win7/8/10安装Centos7/Redhat7双系统丢失windows启动项的解决办法
Win7/8/10安装Centos7/Redhat7双系统后可能会丢失windows启动项,这是因为Linux系统默认将mbr改写成grub2,新安装的Linux系统默认不识别windows下的ntf ...
- centos7/redhat7创建私有云(owncloud)
大家好,这里是centos7/redhat7私有云搭建教程 提到云,大家的第一印象是不是这样的: 或者是这样的: 但是,这里要讲的是这样的: 云计算: 首先了解以下分布式文件系统云计 ...
- linux centos7 redhat7 怎么设置开机自动进入命令行模式
设置 centos7/redhat7 开机默认进入命令行模式 首先用 root 用户打开配置文件 inittab,执行命令: vim /etc/inittab 由于 centos7 的 inittab ...
- Centos7 / RedHat7中安装openldap
参考地址: 地址1:https://mp.weixin.qq.com/s?__biz=MzI4OTY3MTUyNg==&mid=2247488759&idx=1&sn=2613 ...
- Centos7/RedHat7 下 python3使用cx-freeze打包matplotlib程序遇到的问题和解决办法
折腾了一天遇到了几个头疼的问题,还好回去前解决掉了 第一个:执行cxfreeze打包好的程序遇到 tkinter 和 _tkinter的缺失问题 首先终端:python tkinter python ...
- CentOS7 RedHat7 添加静态路由方法
一.添加临时静态路由(即重启后失效) ip route add 172.22.2.0/24 via 172.22.3.254 dev eno16777984 二.添加永久路由 编辑或新建/etc/sy ...
- Fedora/CentOS7/RedHat7关闭图形桌面开启文本界面
1,命令模式 systemctl set-default multi-user.target 2,图形模式 systemctl set-default graphical.target 参考原文:ht ...
- Centos7/RedHat7安装NVIDIA显卡驱动
Linux系统一般默认安装的是开源的nouvea显卡驱动,它与nvidia显卡驱动产生冲突,欲装nvidia必禁nouvea!其次Nvidia驱动默认安装OpenGL桌面,然而这又与GNOME桌面冲突 ...
- centos7/redhat7离线安装postgresql+postgis并配置主从并做故障切换演练(9.6、11.6、13和14版本)
一.安装postgresql.postgis(有9.6/11.6/13/14各版本的离线安装包) 以下例子安装的版本为postgresql13.postgis30_13,因已提前准备好安装所需的RPM ...
- centos7/redhat7 PostgreSql搭建主从同步+Keepalived高可用 数据库高可用
一.安装postgresql 此次安装版本为postgresql11.6,因已提前准备好安装所需的RPM包,所以使用RPM形式安装. 1.rpm包安装: mkdir /tmp/pgsql && ...
最新文章
- 解除织梦dedeCMS标题/关键词/ 简略标题长度限制听语音
- Java项目实例教程详细
- 想和高手侃侃而谈C++引用?看这一篇就够了【C++引用】
- 词法分析(3)---DFA
- 使用Docker-Compose搭建高可用redis哨兵集群
- 10 MM配置-主数据-定义物料类型
- 我的DWR学习(二)
- 编译安装RRDtool报错
- Java 中时间处理SimpleDateFormat 中HH和hh的区别
- Java的%=是什么意思?%=运算的正确使用
- Oracle 11gR2 RAC的两个bug
- 苹果核 - iOS端Mock GPS定位 —— 测试、开发、玩游戏、发朋友圈等等,你都用得上...
- 大疆 RoboMaster 3508/2006/GM6020 电机使用教程
- Zigbee和WiFi的信道重叠
- java七年_阿里七年Java程序员的总结,献给还在迷茫中的你!
- 用for循环写520个我喜欢你
- 多重if 和 嵌套 if 选择结构
- redis学习--三种特殊数据类型,GEO地理位置,HyperLogLog,BitMap
- terminal的常用快捷键
- web开发下的HTTP编程及接口回调的使用
热门文章
- 华为手机遮挡html页面,手机知识:华为手机老是显示屏幕被遮挡
- 安川机器人如何注释化指令_安川机器人指令案例汇总
- pc游戏手柄测试软件,《原神》PC版技术性开发测试,游戏手柄操作更佳爽快
- FIT2CLOUD飞致云正式启用CloudExplorer多云管理平台产品品牌
- 《凤凰项目:一个IT运维的传奇故事》读书笔记
- 计算机设计大赛的感悟,计算机设计大赛含金量
- ZedGraph类库之基本教程篇
- micropython 移植k210_重构+优化 micropython 下 k210 (esp8285) 的 AT network 通信过程(附代码,顺便讲讲状态机实现)。...
- 十大排序算法之二路归并排序(难点为对于递归的理解)
- 运营商级ICT项目建设之雪亮工程方案,提升群众安全感