Centos7部署总结

Centos 部署总结

1. 配置网卡

1.1 设置网卡名称

  • 1. 修改网卡文件名称

cd /etc/sysconfig/network-scripts/ =====> 进入网卡文件存放目录
mv ifcfg-ens32 ifcfg-eth0 =====> 修改文件名称

  • 2. 修改网卡DEVICE名称

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=ens32 ===============================> NAME=eth0
UUID=aeb1068e-188c-464a-9406-6b83c5abf89e
DEVICE=ens32 ===============================> DEVICE=eth0
ONBOOT=no

  • 3. 修改Centos 7 引导grub, RUB_CMDLINE_LINUX中添加net.ifnames=0 biosdevname=0

[root@localhost ~]# vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=" ( s e d ′ s , r e l e a s e . ∗ (sed 's, release .* (seds,release.,g’ /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=“console”
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY=“true”

  • 4. 重新加载grub

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-73d657c8cbbd4ec2a9c722bbc5c69de8
Found initrd image: /boot/initramfs-0-rescue-73d657c8cbbd4ec2a9c722bbc5c69de8.img
done
[root@localhost ~]#

  • 5. 重启Centos系统

[root@localhost ~]# reboot

  • 6. 启动成功后,查看网卡名称

[root@localhost ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.24.204.21 netmask 255.255.255.0 broadcast 172.24.204.255
ether 00:50:56:9d:17:f7 txqueuelen 1000 (Ethernet)
RX packets 90344 bytes 115480729 (110.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 63959 bytes 6502369 (6.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

1.2 配置网卡IP地址

1. 修改网卡文件IP地址

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static ===> 设备接口模式:例:dhcp,static
ONBOOT=yes
IPADDR=172.24.204.21 ===> 配置IP地址
NETMASK=255.255.255.0 ===> 配置子网掩码
GATEWAY=172.24.204.254
DNS1=114.114.114.114
#DEFROUTE=yes
#PEERDNS=yes
#PEERROUTES=yes
#IPV4_FAILURE_FATAL=no
#IPV6INIT=yes
#IPV6_AUTOCONF=yes
#IPV6_DEFROUTE=yes
#IPV6_PEERDNS=yes
#IPV6_PEERROUTES=yes
#IPV6_FAILURE_FATAL=no
NAME=eth0
#UUID=41cc0307-6e8e-43b4-9889-542a54d8c36a
DEVICE=eth0

2. 重启network服务

[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]

3. 查看接口IP地址

[root@localhost ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.24.204.21 netmask 255.255.255.0 broadcast 172.24.204.255
ether 00:50:56:9d:17:f7 txqueuelen 1000 (Ethernet)
RX packets 241 bytes 22418 (21.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 67 bytes 10940 (10.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

4. 设置nameserver地址

[root@localhost ~]# vim /etc/resolv.conf
#Generated by NetworkManager
nameserver 114.114.114.114

5. 测试系统连接网络

[root@localhost ~]# ping www.baidu.com -c 1
PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data.
64 bytes from 220.181.38.150: icmp_seq=1 ttl=49 time=2.87 ms

— www.a.shifen.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.878/2.878/2.878/0.000 ms

1.3 SSH设置

1. 确认是否安装:openssh-server

[root@localhost ~]# yum list installed | grep openssh
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
openssh.x86_64 7.4p1-21.el7 @base
openssh-askpass.x86_64 7.4p1-21.el7 @base
openssh-clients.x86_64 7.4p1-21.el7 @base
openssh-server.x86_64 7.4p1-21.el7 @base
[root@localhost ~]#

2. 未安装则YUM直接安装

[root@localhost ~]# yum install openssh-server -y

3. 设备SSH配置文件

[root@localhost ~]# vim /etc/ssh/sshd_config

Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::

PermitRootLogin yes
PasswordAuthentication yes
备注:当前条目在配置文件内全都可以查找到,请直接查找然后修改即可

4. 启动服务

[root@localhost ~]# systemctl restart sshd =====>启动服务
[root@localhost ~]#
[root@localhost ~]# systemctl enable sshd =====>开机启动

1.4 设置yum源

1. 备份yum源

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo bak
[root@localhost yum.repos.d]# ls
bak

2. 下载yum源文件

[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

3. 更新yum源

[root@localhost yum.repos.d]# yum clear all
[root@localhost yum.repos.d]# yum makecache

4. 下载epel源

[root@localhost yum.repos.d]# yum list | grep epel-release
[root@localhost yum.repos.d]# yum install -y epel-release
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo

5. 更新yum源

[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache

6. 查看系统可用yum源

[root@localhost yum.repos.d]# yum repolist all
[root@localhost yum.repos.d]# yum repolist enabled

1.5 linux远程桌面

1. 安装xrdp、xfce工具

[root@localhost ~]# yum install xrdp
[root@localhost ~]# yum groupinstall Xfce
[root@localhost ~]# echo “xfce4-session” > ~/.Xclients
[root@localhost ~]# chmod +x ~/.Xclients

2. 启动xrdp 服务

[root@localhost ~]# systemctl start xrdp
[root@localhost ~]# systemctl enable xrdp

3. 关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

4. 测试

1. window系统:运行—mstsc—输入username password
在这里插入图片描述

2. 登录成功
在这里插入图片描述

1.6 linux远程桌面Terminal

Open terminal提示:Failed to execute default Terminal Emulator
在这里插入图片描述
问题原因主要是默认的Terminal工具打不开

解决办法
Applicationssettings-settings ManagerPerferred ApplicationsUtiltiesTerminal Emulator:GNOME TerminalClose
在这里插入图片描述

wireshark

  1. yum 安装

[root@localhost yum.repos.d]# yum -y install wireshark wireshark-gnome
[root@localhost yum.repos.d]# wireshark

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞翔的荷兰人seven

启航:欢迎乘坐飞翔的荷兰人

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值