首页 » 技术笔记 » centosntp服务器搭建 centos搭建服务器需要注意什么?

centosntp服务器搭建 centos搭建服务器需要注意什么?

本篇文章给大家谈谈centos搭建服务器,以及centosntp服务器搭建对应的知识点,希望对各位有所帮助,不要忘了收藏本站(www.host199.com)喔。

本文目录一览:1、二、Centos7-FTP服务器的搭建2、Centos 搭建dhcp服务器3、CentOS7文件服务器的搭建4、Centos7搭建DNS服务器二、Centos7-FTP服务器的搭建

ftpname为你为该ftp创建的用户名,/data/KodServer/data/User/tomas/home 为登录进去后的位置

(备注:用cat etc/passwd可以查看当前系统用户)

①、查看ftp的状态:sestatus -b | grep ftp

②、在结果中可以看到: tftp_home_dir off

③、将状态改为on:setsebool -P tftp_home_dir on

④、重启vsftp服务:systemctl restart vsftpd.service

问题:Failed to restart vsftpd.service: Unit not found.

把ftp用户写进去,如果没有这个文件的话就可以复制当前目录下user_list那个文件,然后清空添加用户名即可。

然后就可以使用ftp工具从外部访问了

Centos 搭建dhcp服务器

dhcp是动态主机配置协议,使用udp协议,主要使用udp67和udp 68号端口

1.client端会发送dhcp discover广播包

2.dhcp服务器会回应dhcp offer广播包

3.client端会发送dhcp request广播包

4.dhcp服务器发送dhcp ack广播包

[root@mini ~]# rpm -qa dhcp

[root@mini ~]# cat /etc/centos-release

CentOS release 6.9 (Final)

[root@mini ~]# uname -r

2.6.32-696.el6.i686

[root@mini ~]# uname -m

i686

[root@mini ~]# yum install -y dhcp

[root@mini ~]# rpm -qa dhcp

dhcp-4.1.1-53.P1.el6.centos.1.i686

[root@mini ~]# rpm -qc dhcp

/etc/dhcp/dhcpd.conf

/etc/dhcp/dhcpd6.conf

/etc/openldap/schema/dhcp.schema

/etc/portreserve/dhcpd

/etc/sysconfig/dhcpd

/etc/sysconfig/dhcpd6

/etc/sysconfig/dhcrelay

/etc/sysconfig/dhcrelay6

/var/lib/dhcpd/dhcpd.leases

/var/lib/dhcpd/dhcpd6.leases

[root@mini ~]# cat /etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

#  see /usr/share/doc/dhcp*/dhcpd.conf.sample

#  see 'man 5 dhcpd.conf'

#

查询dhcp sample文件(dhcpd.conf.sample文件为dhcp配置文件模板)

# rpm -ql dhcp

配置完成后的文件

[root@mini ~]# cat /etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

#  see /usr/share/doc/dhcp*/dhcpd.conf.sample

#  see 'man 5 dhcpd.conf'

#

# A slightly different configuration for an internal subnet.

subnet 172.16.1.0 netmask 255.255.255.0 {

range 172.16.1.10 172.16.1.30;

option domain-name-servers mini.localdomain;

option domain-name "mini.localdomain";

option routers 172.16.1.1;

option broadcast-address 172.16.1.1;

default-lease-time 600;

max-lease-time 7200;

}

查看配置是否正确

[root@mini ~]# /etc/init.d/dhcpd configtest

Syntax: OK

DHCP启动失败,并查询到如下报错信息(/var/log/messages)

Nov  6 06:37:24 mini dhcpd: No subnet declaration for eth0 (192.168.28.139).

Nov  6 06:37:24 mini dhcpd: ** Ignoring requests on eth0.  If this is not what

Nov  6 06:37:24 mini dhcpd:    you want, please write a subnet declaration

Nov  6 06:37:24 mini dhcpd:    in your dhcpd.conf file for the network segment

Nov  6 06:37:24 mini dhcpd:    to which interface eth0 is attached. **

Nov  6 06:37:24 mini dhcpd:

Nov  6 06:37:24 mini dhcpd:

Nov  6 06:37:24 mini dhcpd: Not configured to listen on any interfaces!

Nov  6 06:37:24 mini dhcpd:

Nov  6 06:37:24 mini dhcpd: This version of ISC DHCP is based on the release available

Nov  6 06:37:24 mini dhcpd: on .  Features have been added and other changes

Nov  6 06:37:24 mini dhcpd: have been made to the base software release in order to make

Nov  6 06:37:24 mini dhcpd: it work better with this distribution.

