操作系统安装
略……
操作系统配置
网络配置
图形界面配置工具nmtui(centos7之前版本的setup)
配置文件
[root@bluse]#cat /etc/sysconfig/network-scripts/ifcfg-eth0 NAME=eth0 DEVICE=eth0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=none DEFROUTE=yes IPADDR=172.16.90.22 NETMASK=255.255.255.0 GATEWAY=172.16.90.254 IPV4_FAILURE_FATAL=no DNS1=172.16.90.53 DNS2=114.114.114.114
确认ssh远程登陆
确认是否安装,并随机启动yum list installed | grep openssh-server systemctl status sshd
配置文件路径/etc/ssh/sshd_config,可按需配置
关闭selinux、关闭防火墙、关闭postfix
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config systemctl stop firewalld systemctl disable firewalld systemctl stop postfix systemctl disable postfix
修改最大文件打开数
echo -e '* soft nofile 65535\n* hard nofile 65535\n* soft nproc 65535\n* hard nproc 65535' >> /etc/security/limits.conf
修改完后重启系统,然后ulimit -n确认
安装常用工具
yum install -y vim wget lrzsz lsof zip unzip telnet net-tools bash-completion
更换yum源
mkdir /etc/yum.repos.d/backup mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache
修改主机名
hostnamectl set-hostname [IP]
配置history格式
/etc/profile
添加以下变量用于显示命令执行时间
、用户名
、执行者IP
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` export HISTTIMEFORMAT="[%F %T][`whoami`][${USER_IP}]"
/etc/profile
中HISTSIZE=1000(默认值)可按需修改source /etc/profile
时间同步
# 安装 yum install -y chrony # 启用 systemctl start chronyd systemctl enable chronyd # 设置时区 timedatectl set-timezone Asia/Shanghai # 启用NTP同步 timedatectl set-ntp yes
#查看同步源
chronyc sources
同步server可在配置文件中修改/etc/chrony.conf
附:关于分区
/boot 分配300M
swap 根据物理内存大小分配,物理内存n≤4G时分2*n,4G≤n≤16G分n,n>16G分4G即可
/home 分配20G
/ 分配20G
/data 剩余
本文含有隐藏内容,请 开通VIP 后查看