1.查看linux内核版本
# uname -srm
输出: Linux 3.10.0-1160.e17.x86_64 x86_64
# cat /etc/redhat-release
CentOS Linux release 7.9.2009(Core)
2.修改机器名
vi /etc/hostname
修改完成后重启
reboot
3.修改IP地址
查看ip
ip a
修改ip:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
VMware查看网关
修改完成后
service network restart
service network start/stop/restart
systemctl restart/stop/start/status network
4.关闭防火墙
关闭
systemctl start/stop/disable firewalld
5.关闭Linux SELinux
1.临时关闭
setenforce 0
2.永久关闭
vi /etc/selinux/config
6.修改yum源
如果机器没有wget需要下载repo文件并上传
首先下载http://mirrors.163.com/.help/CentOS7-Base-163.repo
备份原有的文件
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.back
[base]name=CentOS-$releasever - Base - 163.com baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7#released updates[updates]name=CentOS-$releasever - Updates - 163.com#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesbaseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - 163.com#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasbaseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - 163.combaseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
yum makecache
yum install ***
7.免密登录
/usr/bin/ssh-kengen -t rsa
下发到其他机器
/usr/bin/ssh-copy-id -i ./id_rsa.pub 192.168.218.102
登录102机器
ssh 192.168.218.102
8.查看端口占用
natstat -nat|grep -E "8030|9090|8080"
9.修改Linux句柄数
vi /etc/security/limits.conf
添加到文件最后
* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
临时生效
ulimit -n 65535
永久生效需要重启
10.关闭交换分区
查看交换分区
free -m
关闭
swapoff -a
网友评论