y23335793 发表于 2019-2-15 14:20:30

CentOS 系统基本配置

  系统基本配置
  建议修改系统环境英文,通过SSH远程工具管理不会出现乱码
vi /etc/sysconfig/i18n
LANG=”en_US”
  建议关闭SELINUX
vi /etc/sysconfig/selinux
http://i2.运维网.com/images/blog/201811/28/10b8a1d7603584317ae6d6e523e750f6.png
  一、网络配置
1、通过网卡配置文件配置
vi /etc/sysconfig/network-scripts/ifcfg-eth0
http://i2.运维网.com/images/blog/201811/28/bbd50e1d814b6aea1549fa35342d9820.png
2、修改计算机名
vi /etc/sysconfig/network
http://i2.运维网.com/images/blog/201811/28/2700daaa89eff2b15d469347e4a23ddf.png
3、配置DNS
vi /etc/resolv.conf
http://i2.运维网.com/images/blog/201811/28/2dbe27377427d4a10055b798b39dc537.png
配置完成后重新启动网络服务
service network restart
http://i2.运维网.com/images/blog/201811/28/033ad6de731adb5c237ef2d6a78f6672.png
4、通过菜单配置网络---TAB切换
setup
http://i2.运维网.com/images/blog/201811/28/5669e39e98ec0fc6ca3cc46c02407ef6.png
http://i2.运维网.com/images/blog/201811/28/3ae12e0b2e8797b69469fa0a7a8ececa.png
  配置IP
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=f90d9f87-dc35-4c67-863d-76c8d15f1e4a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=50:46:5D:73:3C:22
IPADDR=192.168.2.18
PREFIX=24
GATEWAY=192.168.2.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
  配置计算机名
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=manager
  配置DNS
# vi /etc/resolv.conf
nameserver 61.139.2.69
  配置本地yum源
# vi local.repo

name=local
baseurl=file:///var/centos6.8/
enabled=1
gpgcheck=0
  # yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos: base extras local updates
Cleaning up Everything
# yum makecache
  关闭SElinux
# vi /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
  更新服务器时间
# ntpdate time.windows.com && hwclock -w && hwclock --systohc
14 Jun 16:38:40 ntpdate: adjust time server 40.69.40.157 offset -0.015351 sec
  关闭不用的服务
  查看不用的服务
# chkconfig --list |egrep -v "crond |haldaemon |iptables |irqbalance |messagebus |netfs |network |rsyslog |sshd |sysstat |udev-post"
  编写脚本处理
# cat chkconfig.sh
#!/bin/bash
# close service all
for s1 in chkconfig --list |egrep -v "crond |haldaemon |iptables |irqbalance |messagebus |netfs |network |rsyslog |sshd |sysstat |udev-post" |awk '{print $1}'
do
chkconfig $s1 off
done
  创建普通用户
# useradd xk
# passwd xk
Changing password for user xk.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
  授权普通用户管理
# visudo
root    ALL=(ALL)       ALL
user   ALL=(ALL)       ALL
  调整文件描述符
# vi /etc/security/limits.conf
#               soft    core            0
#               hard    rss             10000
#@student      hard    nproc         20
#@faculty      soft    nproc         20
#@faculty      hard    nproc         50
#ftp             hard    nproc         0
#@student      -       maxlogins       4

[*]

[*]nofile          65535

  # ulimit -n
65535
  清除登录时显示内核信息
# echo >/etc/issue
# echo >/etc/redhat-release



页: [1]
查看完整版本: CentOS 系统基本配置