centos7最小化安装需安装

centos7最小化安装需安装

1.查看ip地址并更改计算机名称
ip a
ip addr
ip address show
hostnamectl set-hostname kht127
2.安装vim和wget
yum install -y vim
yum install -y wget
yum install -y iotop
3.使用ifconfig查看ip地址必须命令安装
yum provides ifconfig
yum install -y net-tools
yum install -y lsof
lsof -i:80
ss -nutl|grep 80
netstat -ant|grep 80
查看当前所有已经使用的端口情况:netstat   -nult
4.CentOS 7关闭SELinux
查看状态
[root@localhost ~]# getenforce
Enforcing
临时关闭
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
永久关闭vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
设置后需要重启才能生效
5.配置静态ip,参考http://www.mamicode.com/info-detail-1748320.html
IPADDR=192.168.2.127
NETMASK=255.255.255.0
GATEWAY=192.168.2.2
DNS1=8.8.8.8
DNS2=114.114.114.114
BROADCAST=192.168.2.255
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
#更改为static
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="19868ad2-4f2e-40c5-af2a-67f33631b221"
DEVICE="ens33"
ONBOOT="yes"
#以下为新增
IPADDR=192.168.2.100
NETMASK=255.255.255.0
GATEWAY=192.168.2.2
DNS1=8.8.8.8
DNS2=114.114.114.114
BROADCAST=192.168.2.255
6.防火墙基本命令
systemctl unmask firewalld                    #执行命令,即可实现取消服务的锁定
systemctl mask firewalld                       # 下次需要锁定该服务时执行
systemctl start firewalld.service               #启动防火墙  
systemctl stop firewalld.service                #停止防火墙  
systemctl reloadt firewalld.service             #重载配置
systemctl restart firewalld.service             #重启服务
systemctl status firewalld.service              #显示服务的状态
systemctl enable firewalld.service              #在开机时启用服务
systemctl disable firewalld.service             #在开机时禁用服务
systemctl is-enabled firewalld.service          #查看服务是否开机启动
systemctl list-unit-files|grep enabled          #查看已启动的服务列表
systemctl --failed                                     #查看启动失败的服务列表
7.安装jdk,参考网址https://www.cnblogs.com/116970u/p/10400436.html
8.安装系统默认jdk,简易性安装:yum install java-devel
9.设置时间自动同步,安装chrony并设置开机启动
yum install -y chrony
systemctl start chronyd
systemctl enable chronyd

ulimit -SHn 65535 含义

1.linux下用ulimit设置连接数最大值,默认是1024.在高负载下要设置为更高,但最高只能为65535.
2.ulimit只能做临时修改,重启后失效。可以加入ulimit -SHn 65535 到 /etc/rc.local 每次启动启用。
3.终极解除 Linux 系统的最大进程数和最大文件打开数限制:
vim /etc/security/limits.conf
# 添加如下的行
* soft nproc 11000
* hard nproc 11000
* soft nofile 655350
* hard nofile 655350

4.含义如下:
* 代表针对所有用户
• soft nproc: 可打开的文件描述符的最大数(软限制)
• hard nproc: 可打开的文件描述符的最大数(硬限制)
• soft nofile:单个用户可用的最大进程数量(软限制)
• hard nofile:单个用户可用的最大进程数量(硬限制)
#使用阿里云镜像,备份之前的
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all 
#使用阿里云镜像,备份之前的
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install epel-release
yum install pv -y
pv --version
posted @ 2021-09-02 17:36  kht  阅读(357)  评论(0编辑  收藏  举报