[TOC]

网络配置

vmware 桥接模式下:

各种网络模式参考 https://www.linuxidc.com/Linux/2016-09/135521.htm

/etc/sysconfig/network-scripts 下一般会有一个网络配置文件,如:ifcfg-eno16777736

修改该文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
TYPE=Ethernet          
BOOTPROTO=static #静态IP地址配置
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=eno16777736
UUID=7617ff93-0c8f-4272-a28e-ac8cf0807026
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.2.110 #虚拟机的话,与主机同一网段
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.2.1 #网关
DNS1=192.168.2.1 #DNS

修改完重启

1
2
/etc/init.d/network restart
service network restart

CentOS中修改主机名

CentOS 6
1
2
3
4
5
6
7
8
9
10
11
[root@centos6 ~]$ hostname                                              # 查看当前的hostnmae
centos6.magedu.com
[root@centos6 ~]$ vim /etc/sysconfig/network # 编辑network文件修改hostname行(重启生效)
[root@centos6 ~]$ cat /etc/sysconfig/network # 检查修改
NETWORKING=yes
HOSTNAME=centos66.magedu.com
[root@centos6 ~]$ hostname centos66.magedu.com # 设置当前的hostname(立即生效)
[root@centos6 ~]$ vim /etc/hosts # 编辑hosts文件,给127.0.0.1添加hostname
[root@centos6 ~]$ cat /etc/hosts # 检查
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 centos66.magedu.com
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

centos6以及其他有些发行版本,主机名的配置文件是/etc/sysconfig/network, 用 hostname newname 也只是暂时生效,修改了内核的值,重启丢失。 所以可以结合临时加修改配置文件这种方式修改主机名。

CentOS 7
1
2
3
4
5
6
7
8
9
[root@centos7 ~]$ hostnamectl set-hostname centos77.magedu.com       # 使用这个命令会立即生效且重启也生效

[root@centos7 ~]$ hostname # 查看下
centos77.magedu.com

[root@centos7 ~]$ vim /etc/hosts # 编辑下hosts文件, 给127.0.0.1添加hostname
[root@centos7 ~]$ cat /etc/hosts # 检查
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 centos77.magedu.com
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

在centos7中,主机名的配置文件为 /etc/hostname, 在该文件中配置了新的主机名后,不会立即生效,需要重启进行生效;因为系统内核已经中的主机名还没有更新,还是旧的指。 可以使用修改CentOS6的策略,也可以通过 hostnamectl set-hostname newname 来更改主机名,内核和配置文件中的主机名都被更新了,不用重启。

至于/etc/hosts 文件,同Windows下的hosts文件一样,只是起到本地DNS的作用一样,路由的作用。或者也可以说起别名。

SSH 服务配置

首先查看是否有安装

1
yum list installed | grep openssh-server

没有安装的话,用yum进行安装 yum install openssh-server

SSH 服务的配置文件是 /etc/ssh/sshd_config

1
2
3
4
5
6
7
Port 22
ListenAddress 0.0.0.0
ListenAddress ::

PermitRootLogin yes

PasswordAuthentication yes

重启或开启SSH服务

1
2
systemctl restart sshd.service
systemctl enable sshd.service #自启动服务

查看22端口

1
2
3
yum instatll net-tools –y    #如果没有netstat服务,安装netstat工具

netstat -an | grep 22

必要时关闭防火墙或开放22端口

1
2
systemctl stop firewalld.service
systemctl disable firewalld.service

ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key

RPM

https://www.cnblogs.com/zengkefu/p/5666947.html

ntpdate cn.pool.ntp.org

\1. 安装ntpdate工具

# yum -y install ntp ntpdate

\2. 设置系统时间与网络时间同步

# ntpdate cn.pool.ntp.org

\3. 将系统时间写入硬件时间

# hwclock –systohc

4.强制系统时间写入CMOS中防止重启失效

  hwclock -w
  或clock -w

本文来自 紫漪 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/u011391839/article/details/62892020?utm_source=copy

sudo passwd root 更改密码,要在root用户下

sudo su - root

apt list –installed|grep jdk java

/opt/zookeeper-3.4.6/bin/zkServer.sh start

/opt/kafka_2.11-0.9.0.1/bin/kafka-server-start.sh -daemon /opt/kafka_2.11-0.9.0.1/config/server.properties

/opt/kafka_2.11-0.9.0.1/bin/kafka-server-stop.sh

bin/kafka-console-producer.sh –broker-list localhost:9092 –topic test

1
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test1 --from-beginning