linux常用服务启停

时间:2024.3.10

Linux常用服务的启动与配置(以redhat linux ES3为例)

1. TELNET服务的配置,如何加入自启动服务

linux配置telnet服务器(root下)

1. 安装telnet软件包。telnet-server-0.17-26.EL3.3.i386.rpm(安装盘2上) rpm -ivh telnet-server-0.17-26.EL3.3.i386.rpm

2. 设置telnet的启动运行

telnet server不作为独立的服务器程序运行,而是受xinetd程序的控制,启动配置文件为/etc/xinetd.d/telnet,默认xinetd程序并不启动该服务,可在chkconfig --list看出telnet是关闭的,/etc/xinetd.d/ telnet中disable=yes可通过下面的方式启动telnet:

1) chkconfig telnet on //该命令修改了/etc/xinetd.d/telnet的配置,设置disable=no

2) service xinetd restart

再次chkconfig --list看到telnet已经启动。

2. FTP服务的配置,如何加入自启动服务

linux配置ftp服务器(root下)

1. 安装ftp软件包。vsftpd-1.2.1-3E.1.rpm(安装盘2)

rpm –ivh vsftpd-1.2.1-3E.1.rpm

2. 设置ftp的启动运行

vsftpd为独立的服务器程序运行,文件为/etc/vsftpd/vsftpd.conf, 修改anonymous_enable,把YES改成NO

有时要执行 setsebool -P ftpd_disable_trans 1 如redhat5

可以通过ntsysv进行配置。

Service vsftpd restart

再次chkconfig --list看到vsftpd已经启动。

3. 远程图形界面的配置

采用vncserver

rpm ivh vnc-server-4.0-0.beta4.1.4.i386.rpm 安装vnc服务进行远程控制, 查看日志文件/root/.vnc/hostname:2.log,可以查看vnc服务的端口号。 vncpasswd设置vnc联接密码

通过配置文件/root/.vnc/xstartup配置显示模式,假设启动kde桌面 #!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#twm &

startkde &

先启动vncserver,然后启动vnc客户端软件。

关闭服务:vncserver -kill :number(进程号)

需要重启

4. 时钟服务的配置

date设定系统时间(date [-u] [-d datestr] [-s datestr] [--utc] [--universal]

[--date=datestr] [--set=datestr] [--help] [--version] [+FORMAT]

[MMDDhhmm[[CC]YY][.ss]])

Linux下NTP服务器的配置

? 第一步 安装软件包

安装ntp-4.1.2-4.EL3.1.i386.rpm安装包

rpm –ivh ntp-4.1.2-4.EL3.1.i386.rpm

举例,以192.168.11.5作为时钟服务器,把192.168.11-15.0网段的机器作为时钟服务的客户端,需要在服务端和客户端做如下的配置

? 第二步 时间服务器脚本配置(修改/etc/ntp.conf)

# Prohibit general access to this service.

# restrict default ignore

# Permit all access over the loopback interface. This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.0.0.1

# -- CLIENT NETWORK -------

# Permit systems on this network to synchronize with this

# time service. Do not permit those systems to modify the

# configuration of this service. Also, do not use those

# systems as peers for synchronization.

# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap

restrict 192.168.11.0 mask 255.255.255.0 notrust nomodify notrap

restrict 192.168.12.0 mask 255.255.255.0 notrust nomodify notrap

restrict 192.168.13.0 mask 255.255.255.0 notrust nomodify notrap

restrict 192.168.15.0 mask 255.255.255.0 notrust nomodify notrap

restrict 192.168.16.0 mask 255.255.255.0 notrust nomodify notrap

# --- OUR TIMESERVERS -----

# or remove the default restrict line

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

# restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery # server mytrustedtimeserverip

# --- NTP MULTICASTCLIENT ---

#multicastclient # listen on default 224.0.1.1

# restrict 224.0.1.1 mask 255.255.255.255 notrust nomodify notrap

# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap

# --- GENERAL CONFIGURATION ---