Nov  6 06:37:24 mini dhcpd:

Nov  6 06:37:24 mini dhcpd: Please report for this software via the CentOS Bugs Database:

Nov  6 06:37:24 mini dhcpd:   

Nov  6 06:37:24 mini dhcpd:

Nov  6 06:37:24 mini dhcpd: exiting.

解决办法:

这是因为DHCP程序发现没有“Not configured to listen on any interfaces”,只需要配置相应的IP到目标网卡中便可以解决这个问题。

[root@mini ~]# ifconfig eth1 172.16.1.1/24

[root@mini ~]# /etc/init.d/dhcpd start

Nov  6 06:43:11 mini dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1

Nov  6 06:43:11 mini dhcpd: Copyright 2004-2010 Internet Systems Consortium.

Nov  6 06:43:11 mini dhcpd: All rights reserved.

Nov  6 06:43:11 mini dhcpd: For info, please visit

Nov  6 06:43:11 mini dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file

Nov  6 06:43:11 mini dhcpd: Wrote 0 leases to leases file.

Nov  6 06:43:11 mini dhcpd: Listening on LPF/eth1/00:0c:29:c5:2b:7e/172.16.1.0/24

Nov  6 06:43:11 mini dhcpd: Sending on  LPF/eth1/00:0c:29:c5:2b:7e/172.16.1.0/24

Nov  6 06:43:11 mini dhcpd:

Nov  6 06:43:11 mini dhcpd: No subnet declaration for eth0 (192.168.28.139).

Nov  6 06:43:11 mini dhcpd: ** Ignoring requests on eth0.  If this is not what

Nov  6 06:43:11 mini dhcpd:    you want, please write a subnet declaration

Nov  6 06:43:11 mini dhcpd:    in your dhcpd.conf file for the network segment

Nov  6 06:43:11 mini dhcpd:    to which interface eth0 is attached. **

Nov  6 06:43:11 mini dhcpd:

Nov  6 06:43:11 mini dhcpd: Sending on  Socket/fallback/fallback-net

[root@mini ~]# cat /var/lib/dhcpd/dhcpd.leases

注意:如果Linux开启了防火墙,那么需要对UDP 67和UDP 68放行。或者直接将放火墙关闭

CentOS7文件服务器的搭建

安装

yum -y install vsftpd

安装后修改配置

vi /etc/vsftpd/vsftpd.conf

不允许匿名操作

开启用户管理列表

在文件最后面新增allow_writeable_chroot=YES,允许已登录用户进行上传

编辑用户管理列表

vi /etc/vsftpd/chroot_list

添加ftpuser用户

mkdir -p /home/ftp

创建ftp的根路径

useradd -d /home/ftptest -s /sbin/nologin ftpuser

新增用户并配置为ftpuser用户的主文件夹

usermod -aG ftp ftpuser

将ftpuser用户放置在ftp用户组中

chown ftpuser /home/ftp

修改ftp文件的所属

passwd ftpuser

修改ftpuser用户密码

vi /etc/selinux/config

如图配置

firewall-cmd --permanent --zone=public --add-service=ftp

开启ftp服务

firewall-cmd --reload

重加载firewall

systemctl start vsftpd

重启

systemctl status vsftpd

查看firewall状态

输入ftpuser的账号密码

文件服务器ftp文件夹根目录

Centos7搭建DNS服务器

Centos7搭建DNS服务器  ,位WEB服务器提供域名解析

1.关闭防火墙

 systemctl stop firewalld

2.配置IP地址 启动网络服务

   vim /etc/sysconfig/network-scripts/ifcfg-ens33

    systemctl start network

    ifconfig

3.挂载系统镜像

   mount /dev/cdrom /mnt/

4.编辑yum环境

   rm -rf /etc/yum.repos.d/*

   vim /etc/yum.repos.d/yum.repo

5.使用yum安装bind软件包

   yum -y install bind

 5.1 查看是否将bind软件包安装成功

   rpm -qa bind

5.2 编辑dns配置文件

   vim /etc/named.conf

   named-checkconf /etc/named.conf

   vim /var/named/huizhong.com.zone

   named-checkzone huizhong.com /var/named/huizhong.com.zone

   vim /var/named/huizhong.com.zone

   named-checkzone huizhong.com /var/named/huizhong.com.zone

6.启动dns服务

   systemctl start named

6.1查看dns运行状态

   systemctl status named

6.3 查看dns网络连接情况

   netstat -anpt | grep named

   netstat -anpu | grep named

关于centos搭建服务器和centosntp服务器搭建的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站(www.host199.com)。