栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

CentOS7-基础环境命令集锦(防火墙、SELinux、yum源、内核升级、网络主机配置、docker、K8S环境基础、kubesphere)

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CentOS7-基础环境命令集锦(防火墙、SELinux、yum源、内核升级、网络主机配置、docker、K8S环境基础、kubesphere)

装个Linux环境总会遇到各种坑,以下命令基本上会经常遇到

如果图省事,可以直接使用本人做好的virtualbox镜像,下载就能用。

https://blog.csdn.net/class_c/article/details/120624120

0、开启网络

ip addr
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
sed -i 's/onBOOT=no/onBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-enp0s3
systemctl restart network

1、查看防火墙状态

firewall-cmd --state

2、停止firewall

systemctl stop firewalld.service

3、禁止firewall开机启动

systemctl disable firewalld.service

4、禁用SELinux

sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config

 5、设置阿里源

curl -o /etc/yum.repos.d/CentOS-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum update
yum makecache
yum install git vim wget openssl-devel ntpdate make gcc-c++ ncurses-devel net-snmp sysstat lrzsz zip unzip tree net-tools lftp -y

6、检查当前 CentOS 系统版本

uname -a

7、安装elrepo源升级内核

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

8、查看最新版内核

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

9、安装新内核(主线版本)

yum --enablerepo=elrepo-kernel install kernel-ml

10、查看系统上的所有可用内核

awk -F' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

11、设置默认内核版本

grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg

12、设置主机名

hostname 
hostnamectl set-hostname master

13、ifconfig、wget安装

yum install wget net-tools.x86_64 -y

14、docker安装(开机启动)

yum update
yum remove docker  docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
systemctl start docker
systemctl enable docker
docker version

15、nginx安装

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
systemctl start nginx.service
systemctl enable nginx.service

16、重启系统

reboot

17、kubesphere安装(选择最新版)

cd ~
yum install -y curl openssl socat conntrack ebtables ipset
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.1

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/300331.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号