#

# Undisciplined Local Clock. This is a fake driver intended for backup

# and when no outside source of synchronized time is available. The

# default stratum is usually 3, but in this case we elect to use stratum

# 0. Since the server line does not have the prefer keyword, this driver

# is never used for synchronization, unless no other other

# synchronization source is available. In case the local host is

# controlled by some external source, such as an external oscillator or # another protocol, the prefer keyword would cause the local host to

# disregard all other synchronization sources, unless the kernel

# modifications are in use and declare an unsynchronized condition.

#

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

#

# Drift file. Put this in a directory which the daemon can write to.

# No symbolic links allowed, either, since the daemon updates the file # by creating a temporary in the same directory and then rename()'ing # it to the file.

#

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

#

# Authentication delay. If you use, or plan to use someday, the

# authentication facility you should make the programs in the auth_stuff # directory and figure out what this number should be on your machine. #

authenticate yes

#

# Keys file. If you want to diddle your server at run time, make a

# keys file (mode 600 for sure) and define the key number to be

# used for making requests.

#

# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote # systems might be able to reset your clock at will. Note also that

# ntpd is started with a -A flag, disabling authentication, that

# will have to be removed as well.

#

keys /etc/ntp/keys

? 第三步 客户端脚本配置

# Prohibit general access to this service.

restrict default ignore

restrict 192.168.11.5 mask 255.255.255.255 nomodify notrap noquery

# Permit all access over the loopback interface. This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.0.0.1

# -- CLIENT NETWORK -------

# Permit systems on this network to synchronize with this

# time service. Do not permit those systems to modify the

# configuration of this service. Also, do not use those

# systems as peers for synchronization.

# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap

# --- OUR TIMESERVERS -----

# or remove the default restrict line

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

# restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery # server mytrustedtimeserverip

# --- NTP MULTICASTCLIENT ---

#multicastclient # listen on default 224.0.1.1

# restrict 224.0.1.1 mask 255.255.255.255 notrust nomodify notrap

# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap

# --- GENERAL CONFIGURATION ---

#

# Undisciplined Local Clock. This is a fake driver intended for backup

# and when no outside source of synchronized time is available. The

# default stratum is usually 3, but in this case we elect to use stratum

# 0. Since the server line does not have the prefer keyword, this driver

# is never used for synchronization, unless no other other

# synchronization source is available. In case the local host is

# controlled by some external source, such as an external oscillator or

# another protocol, the prefer keyword would cause the local host to

# disregard all other synchronization sources, unless the kernel

# modifications are in use and declare an unsynchronized condition.

#

server 192.168.11.5

fudge 127.127.1.0 stratum 10

#

# Drift file. Put this in a directory which the daemon can write to.

# No symbolic links allowed, either, since the daemon updates the file # by creating a temporary in the same directory and then rename()'ing # it to the file.

#

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

#

# Authentication delay. If you use, or plan to use someday, the

# authentication facility you should make the programs in the auth_stuff # directory and figure out what this number should be on your machine. #

authenticate yes

#

# Keys file. If you want to diddle your server at run time, make a

# keys file (mode 600 for sure) and define the key number to be

# used for making requests.

#

# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote # systems might be able to reset your clock at will. Note also that

# ntpd is started with a -A flag, disabling authentication, that

# will have to be removed as well.

#

keys /etc/ntp/keys

? 第四步 设置同步脚本

追加下面内容到crontab,这样,每过一个小时0分的时候就自动更新。 # crontab –e(编辑)

0 1 * * * root ntpdate [ntp server IP]

每天1点从时钟服务器更新时钟

5. 组的添加和删除

groupadd [-g gid [-o]] [-r] [-f] group

如输入以下命令

groupadd newgroup

系统将创建一个新的用户组newgroup

groupdel groupname

6. 用户的添加和删除

useradd [-u uid [-o]] [-g group] [-G group,...]

[-d home] [-s shell] [-c comment] [-m [-k template]]

