来源:lzlutao 《Jumpserver堡垒机安装配置全过程》
一、准备一台Linux主机
0、设置其ip :
ip设置请参考:《centos 7.3 设置静态IP》
1、开SSH
[root@localhost ~]# systemctl enable sshd
[root@localhost ~]#
2、关闭SELINUX
[root@localhost ~]# vi /etc/sysconfig/selinux [root@localhost ~]# #-----修改下边红字部分
# 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
3、安装rz
PS:在本环节操作前,一定要确认是否可以ping通 www.baidu.com。 用以确定该环境的网络是可以联网的。如果不可以,请根据具体情况分析解决。本人做此设置前就出现一下问题。
1 [root@localhost ~]# cat /etc/resolv.conf 2 # Generated by NetworkManager 3 nameserver 8.8.8.8 4 nameserver 8.8.4.4 5 [root@localhost ~]# ping www.baidu.com 6 ping: www.baidu.com: Name or service not known 7 [root@localhost ~]# cd /etc/sysconfig/network-scripts/ 8 [root@localhost network-scripts]# ls 9 ifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnel 10 ifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wireless 11 ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global 12 ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions 13 ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6 14 ifdown-ib ifdown-Team ifup-ippp ifup-sit 15 ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team 16 ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort 17 [root@localhost network-scripts]# vi ifcfg-ens33 18 [root@localhost network-scripts]# cat ifcfg-ens33 19 TYPE="Ethernet" 20 BOOTPROTO="static" 21 NETWORK=192.168.1.1 22 NAME="ens33" 23 ME="ens33" 24 ONBOOT="yes" 25 IPADDR="192.168.1.20" 26 GATEWAY="192.168.1.1" 27 28 #DEFROUTE="yes" 29 #PEERDNS="yes" 30 #PEERROUTES="yes" 31 #IPV4_FAILURE_FATAL="no" 32 #IPV6INIT="yes" 33 IPV6_AUTOCONF="yes" 34 IPV6_DEFROUTE="yes" 35 IPV6_PEERDNS="yes" 36 IPV6_PEERROUTES="yes" 37 IPV6_FAILURE_FATAL="no" 38 IPV6_ADDR_GEN_MODE="stable-privacy" 39 # 40 #UUID="59469ff2-89aa-4cb0-9304-bb1ca20c9db3" 41 DEVICE="ens33" 42 43 DEFROUTE=yes 44 IPV4_FAILURE_FATAL=no 45 IPV6INIT=yes 46 UUID=c96bc909-188e-ec64-3a96-6a90982b08ad 47 PEERDNS=yes 48 49 PEERROUTES=yes 50 DNS1=8.8.8.8 51 DNS2=114.114.114.114 52 [root@localhost network-scripts]# service network restart 53 Restarting network (via systemctl): [ OK ] 54 [root@localhost network-scripts]# 55 [root@localhost network-scripts]# ping 192.168.1.1 56 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 57 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=6.30 ms 58 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=4.34 ms 59 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=7.30 ms 60 64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=4.77 ms 61 64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=1.83 ms 62 ^C 63 --- 192.168.1.1 ping statistics --- 64 5 packets transmitted, 5 received, 0% packet loss, time 4009ms 65 rtt min/avg/max/mdev = 1.832/4.912/7.300/1.871 ms 66 [root@localhost network-scripts]# ping www.baidu.com 67 PING www.wshifen.com (104.193.88.123) 56(84) bytes of data.