首页 > 系统相关 >centos8环境基本优化

centos8环境基本优化

时间:2023-07-04 16:22:35浏览次数:104  
标签:centos CentOS mirrors com 环境 etc aliyun 优化 centos8

centos8环境基本优化

目录

1.防火墙优化

参考链接

https://www.cnblogs.com/zttong/p/17511695.html

systemctl stop firewalld && systemctl disable firewalld
cat /etc/selinux/config
setenforce 0 && sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config

2.源优化:

方案1.更换阿里源

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum makecache
安装epel源
dnf install epel-release -y

方案2.使用centos8.5 源

[root@models yum.repos.d]# cat CentOS8-vault.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# 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, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-8.5.2111 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
#additional packages that may be useful
[extras]
name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/centosplus/$basearch/os/
gpgcheck=0
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
[PowerTools]
name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/PowerTools/$basearch/os/
gpgcheck=0
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official


[AppStream]
name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/$basearch/os/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

安装epel源

dnf install epel-release -y 

3.ssh连接慢解决

ll /etc/ssh/sshd_config 
vim     /etc/ssh/sshd_config
GSSAPIAuthentication no
UseDNS no

[root@oldboy-muban ~]# egrep '^GSSAPIA|^UseDNS'
/etc/ssh/sshd_config
GSSAPIAuthentication no
UseDNS no
systemctl restart sshd   未来连接速度就很快

4.关闭公网,只开放内网(可选)

[root@huge-muban ~]# systemctl disable NetworkManager

Removed symlink /etc/systemd/system/multi
user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus
org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network
online.target.wants/NetworkManager-wait-online.service.
[root@huge-muban ~]# systemctl stop NetworkManager

5.配置定时任务,时间同步

centos7 ntpd

crontab -e

# sync time by huge

*/2 * * * * /sbin/ntpdate   ntp1.aliyun.com &>/dev/null

centos8

[root@models yum.repos.d]# rpm -qa |grep chrony
chrony-3.5-1.el8.x86_64
dnf install chrony -y 

6.PS1

PS1 控制命令行格式
man bash 搜索PS1
vim /etc/profile   最后一行写入
export PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ '
[root@huge-muban ~]# tail -1   /etc/profile
export PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\
[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ '
[root@huge-muban ~]# source /etc/profile

[故障集合]Linux必备故障及原因50个
https://www.jianshu.com/p/99ec5bb4183f

7.配置sudo

[root@huge-muban ~]$ grep wheel /etc/sudoers
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
# %wheel ALL=(ALL) NOPASSWD: ALL
[root@oldboy-muban ~]$ id huge
uid=1000(hueg) gid=1000(huge)
groups=1000(huge),10(wheel)
想要配置可以这么操作
huge  ALL=(ALL) NOPASSWD: ALL

标签:centos,CentOS,mirrors,com,环境,etc,aliyun,优化,centos8
From: https://www.cnblogs.com/zttong/p/17526055.html

相关文章

  • vscode python开发环境搭建
    vscode是微软开发的轻量级ide软件,有大量的插件,很适合python开发。以下简述vscode的python开发环境搭建步骤:一、官网下载vscode软件基于安全考虑软件下载最好到官网下载。vscode官网地址:https://code.visualstudio.com/download,到2023年7月4日最新版本为:VSCodeUserSetup-x64-1.......
  • 数仓性能调优:大宽表关联MERGE性能优化
    摘要:本文主要为大家讲解在数仓性能调优过程中,关于大宽表关联MERGE性能优化过程。本文分享自华为云社区《GaussDB(DWS)性能调优:大宽表关联MERGE性能优化》,作者:譡里个檔。【业务背景】如下MERGE语句执行耗时长达2034sMERGEINTOsdifin.hah_ae_line_sr_t_02_8663Event_1u18ol......
  • 【ROS学习】基本环境安装-虚拟机VMware、Ubuntu20.04和ROS
    根据网络信息,虚拟机工具有hype-v、virtualbox和VMware,其中hyper-v是windows自带,使用的是物理机虚拟化,效率最高,但也因此带来一些别的影响,其不能使用USB外设,综合起来VMware的表现最为均衡,运行还算流畅,显示方面也挺好安装VMware和Ubuntu20.04Ubuntu20.04中安装ROSnoeticrosdep......
  • Nginx一网打尽:动静分离、压缩、缓存、黑白名单、跨域、高可用、防盗链、SSL、性能优化
    Nginx一网打尽:动静分离、压缩、缓存、黑白名单、跨域、高可用、防盗链、SSL、性能优化...架构营 2023-07-0307:10 发表于上海收录于合集#nginx2个#架构172个#web2个引言一、性能怪兽-Nginx概念深入浅出二、Nginx环境搭建三、Nginx反向代理-负载均衡......
  • 模型部署_模型量化、优化、编译、仿真、部署
    两种思路探路--由目前技术看未来-能做什么?造路--由目标而开始构建-要做什么?板子新唐NuMicro™Nano系列为32位单片机地平线旭日X3派RDK系列(HorizonRoboticsDeveloperKits,简称RDK)基于RDKX3(旭日X3派TogetheROS.Bot机器人操作系统(简称TROS.B)—RDKX3Module,模......
  • 最新windows10 下搭建vue开发环境
    特别说明:下面任何命令都是在windows的命令行工具下进行输入,打开命令行工具的快捷方式如下图: 详细的安装步骤如下:一、安装node.js说明:安装node.js的windows版本后,会自动安装好node以及包管理工具npm,我们后续的安装将依赖npm工具。node.js的官方地址为:https://nodejs.org/e......
  • 第四天(Thymeleaf,MVC自动配置原理,,配置项目环境及首页,页面国际化,登录+拦截器)
    ThymeleafMVC自动配置原理ContentNegotiatingViewResolver内容协商视图解析器转换器和格式化器配置项目环境及首页页面国际化中英切换登录+拦截器......
  • day05--23.7.3JDK、JRE、JVM以及开发环境搭建
    JDK、JRE、JVMJDK:JavaDevelopmentKit--JAVA开发者工具--用于程序开发java--编译运行javajavac--编译运行javajavadoc--java生成文档jar--java打包成应用JRE:JavaRuntimeEnvironment--JAVA运行时环境appletlibrariesJVM:JavaVirtualMachine--JAVA虚拟机java开发......
  • Windows环境下nvm的安装与使用
    nvm全名node.jsversionmanagement,顾名思义是一个管理多个nodejs的版本工具。通过它可以安装和切换不同版本的nodejs,为了解决node.js各种版本存在不兼容现象可以通过它可以安装和切换不同版本。一、下载nvm安装包地址: https://github.com/coreybutler/nvm-windows/releases......
  • Bat批处理命令实现一键安装mysql环境
    已测试可用的版本MySQL8.0;环境:windows7/10MySQL8.0.15免安装版项目需求需要实现一个自动化MySQL配置安装及初始化数据库(初始化包括:设置用户名和密码)。批处理用来对某对象进行批量的处理,即可通过批处理让相应的软件执行自动化操作。MySQL免安装版使用步骤:1.配置环境变量2.创建MySQ......