CentOS安装配置记录

版权声明:本文为博主原创文章,如果帮到你请点赞☺☺☺。 https://blog.csdn.net/qq_37902949/article/details/85037282

记录下自己安装CentOS安装配置过程注意的地方。 

安装过程
1、时间选择
2、开启网络
3、分区
...其他点开看配置
4、host name : localhost.localdomain
5、root账号密码:root
6、常用账号:zj  密码:123
查看授权:ls -l /etc/sudoers
开启写权限:chmod -v u+w /etc/sudoers
进入编辑: vim /etc/sudoers 
在 root    ALL=(ALL)       ALL  下添加新增的用户
zj     ALL=(ALL)       ALL(或者NOPASSWD:ALL不需密码sudo)  
收回写权限:chmod -v u-w /etc/sudoers
7、vim使用:http://www.runoob.com/linux/linux-vim.html
8、yum软件安装配置源
9:、安装vim:yum install vim -y
10、安装wget(如果没有): yum install wget -y (-y确保下载)

查看与设置网络
cd /etc/sysconfig/network-scripts/
vim /etc/sysconfig/network-scripts/ifcfg-ens33 =>编辑网络配置文件
BOOTPROTO=dhcp/static/none[服务IP一般都是固定的]=> 设置IP获取方式 static
ONBOOT=yes :系统启动时候主动建立网络连接,
IPADDR  设置IP地址  如192.168.1.103
GATEWAY:192.168.1.1 设置网关
NETMASK:设置子网掩码(255.255.255.0)=> 或者直接设置:(设置这个好)PREFIX=24 [自动获取网络匹配子网掩码]
DNS1、DNS2:(DNS1  192.168.1.1填这一个就好) 不行再设置具体的如 202.96.134.33   202.96.126.86
systemctl restart network.service/service network restart:重启网关
systemctl restart network 重启网卡
systemctl stop network    停止网卡
systemctl start network    启动网卡
systemctl status network  查看网卡状态【active->激活,dead->停止】
查看地址:ip addr  
查看连接:ip link 
查看统计:ip -s link
检查dns:route -n

一、防火墙
CentOS 7.0默认使用的是firewall作为防火墙(以下为暴力关闭防火墙,具体应该使用开放端口的方法)
查看防火墙状态:firewall-cmd --state
停止firewall:systemctl stop firewalld.service
禁止firewall开机启动:systemctl disable firewalld.service 
具体端口操作参考:https://www.cnblogs.com/moxiaoan/p/5683743.html

三、配置root用户可远程登录
以root权限执行,vi /etc/ssh/sshd_config
将 #PermitRootLogin yes 这一行的“#”去掉,为:PermitRootLogin yes
(搜索在命令模式输入:/PermitRootLogin )

四、关闭selinux(安全系统导致文件权限修改不了等,使用root用户可留着)
进入到文件:vi /etc/selinux/config  
将 SELINUX=enforcing 改为 SELINUX=disabled
查看状态:getenforce
重启使配置生效:reboot

五、Xftp连接CentOS(协议”为:SFTP,设置UTF-8)
https://jingyan.baidu.com/article/e75057f2c2f9eeebc91a89e6.html

六、取消自动待机休眠和屏保模式(如果安装桌面版)
创建 vim /etc/X11/xorg.conf  文件,添加以下内容
Section "ServerFlags"
       Option "BlankTime" "0"
       Option "StandbyTime" "0"
       Option "SuspendTime" "0"
       Option "OffTime" "0"
EndSection
Section "Monitor"
       Option "DPMS" "false"
EndSection
注意不能配置错误,重启CentOS系统即可!
安装图形界面的也可直接在设置里面设置,位置为隐私和电源

重启生效:reboot   普通重启
shutdown -r now 立刻重启(root用户使用)
halt 立刻关机
poweroff 立刻关机
shutdown -h now 立刻关机(root用户使用)
shutdown -h 10 10分钟后自动关机

七、xshell持续连接设置
xshell客户端设置重新连接
CentOS设置:
1、vim /etc/ssh/sshd_config
把ClientAliveInterval 0和ClientAliveCountMax 3前的井号去掉,
并把ClientAliveInterval的值改为60
修改:“UseDNS yes”去掉注释并改成no
允许密码登录PasswordAuthentication yes
监听地址(留默认就好):ListenAddress 去除#
2、重启ssh服务:service sshd restart
重启网关:systemctl restart network.service、service network restart
xshell连接经常报错:Socket error Event: 32 Error: 10053.
1、查看last;2、网络IP固定 
还不行就是VMware问题,进入虚拟网络配置器重置VMware!!!
网络只要主机和虚拟机互相ping通就是可以!
莫名ping不通
检查:arp -a 发现查看不到mac地址
杀毒软件不要禁用vmare的服务

猜你喜欢

转载自blog.csdn.net/qq_37902949/article/details/85037282