几个简单的服务

ntp 

NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议。

在计算机的世界里,时间非常地重要,例如对于火箭发射这种科研活动,对时间的统一性和准确性要求就非常地高,是按照A这台计算机的时间,还是按照B这台计算机的时间?NTP就是用来解决这个问题的,NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议。它的用途是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可达0.1ms,在互联网上绝大多数的地方其精度可以达到1-50ms。

配置步骤:

[[email protected] ~]#systemctl stop dhcpd

[[email protected] ~]#systemctl disable dhcpd

[[email protected] ~]#yum –y install ntp

[[email protected] ~]#/etc/ntp.conf

注释掉server0-3的时间来源

增加一行  server  asia.pool.ntp.org iburst

#server 0.centos.pool.ntp.org iburst

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

server asia.pool.ntp.org iburst

更改restrict 192.168.96.0 mask 255.255.255.0 nomodify notrap

[[email protected] ~]# systemctl restart ntpd

[[email protected] ~]# systemctl enable ntpd

以上是服务端的配置

其他段的配置

[[email protected] ~]# yum -y install ntp

[[email protected] ~]# vim /etc/ntp.conf

增加一行  server  192.168.254.100 iburst

#server 0.centos.pool.ntp.org iburst

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

server 192.168.254.100 iburst

[[email protected] ~]# systemctl restart ntpd

[[email protected] ~]# systemctl enable ntpd

Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

[[email protected] ~]# ntpq -p查看

remote           refid      st t when poll reach   delay   offset  jitter

===========================================================================

*192.168.254.100 211.233.84.186   3 u   38   64    3    0.375    0.863   0.832

[[email protected] ~]# date

Wed Oct 12 10:11:00 CST 2016

[[email protected] ~]# timedatectl

Local time: Wed 2016-10-12 10:12:26 CST

Universal time: Wed 2016-10-12 02:12:26 UTC

RTC time: Wed 2016-10-12 10:05:52

Time zone: Asia/Shanghai (CST, +0800)

NTP enabled: yes

NTP synchronized: no

RTC in local TZ: no

DST active: n/a

其他段就会自动同步。同步可能有点慢,要耐心等待!

  • FreeIPA

FreeIPA是一款集成的安全信息管理解决方案。FreeIPA包含Linux (Fedora),389 Directory Server MIT Kerberos, NTP, DNS, Dogtag (Certificate System)等等身份,认证和策略功能。

配置如下

[[email protected] ~]# yum -y install ipa-server ipa-server-dns bind bind-dyndb-ldap

dns查表原则----本地文件-------外网解析

[[email protected] ~]# vim /etc/hosts

192.168.254.100 workstation.example.com

[[email protected] ~]# ipa-server-install --setup-dns

[[email protected] ~]# kinit admin

Password for [email protected]:

[[email protected] ~]# klist

Ticket cache: KEYRING:persistent:0:0

Default principal: [email protected]

Valid starting       Expires              Service principal

10/12/2016 10:56:06  10/13/2016 10:56:00  krbtgt/[email protected] [[email protected] ~]# ipa user-add ruiyung --first=Yun --last=Rui --passwordPassword:

Enter Password again to verify:

--------------------

Added user "ruiyung"

--------------------

User login: ruiyung

First name: Yun

Last name: Rui

Full name: Yun Rui

Display name: Yun Rui

Initials: YR

Home directory: /home/ruiyung

GECOS: Yun Rui

Login shell: /bin/sh

Kerberos principal: [email protected]

Email address: [email protected]

UID: 1980200001

GID: 1980200001

Password: True

Member of groups: ipausers

Kerberos keys available: True

[[email protected] ~]# ipa user-find ruiyung

--------------

1 user matched

--------------

User login: ruiyung

First name: Yun

Last name: Rui

Home directory: /home/ruiyung

Login shell: /bin/sh

Email address: [email protected]

UID: 1980200001

GID: 1980200001

Account disabled: False

Password: True

Kerberos keys available: True