[-f inactive] [-e expire ] [-p passwd] [-M] [-n] [-r] [-l] name useradd -D [-g group] [-b base] [-s shell]

[-f inactive] [-e expire ]

如输入以下命令

useradd oracle –g dba –d /oracle –p ora123

系统将创建一个用户oracle,oracle 用户组dba

home 目录/oracle 密码为ora123

userdel [-r] login

7. 附(查看服务) ntsysv

rpm -qa

更多相关推荐:
Linux中如何查看服务及监听端口

linux教程实例Linux中如何查看服务及监听端口问我该如何发现哪种服务正在某个特定端口上监听呢我如何发现哪一个程序正在一个特定端口上监听呢答在NIX系统中你可以使用下面的任何一个命令来得到在一个特定TCP端...

linux查看端口的方法

想查看TCP或者UDP端口使用情况使用netstatanp如果有些进程看不见如只显示可以尝试sudonetstatanp如果想看某个端口的信息使用lsof命令如sudolsofi631bash300netsta...

linux开启防火墙端口和查看,开启相关端口号

当Linux打开防火墙后你会发现从本机登录23端口是没有问题的但是如果从另一台pc登录该linux系统后你会发现提示这样的错误不能打开到主机的连接在端口23连接失败因为linux防火墙默认是关闭23端口的如果允...

linux查看端口的方法

想查看TCP或者UDP端口使用情况使用netstatanp如果有些进程看不见如只显示可以尝试sudonetstatanp如果想看某个端口的信息使用lsof命令如sudolsofi631bash300netsta...

Linux查看服务器端口被哪个程序占用

Linux查看服务器端口被哪个程序占用我们经常会遇到网站打不开参看服务器运行状态会发现apachemysql的端口被其他应用程序占用导致程序无法启动的情况那么如何查看linux端口号被占用的是哪一个程序呢可以通...

Linux下查看端口占用进程号,程序名的方法

Linux下查看端口占用进程号程序名的方法Linux下查看端口占用进程号程序名的方法方便我们查找什么进程导致系统变慢等需要linux下查看端口占用情况1查看哪个进程占用了819端口case9sghfofousr...

linux netstat 统计连接数查看外部 如何查80端口tcp链接数

linuxnetstat统计连接数查看外部如何查80端口tcp链接数时间20xx03261914来源未知作者admin点击2530次服务器上的一些统计数据1统计80端口连接数netstatnatgrepiquo...

Linux下apache mysql等服务修改默认端口后无法正常启动解决办法

linux下apache等服务修改默认端口后无法正常启动解决办法服务器上装了两个webserver一个是nginx开在80端口没有异常另外一个是apache绑定的8001端口可是启动服务时报错Startingh...

Linux查看机器开放的端口

版权声明原创作品允许转载转载时请务必以超链接形式标明文章原始出处作者信息和本声明否则将追究法律责任数据资料来自互联网个人收集总结一使用nmap扫描机器开放的端口我用这个工具的目的是查看自己服务器RHEL5所开放...

Linux和Windows VPS服务器上查看端口被哪个程序占用

Linux和Windows查看端口被哪个程序占用无论是在Linux还是Windows上都可能会遇到端口被占用nginxmysqlapache等程序无法启动下面说分别说一下Linux和Windows上如何查看端口...

佛山双线服务器Linux下查看端口占用进程号

佛山双线服务器Linux下查看端口占用进程号程序名的方法佛山双线服务器Linux下查看端口占用进程号程序名的方法方便我们查找什么进程导致系统变慢等需要东莞市博扬网络技术有限公司总结linux下查看端口占用情况1...

通过COM端口管理Linux系统服务器简介

通过COM端口管理Linux系统服务器简介本文简要地介绍了如何通过常见的COM口进行Linux服务器的控制台的扩展具有实用性和简易性不受服务器网络等条件的限制可以方便地管理实际生产环境中的Linux服务器说到管...

linux查看服务端口号(15篇)