“Yvonne”通过精心收集,向本站投稿了7篇Linux系统中配置构建Postfix文档linux操作系统,以下是小编帮大家整理后的Linux系统中配置构建Postfix文档linux操作系统,供大家参考借鉴,希望可以帮助到您。
- 目录
篇1:Linux系统中配置构建Postfix文档linux操作系统
在CentOS中,默认的邮件服务器(SMTP方面)是sendmail,但sendmail有若干的缺点,比如,配置复杂、安全漏洞曾被多次发现并且依然存在隐患、邮件发送速度慢等等,这里就不再一一叙述
而另一个被广泛应用于邮件服务方面的“Postfix”的缺点就少得多,或者说它就是针对于sendmail的缺点,而被设计的,对应sendmail的短处,它在各方面也比较成熟。所以,无特殊要求,这里不推荐用sendmail来构建邮件服务器。本站介绍的邮件服务器配置方法,也将基于Postfix。
确认MX记录的添加是否生效的方法:
代码如下复制代码[root@sample ~]# host -t mx centospub.com
centospub.com mail is handled by 10 mail.centospub.com. 确认MX记录生效
然后安装postfix
代码如下复制代码[root@sample ~]# yum -y install postfix 在线安装Postfix
对postfix进行配置
代码如下复制代码[root@sample ~]# vi /etc/postfix/main.cf 编辑Postfix的配置文件
#myhostname = host.domain.tld 找到此行,将等号后面的部分改写为主机名
myhostname = sample.centospub.com 变为此状态,设置系统的主机名
#mydomain = domain.tld 找到此行,将等号后面的部分改写为域名
mydomain = centospub.com 变为此状态,设置域名(我们将让此处设置将成为E-mail地址“@”后面的部分)
#myorigin = $mydomain 找到此行,将行首的#去掉
myorigin = $mydomain 变为此状态,将发信地址“@”后面的部分设置为域名(非系统主机名)
inet_interfaces = localhost 找到此行,将“localhost”改为“all”
inet_interfaces = all 变为此状态,接受来自所有网络的请求
mydestination = $myhostname, localhost.$mydomain, localhost 找到此行,在行为添加“$mydomain”
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 变为此状态,指定发给本地邮件的域名
#relay_domains = $mydestination 找到此行,将行首的#去掉
relay_domains = $mydestination 变为此状态,定义允许转发的域名
#mynetworks = 168.100.189.0/28, 127.0.0.0/8 找到此行,依照自己的内网情况修改
mynetworks = 168.100.189.0/28, 127.0.0.0/8 变为此状态,指定内网和本地的IP地址范围
#home_mailbox = Maildir/ 找到这一行,去掉行首的#
home_mailbox = Maildir/ 变为此状态,指定用户邮箱目录
# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server’s greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) 找到这一行,接此行添加如下行:
smtpd_banner = $myhostname ESMTP unknow 添加这一行,不显示SMTP服务器的相关信息
在配置文件的文尾,添加如下行:
smtpd_sasl_auth_enable = yes 服务器使用SMTP认证
smtpd_sasl_local_domain = $myhostname 指定SMTP认证的本地域名(主机名)
smtpd_sasl_security_options = noanonymous 不允许匿名的方式认证
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
message_size_limit = 15728640 规定邮件最大尺寸为15MB
2、配置SMTP认证的相关选项
为了提高安全性,我们不将系统用户的密码作为相应用户SMTP认证的密码,而将在后面为用户建立SMTP认证专用的密码。
代码如下复制代码[root@sample ~]# vi /usr/lib/sasl2/smtpd.conf 编辑SMTP认证的配置文件
pwcheck_method: saslauthd 找到此行,将“saslauthd”改为“auxprop”
pwcheck_method: auxprop 不使用系统用户密码作为用户的SMTP认证密码
[root@sample ~]# vi /etc/sysconfig/saslauthd
MECH=shadow 找到这一行,在前面加#
#MECH=shadow 不使用shadow机制
FLAGS= 找到此行,在等号后面添加“sasldb”
FLAGS=sasldb 定义认证方式为sasldb2
3、建立用户的邮箱目录
首先建立用户模板下的邮箱目录,以便于建立新用户时,相应用户的邮箱目录自动被建立,
代码如下复制代码[root@sample ~]# mkdir /etc/skel/Maildir 在用户模板下建立用户邮箱目录
[root@sample ~]# chmod 700 /etc/skel/Maildir 设置用户邮箱目录属性为700
然后再为已经存在的用户创建相应有项目了。 www.111cn.net
代码如下复制代码[root@sample ~]# mkdir /home/centospub/Maildir 为用户(这里以centospub用户为例)建立邮箱目录
[root@sample ~]# chmod 700 /home/centospub/Maildir 设置该用户邮箱目录属性为700
[root@sample ~]# chown centospub. /home/centospub/Maildir 设置该用户邮箱目录为该用户所有
4、为用户设置smtp认证密码
代码如下复制代码[root@sample ~]# saslpasswd2 -u sample.centospub.com -c centospub 为centospub用户设置SMTP认证密码
Password: 在这里输入密码(不会显示)
Again (for verification): 再次输入密码
5、改变SALS的属性及归属
代码如下复制代码[root@sample ~]# chgrp postfix /etc/sasldb2 将数据库归属改为postfix,
[root@sample ~]# chmod 640 /etc/sasldb2 将数据库属性改为640
6、关闭sendmail服务及设置默认MTA
因为在用Postfix作为SMTP服务器的前提下,我们不准备再用sendmail,所以将sendmail服务关掉,以确保安全及节省系统资源。
代码如下复制代码[root@sample ~]# /etc/rc.d/init.d/sendmail stop 关闭sendmail服务
Shutting down sendmail: [ OK ]
Shutting down sm-client: [ OK ]
[root@sample ~]# chkconfig sendmail off 关闭sendmail自启动
[root@sample ~]# chkconfig –list sendmail 确认sendmail自启动已被关闭(都为off就OK)
sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
然后再将默认的MTA设置为Postfix。
代码如下复制代码[root@sample ~]# alternatives –config mta 设置默认MTA
There are 2 programs which provide ’mta’.
Selection Command
———————————————–
1 /usr/sbin/sendmail.sendmail 当前状态:sendmail为默认MTA
2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number:
2 在这里输入2,使Postfix成为默认MTA
启动相应服务
最后,启动SMTP认证及Postfix服务,并设置相应服务为自启动。
代码如下复制代码[root@sample ~]# chkconfig saslauthd on 将SMTP-Auth设置为自启动
[root@sample ~]# chkconfig –list saslauthd 确认SMTP-Auth服务状态
saslauthd 0:off 1:off 2:on 3:on 4:on 5:on 6:off 确认2~5为on的状态就OK
[root@sample ~]# /etc/rc.d/init.d/saslauthd start 启动SMTP-Auth
Starting saslauthd: [ OK ]
[root@sample ~]# chkconfig postfix on 将Postfix设置为自启动
[root@sample ~]# chkconfig –list postfix 确认Postfix服务状态
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off 确认2~5为on的状态就OK
[root@sample ~]# /etc/rc.d/init.d/postfix start 启动Postfix
Starting postfix: [ OK ]
至此,就完成了SMTP服务器方面的配置,但目前只具从备客户端通过服务器发送邮件的功能。做为完整的邮件服务器,还需具备从客户端通过POP/IMAP协议接受邮件到本地的功能。
篇2:linux系统中配置vsftpd及用户权限linux操作系统
vsftpd服务器是linux中一个非常实用的文件上传管理工具了,下面我就来给大家介绍在vps中关于vsftpd配置与权限分配方法,希望例子对大家会有所帮助,
先确认下安装上了没,可以使用
代码如下复制代码[root@localhost sv005-mongodb]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
或者使用命令
[root@localhost sv005-mongodb]# chkconfig --list vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
如果没有安装我们需要先是需要安装:
代码如下复制代码yum install vsftpd
然后启动vsftpd : /etc/init.d/vsftpd start
vi /etc/vsftpd/vsftpd.conf 修改里面的 这两项:
chroot_local_user=YES (须添加)
chroot_list_enable=NO
然后 保存即可!
创建用户组:
groupadd 用户组
useradd -g webusers -d /路径 用户名
passwd 用户名 修改用户的密码。
chown -R 用户名:用户组 /路径/
刚才由于修改了配置文件 所以要记得重启:service vsftpd restart
OK ! 成功了!
到上面就完成了,如果你还需要加一些虚拟用户,我们可向下看
vsFTPD配置虚拟用户
FTP用户一般是不能登录系统的,这也是为了安全。在系统中,没有权限登录系统的用户一般也被称之为虚拟用户;虚拟用户也是要写进 /etc/passwd中;这只是一种虚拟用户的方法,但说实在的并不是真正的虚拟用户,只是把他登录SHELL的权限去掉了,所以他没有能力登录系统;如果我们想把beinan这个用户目录定位在/opt/beinan这个目录中,并且不能登录系统;我们应该如下操作。
代码如下复制代码[root@localhost ~]# adduser -d /opt/beinan -g ftp -s /sbin/nologin beinan[root@localhost ~]# passwd beinan
Changing password for user beinan.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
其实这还是不够的,还要改一下配置文件vsftpd.conf ,以确保本地虚拟用户能有读写权限;
local_enable=YES
write_enable=YES
local_umask=022
如何实现虚拟路径?
比如:
代码如下复制代码/home/a 映射为 ftp://localhost/a/home/b/c 则为 ftp://localhost/c
可以通过如下的方法来实现,
[root@localhost ~]# mount –bind [原有的目录] [新目录]
比如我的ftp的默认目录是/var/ftp,我想把/mnt/LinG/WinSoft文件夹,映射到/var/ftp目录中,我就如下操作
我们要先在/var/ftp目录中建一个目录
代码如下复制代码[root@localhost ~]# mkdir /var/ftp/WinSoft然后执行mount命令
[root@localhost ~]# mount –bind /mnt/LinG/WinSoft /var/ftp/WinSoft
这样就OK了。
打开Linux vsFTPDv服务器的日志功能
把下面xferlog_file前面的#号对掉,也就是把vsftp的log功能打开,这样我们就能在/var/log目录下查看vsftpd.log。这是vsFTP的日志功能,这对于我们来说是极为重要的。xferlog_file=/var/log/vsftpd.log如何让vsFTP服务器限制链接数,以及每个IP最大的链接数?应该改Linux vsFTPD服务器的配制文件vsftpd.conf,加入下面的两行:
max_clients=数字
max_per_ip=数字
举例:我想让我的vsFTP最大支持链接数为100个,每个IP,最多能支持5个链接,所以我应该在vsftpd.conf中加上如下的两行:
max_clients=100
max_per_ip=5
如何限制传输速度?
anon_max_rate=数字
注:这是匿名的速度
local_max_rate=数字
注:这是vsFTP服务器上本地用户的速度
注:这个数字的单位是byte,所以我们要计算一下。
比如我想让匿名用户和vsFTP上的用户都以80KB下载,所以这个数字应该是1024×80=81920
所以我们要在vsftpd.conf中加入下面的两行
anon_max_rate=81920
local_max_rate=81920
下面是一些常用的命令:
管理用户组(group)的工具或命令;
groupadd 注:添加用户组;
groupdel 注:删除用户组;
groupmod 注:修改用户组信息
groups 注:显示用户所属的用户组
用户管理命令
useradd 注:添加用户
userdel 注 :删除用户
adduser 注:添加用户
passwd 注:为用户设置密码
usermod 注:修改用户命令,可以通过usermod 来修改登录名、用户的家目录等等;
篇3:linux系统中nginx HTTP配置方法linux操作系统
在windows上折腾过nginx的HTTP基本验证,没有成功.这次换到centos服务器,顺手加上HTTP的一个验证功能,下面给大家分享一下,
首先安装htpasswd命令.
yum install httpd
1.打开站点配置文件
location / {
auth_basic “Admin Auth”;
auth_basic_user_file /usr/local/nginx/conf/proxy/pwd;
....
auth_basic为认证页面提示语,auth_basic_user_file 为密码认证文件
2.新建pwd文件,输入一对密码串 yourname:yourpass
用户名:密码
3.生成加密串
htpasswd /usr/local/nginx/conf/proxy/pwd yourname
4.重载或重启nginx,HTTP基本验证就生效了
篇4:linux系统中WordPress伪静态配置方法linux操作系统
NMP环境是目前我们国内站长使用的Linux VPS配置环境中使用较多的,作为新手我们很可能会看到笔者类似的”LNMP安装教程”然后依葫芦画瓢的去安装VPS。
L我们是否有发现环境中我们较为常用的wordpress伪静态不生效,内页出现404错误页面。这个问题很好解决,因为我们lnmp采用的是nginx,而不是apache,所以不如apache直接丢htaccess文件到网站根目录就可以生效伪静态。
首先,默认安装的lnmp环境中已经有伪静态文件wordpress.conf文件在”/usr/local/nginx/conf/wordpress.conf”中,我们可以核对一下里面的编译代码是不是为:
代码如下复制代码if (-f $request_filename/){
rewrite (.*) $1/ break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
如果不是,我们需要修改成上面的代码文件用来rewrite跳转伪静态,
其次,我们需要在属于我们网站的配置文件:
/usr/local/nginx/conf/vhost/www.***.org.conf(自己添加域名自动命名)
我们会看到类似下面的代码,看到粗线部分是我添加进去的,你就添加进去就可以:
代码如下复制代码server {
listen 80;
server_name www.111cn.net;
index index.html index.php;
include wordpress.conf;
最后,我们用ssh登录VPS,然后用下面的命令重启lnmp
/root/lnmp restart
执行上面三步骤之后,我们是不是已经解决了伪静态问题,其他常用的CMS也是一样的,在默认的conf下基本都包含我们所需要的CMS伪静态编译脚本。
篇5:Linux中网络如何设置配置linux操作系统
使用linux系统内核的系统有很多,目前比较主流的有centos,fdeora,redha系统,这些有一些收费有一些免费的,但此方法可用于我讲述的三种系统中哦,
安装Linux系统后,登陆进去,修改一下文件:
代码如下复制代码# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=”eth0″
BOOTPROTO=”none”
HWADDR=”00:50:56:BE:7A:D8″
IPADDR=192.168.2.108 #IP地址,必须设置
GATEWAY=192.168.2.21 #网关地址,这个很重要,如果不设置这个就智能是局域网无法和外部网络互联了
NBOOT=”yes” #开机启动设置为yes
UUID=”fe45f058-9ce7-42a4-823c-abe472aad9f2″
IPV6INIT=no
NETMASK=255.255.255.0 #子网掩码
设置好之后,编辑域名服务器设置文件
代码如下复制代码# cat /etc/resolv.conf
nameserver 192.168.2.01 #域名服务器的地址,如果不设置这个,则无法以域名的方式访问网站
search hostname #这个相当于你本机的域名
设置好了之后重启network服务
代码如下复制代码# /etc/init.d/network restart
这样执行以下ifconfig命令就能看到你本机已经联网了,可以使用ping 命令去测试是否联网,
友情提示:
直接修改/etc/resolv.conf这个文件是没用的,网络服务重启以后会根据/etc/sysconfig/network-scripts/ifcfg-eth0来重载配置,如果ifcfg-eth0没有配置DNS,那么resolv.conf会被冲掉,重新变成空值。
怎么办呢?下面有两种解决方法:
1、通过ifcfg-eth0也可以设置DNS服务器地址,并自动修改或生成resolv.conf文件.
2、在ifcfg-eth0中可以通过PEERDNS参数决定是否修改resolv.conf文件,设置PEERDNS=yes(这也是系统的默认配置)则启用该网络设备时,会修改或生成resolv.conf文件,设置PEERDNS=no,则不对resolv.conf做任何变动.
补充的部分:
当有应用需要进行域名解析时(如:ping www.111cn.net),会首先读取resolv.conf文件获取dns服务器地址,然后再向该dns服务器发送域名解析请求,若resolv.conf设置的不对或者没有resolv.conf都会导致域名解析失败.
若ifcfg-eth0被配置为DHCP模式,则系统默认PEERDNS=no,也就是会用DHCP获取的DNS地址修改或生成resolv.conf文件.
我觉得没有特殊情况,不用在resolv.conf中设置DNS,应在ifcfg-eth0中设定DNS服务器地址方便些,即符合正常思维也更便于维护和管理.
注意:设置网络的方法仅限于fedora,redhat,centos之类的以rpm包管理的Linux系统,其他系统可能有点差异
篇6:linux中redis安装配置linux操作系统
MySQL是关系型数据库,并不擅长分布式数据出路,因为它缺乏并行执行查询的能力,这时候,可以使用其他工具。如redis。
redis是非关系型数据库。Nosql的一个开源项目。对于简单的键值存储,在复制严重落后的非常高速的访问场景中可以使用redis替代mysql。
redis安装如下。
1、下载安装包,下载地址是servicestack。如我下载的版本是redis-2.0.2.rar。
2、解压文件到相应目录。可以看到解压后内有文件:
3、其中配置文件需要自己创建,现将源代码附在下面:
代码如下复制代码# Redis configuration file example# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
# When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
# You can specify a custom pid file location here.
pidfile /var/run/redis.pid
# Accept connections on the specified port, default is 6379
port 6379
# If you want you can bind a single interface, if the bind option is not
# specified all the interfaces will listen for connections.
#
# bind 127.0.0.1
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 300
# Set server verbosity to 'debug'
# it can be one of:
# debug (a lot of information, useful for development/testing)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel debug
# Specify the log file name. Also 'stdout' can be used to force
# the demon to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile stdout
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT
# dbid is a number between 0 and 'databases'-1
databases 16
################################ SNAPSHOTTING #################################
#
# Save the DB on disk:
#
# save
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
save 900 1
save 300 10
save 60 10000
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
rdbcompression yes
# The filename where to dump the DB
dbfilename dump.rdb
# For default save/load DB in/from the working directory
# Note that you must specify a directory not a file name.
dir ./
################################# REPLICATION #################################
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. Note that the configuration is local to the slave
# so for example it is possible to configure the slave to save the DB with a
# different interval, or to listen to another port, and so on.
#
# slaveof
# If the master is password protected (using the “requirepass” configuration
# directive below) it is possible to tell the slave to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the slave request.
#
# masterauth
################################## SECURITY ###################################
# Require clients to issue AUTH
before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# requirepass foobared
################################### LIMITS ####################################
# Set the max number of connected clients at the same time. By default there
# is no limit, and it's up to the number of file descriptors the Redis process
# is able to open. The special value '0' means no limts.
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
# maxclients 128
# Don't use more memory than the specified amount of bytes.
# When the memory limit is reached Redis will try to remove keys with an
# EXPIRE set. It will try to start freeing keys that are going to expire
# in little time and preserve keys with a longer time to live.
# Redis will also try to remove objects from free lists if possible.
#
# If all this fails, Redis will start to reply with errors to commands
# that will use more memory, like SET, LPUSH, and so on, and will continue
# to reply to most read-only commands like GET.
#
# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
# 'state' server or cache, not as a real DB. When Redis is used as a real
# database the memory usage will grow over the weeks, it will be obvious if
# it is going to use too much memory in the long run, and you'll have the time
# to upgrade. With maxmemory after the limit is reached you'll start to get
# errors for write operations, and this may even lead to DB inconsistency.
#
# maxmemory
############################## APPEND ONLY MODE ###############################
# By default Redis asynchronously dumps the dataset on disk. If you can live
# with the idea that the latest records will be lost if something like a crash
# happens this is the preferred way to run Redis. If instead you care a lot
# about your data and don't want to that a single record can get lost you should
# enable the append only mode: when this mode is enabled Redis will append
# every write operation received in the file appendonly.log. This file will
# be read on startup in order to rebuild the full dataset in memory.
#
# Note that you can have both the async dumps and the append only file if you
# like (you have to comment the “save” statements above to disable the dumps).
# Still if append only mode is enabled Redis will load the data from the
# log file at startup ignoring the dump.rdb file.
#
# The name of the append only file is “appendonly.log”
#
# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
# log file in background when it gets too big.
appendonly no
# The fsync call tells the Operating System to actually write data on disk
# instead to wait for more data in the output buffer. Some OS will really flush
# data on disk, some other OS will just try to do it ASAP.
#
# Redis supports three different modes:
#
# no: don't fsync, just let the OS flush the data when it wants. Faster.
# always: fsync after every write to the append only log . Slow, Safest.
# everysec: fsync only if one second passed since the last fsync. Compromise.
#
# The default is “always” that's the safer of the options. It's up to you to
# understand if you can relax this to “everysec” that will fsync every second
# or to “no” that will let the operating system flush the output buffer when
# it want, for better performances (but if you can live with the idea of
# some data loss consider the default persistence mode that's snapshotting).
appendfsync always
# appendfsync everysec
# appendfsync no
############################### ADVANCED CONFIG ###############################
# Glue small output buffers together in order to send small replies in a
# single TCP packet. Uses a bit more CPU but most of the times it is a win
# in terms of number of queries per second. Use 'yes' if unsure.
glueoutputbuf yes
# Use object sharing. Can save a lot of memory if you have many common
# string in your dataset, but performs lookups against the shared objects
# pool so it uses more CPU and can be a bit slower. Usually it's a good
# idea.
#
# When object sharing is enabled (shareobjects yes) you can use
# shareobjectspoolsize to control the size of the pool used in order to try
# object sharing. A bigger pool size will lead to better sharing capabilities.
# In general you want this value to be at least the double of the number of
# very common strings you have in your dataset.
# www.111cn.net
# WARNING: object sharing is experimental, don't enable this feature
# in production before of Redis 1.0-stable. Still please try this feature in
# your development environment so that we can test it better.
# shareobjects no
# shareobjectspoolsize 1024
4、命令行进入安装目录下(或者配置环境变量),
如图,
5、另开一个cmd,输入redis_cli.exe -h 127.0.0.1 -p 6349。接下来,你就可以玩了。
篇7:linux系统中VNC远程桌面安装和配置方法详解linux操作系统
本文章来给大家介绍linux系统中VNC远程桌面安装和配置方法详解,有需要了解的朋友可参考,这我里介绍的是在环境是CentOS-6.4-x86_64,使用VNC远程桌面后,用户可以使用客户端登陆linux的桌面,并且支持多人登陆操作。
具体方法
1.检查linux系统是否安装VNC命令rpm -q vnc-server
如果没有安装则使用yum install vnc vnc-server
2.启动vnc服务
代码如下复制代码vncserverYou will require a password to access your desktops.
Password:
Verify:
输入两次密码,这个就是你远程登陆时所需要的密码。
3.修改配置文件,root账户下
代码如下复制代码vi /etc/sysconfig/vncservers新加下面的配置
代码如下复制代码VNCSERVERS=”10000:root” #10000:root (桌面号:用户)VNCSERVERARGS[2]=”-geometry 1024×768 -nolisten tcp -localhost”
4.配置防火墙,允许10000+5900=15900端口通过防火墙访问桌面
代码如下复制代码vi /etc/sysconfig/iptables-A INPUT -m state –state NEW -m tcp -p tcp –dport 15900 -j ACCEPT
5.重启vnc服务和防火墙。
代码如下复制代码/etc/init.d/vncserver restart/etc/init.d/iptables restart
6.设置vnc的自启动
代码如下复制代码chkconfig vncserver on更改密码可以使用vncpasswd命令
上面是我的操作过程,后来从众生找到一篇图文的教程,大家不防参考一下
使用ssh软件连接到系统,使用命令vncserver启动vnc服务
首次使用vncserver会提示输入密码,然后重复输入一次(此处输入geisnic.com
作为密码,须记住此密码),回车出现下图提示:
此处记住dispay#,这里是feng:1,display#即为1.
在当前用户的主目录下打开文件.vnc/xstartup, 因为这里使用的是root用户,所以文件在/root目录下,打开文件后,注释掉所有的行,加入一行gnome-session & ,保存退出,
使用命令vncserver -kill :dispaly# 上面步骤中一说明了dispaly#的查看方法,这里为1,输入命令回车
再次使用命令vncserver重启服务
记住此处的dispaly#为1.
Vncserver默认端口是5900,此处在防火墙中开放此端口
vi /etc/sysconfig/iptables
找到下面的语句:
-A RH-Firewall-1-INPUT -j REJECT ——reject-with icmp-host-prohibited
在此行之前,加上下面的内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT
然后重启iptables服务:service iptables restart
即可。
在本地系统中打开软件vnc Viewer(vnc客户端),输入机器的Ip地址加上dispaly#
此处是 118.126.16.219:1
点确定,出现如下输入框,输入刚刚设置的密码geisnic.com
点确定即可登录至系统
设置vncserver开机自动启动:chkconfig vncserver on
★ FreeBSD手册――配置FreeBSD内核Unix系统
★ 磁盘阵列unit名与操作系统设备名如何对应Windows系统
Linux系统中配置构建Postfix文档linux操作系统(精选7篇)