----------------------------

Number of entries returned 1

----------------------------

[[email protected] ~]# ipa dnsrecord-add example.com server1 --a-rec 192.168.254.101

Record name: server1

A record: 192.168.254.101

安装ipa-client

[[email protected] ~]# yum -y install ipa-client

 

[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736

修改DNS  指向服务的ip

[[email protected] ~]# systemctl restart network

[[email protected] ~]# cat /etc/resolv.conf

# Generated by NetworkManager

search example.com

nameserver 192.168.254.100

[[email protected] ~]# ipa-client-install

。。。。。。。。。。。。。

[[email protected] ~]# authconfig --enablemkhomedir --update

如果不行。请把selinux打开

ssh

SSH 为 Secure Shell 的缩写,由 IETF 的网络小组(Network Working Group)所制定;SSH 为建立在应用层基础上的安全协议。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。SSH最初是UNIX系统上的一个程序,后来又迅速扩展到其他操作平台。SSH在正确使用时可弥补网络中的漏洞。SSH客户端适用于多种平台。几乎所有UNIX平台—包括HP-UXLinuxAIXSolarisDigital UNIXIrix,以及其他平台,都可运行SSH。

配置

[[email protected] ~]# ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

b7:e4:e7:46:10:24:2b:e5:6b:a5:26:82:a7:a9:3f:74 [email protected]

The key‘s randomart image is:

+--[ RSA 2048]----+

|        o..      |

|       o o.      |

|      . o ..     |

|   .   . +.      |

|  . o . S o.     |

|  .+E. + + ..    |

| .o.      o..    |

| ..        o.    |

|....       ..    |

+-----------------+

(输入密码还要配置ssh-keygen)

[[email protected] ~]# ssh-copy-id -i server1.example.com

[[email protected] ~]# vi /etc/ssh/sshd_config

#17 去掉注释  Port 40010                                     端口号

#49 更改为no   PermitRootLogin no                    允许root登录

#79改为no     PasswordAuthentication no               不允许密码登录

[[email protected] ~]# systemctl restart sshd

[[email protected] ~]# systemctl enable sshd

如有雷同   纯属巧合



时间: 2024-07-31 14:32:48

几个简单的服务的相关文章

一个简单的Webservice的demo,简单模拟服务

前段时间一直在学习WCF,匆匆忙忙的把<WCF全面解析>和<WCF服务编程>看了一遍,好多东西都不是很懂,又听了一下WCF分布式开发的网络教程,算是马马虎虎的明白点了.回顾了一下Webservice,将二者进行比较学习.考虑到以后的发展,当时决定学习WCF,希望自己在不久的将来能将WCF学的稍微精通点吧.这几天又将Webservice看了一遍,回想当时学习Webservice处处碰到坑,由于没人指点,连最基本地点发布都折腾好长时间,只能一点一点的填坑跳坑.这几天闲了,想写一个简单的

socket编程,简单多线程服务端测试程序

socket编程,简单多线程服务端测试程序 前些天重温了MSDN关于socket编程的WSAStartup.WSACleanup.socket.closesocket.bind.listen.accept.recv.send等函数的介绍,今天写了一个CUI界面的测试程序(依赖MFC)作为补充.程序功能简介如下: 1:一个线程做监听用. 2:监听线程收到客户端连接后,创建新线程接收客户端数据.所有对客户端线程将加入容器,以便管理. 3:服务端打印所有客户端发来的信息. 4:服务端CUI界面输入数字

lucene构建restful风格的简单搜索引擎服务

来自于本人博客: lucene构建restful风格的简单搜索引擎服务 本人的博客现在也要改成使用lucene进行全文检索的功能,因此在这里把代码贴出来与大家分享 一,目录结构: 二,配置文件: 总共有四个配置文件:bonecp-config.xml,IKAnalyzer.cfg.xml,log4j.properties,system-config.xml 1.bonecp-config.xml是配置jdbc连接池用的,不用这个配置也行,bonecp包有默认配置 2.IKAnalyzer.cfg

GCDAynscSocket简单使用-服务端

距离上次写<GCDAynscSocket简单使用-服务端>差不多一个月了,现在把服务端的介绍给补上. 服务端的介绍比较简单,因为服务端和客户端的接收和发送数据的方法是一样的,不同的地方在于服务端是开启一个服务被动的等待客户端的接入.所以只介绍一下如何开启和关闭服务. 1.开启服务 GCDAynscSocket封装的非常好了,大部分情况下我们只要调用它的接口就可以了. 开启服务可调用的方法: /** * Tells the socket to begin listening and accept

用nodejs搭建一个简单的服务监听程序

作为一个从业三年左右的,并且从事过半年左右PHP开发工作的前端,对于后台,尤其是对以js语言进行开发的nodejs,那是比较有兴趣的,虽然本身并没有接触过相关的工作,只是自己私下做的一下小实验,但是还是记录一下方便以后复习! 今天主要记录一下,很久以前用nodejs制作一个简单的服务监听程序的一些过程! 大家都知道,通过nodejs可以对前台请求进行监听,这里就放一个官网的hello world例子吧: var http = require('http'); http.createServer(

【阿里云产品公测】简单日志服务SLS使用评测 + 教程

[阿里云产品公测]简单日志服务SLS使用评测 + 教程 评测介绍 被测产品: 简单日志服务SLS 评测环境: 阿里云基础ECS x2(1核, 512M, 1M) 操作系统: CentOS 6.5 x64 日志环境: Nginx(v1.6.2) HTTP服务器访问日志.服务器系统日志 评测人: mr_wid 评测时间: 2014年9月28日-2014年10月8日 准备工作 一.知彼知己, 百战不殆.对产品的了解程度, 直接决定着评测质量, 在评测前, 笔者首先整理并详细阅读了有关SLS产品以及关联

转:实现一个简单的服务端推送方案

原文来自于:http://blog.csdn.net/jiao_fuyou/article/details/17090355 客户端和服务端的交互有推和拉两种方式:如果是客户端拉的话,通常就是Polling:如果是服务端推的话,一般就是Comet,目前比较流行的Comet实现方式是Long Polling. 注:如果不清楚相关名词含义,可以参考:Browser 與 Server 持續同步的作法介紹. 先来看看Polling,它其实就是我们平常所说的轮询,大致如下所示: Polling 因为服务端

Netty实例-简单的服务端-客户端实现,注释详细

       书籍推荐:                                       实例代码 :http://download.csdn.net/detail/jiangtao_st/7677503 Netty Server端实现 /** * * <p> * Netty Server Simple * </p> * * @author 卓轩 * @创建时间:2014年7月7日 * @version: V1.0 */ public class NettyServer

1.Windows服务--&gt;添加一个简单的服务

Windows服务应用程序是一种需要长期运行的应用程序,它对于服务器环境特别适合.它没有用户界面,并且也不会产生任何可视输出.任何用户消息都会被 写进Windows事件日志.计算机启动时,服务会自动开始运行.它们不要用户一定登录才运行,它们能在包括这个系统内的任何用户环境下运行.通过服务控 制管理器,Windows服务是可控的,可以终止.暂停及当需要时启动. 1.新建一个Windows服务项目 2.系统自动创建了一个Service1.cs的文件,双击打开Service1.cs文件,在工作区域右键

搭建简单Django服务并通过HttpRequester实现GET/POST请求提交表单

调试Django框架写的服务时,需要模拟客户端发送POST请求,然而浏览器只能模拟简单的GET请求(将参数写在url内),网上搜索得到了HttpRequester这一firefox插件,完美的实现了模拟POST提交表单的需求,这里记录一下简单Django服务的搭建.以及使用HttpRequester对应进行GET/POST请求操作的流程. 1,搭建Django服务 1.1 搭建简单服务 搭建一个简单的Django服务很容易,只需要一行命令即可创建一个可运行的Django服务,若未安装Django