安装CentOS后的基本配置

1、网络配置

1.1 CentOS 6
        1)  vi /etc/sysconfig/network-scripts/ifcfg-eth0
             ONBOOT=yes
             BOOTPROTO=static
             IPADDR=192.168.153.136
             NETMASK=255.255.255.0
             GATEWAY=192.168.153.2(网关在虚拟机网络编辑器->NET设置中可以看到)
             DNS1=192.168.153.1
        2) service network restart
        3) ifconfig,查看IP是否配置好
        4) ping www.baidu.com,验证是否可以访问外网   
  

1.2 CentOS 7
        1) vi /etc/sysconfig/network-scripts/ifcfg-eno16777728 
            BOOTPROTO=static  --配置静态ip
            ONBOOT=yes  --开机启动
            IPADDR=192.168.153.136  --ip地址
            NETMASK=255.255.255.0  --子网掩码
            GATEWAY=192.168.153.1  --网关
            DNS1=8.8.8.8  --Google dns地址  114.114.114.114--国内dns
         2) service network restart(新命令:systemctl restart network.service
         3) 最小化安装时,没有ifconfig
         4) ping www.baidu.com,验证是否可以访问外网   

2、修改主机名

2.1   修改hosts

         [root@localhost ~]# vi /etc/hosts

         默认值值不要删除,添加一行

         192.168.153.136 node1
         
2.2   修改hostname

         [root@localhost ~]# vi /etc/hostname

         node1

2.3    重启 

         [root@localhost ~]#shutdown -r now

         查看主机名是否改变

3、更改镜像源

3.1  安装wget

       [root@node1 ~]#yum install -y wget

3.2  下载aliyun的repo

      [root@node1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.3  更新镜像源

       [root@node1 ~]#yum clean all

       [root@node1 ~]#yum makecache

3.4 测试

      [root@node1 ~]#yum install -y vim

      [root@node1 ~]#yum install net-tools

 

4、关闭防火墙和Selinux

4.1 CentOS6

     [root@node1 ~]#chkconfig iptables off

     [root@node1 ~]#vi /etc/selinux/config
       修改:SELINUX=disabled

4.2 CentOS7

     [root@node1 ~]# systemctl disable firewalld
     Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
     Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
     [root@node1 ~]# systemctl stop firewalld


     [root@node1 ~]# setenforce 0
     [root@node1 ~]# vi /etc/selinux/config
     SELINUX=disabled

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值