centos7初始安装。
1、创建一个普通管理用户(非特权用户root)
可以在系统安装过程中创建,也可以在系统安装完成重启后创建。 如docker用户
adduser docker #添加用户
passwd docker #设置密码
#将用户docker加入sudoers中,以便让docker用户可以使用sudo命令日常管理。
vi /etc/sudoers
## Allow root to run any commands anywhere root ALL=(ALL) ALL docker ALL=(ALL) ALL
新加入一行 docker ALL=(ALL) ALL 即可。
2、配置ip、网关、dns
可以在系统安装过程中配置,也可以在系统安装完成重启后配置。
ip addr #查看本机ip
vi /etc/sysconfig/network-scripts/ifcfg-ens33 ,修改如下
TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="yes" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" UUID="d0b6e214-230f-42b4-89f5-39010bdbbbe7" DEVICE="ens33" ONBOOT="yes" IPADDR="192.168.9.101" PREFIX="24" GATEWAY="192.168.9.2" DNS1="114.114.114.114" IPV6_PRIVACY="no"
注: IPADDR 配置IP地址
GATEWAY 配置网关
DNS1 配置dns
service network restart 或者 systemctl restart network 重启网卡服务。
3、配置主机名,hosts文件。
主机名可以在系统安装过程中配置,也可以在系统安装完成重启后再手动配置。
hostnamectl set-hostname docker02 #命令行配置主机名为docker02 (临时)
hostname #查看主机名
vi /etc/hostname #永久修改
docker02
保存ok!!
#修改host文件
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.9.101 docker02
配置hosts文件,192.168.9.101是本机ip,docker02是本机主机名。
4 、关闭防火墙、关闭selinux
##关闭防火墙
#临时关闭
systemctl stop firewalld
#禁止开机启动
systemctl disable firewalld
如果有iptables,也可以将iptables关闭。
#临时关闭
service iptables stop
#禁止开机启动
chkconfig iptables off
##关闭selinux
vi /etc/selinux/config
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
将SELINUX=enforcing 注释掉,修改为SELINUX=disabled
:x 保存退出。
5、安装一些系统软件
yum install ntpdate -y #ntp网络时间同步
yum install tree -y #能够以树状结构查看目录
Copyright © 叮叮声的奶酪 版权所有
备案号:鄂ICP备17018671号-1