linuxisthisok
⑴ linux 文件服务器怎么搭建
在前面一个章节学习的ftp文件传输服务确确实实让咱们在主机之间传输文件变得非常方便,但FTP协议的本质是传输文件,并不是共享文件,要想让客户端能够直接在服务端上面修改文件内容还是比较麻烦的事情。于是在1987年时,由微软和英特尔公司共同制订了SMB服务器通信协议(Server MessagesBlock),这项技术的诞生是为了解决局域网内的文件或打印机等资源的共享服务问题,让多个主机之间共享文件变成越来越简单。
后来到了1991年,当年还在读大学的学生Tridgwell为了解决Linux与Windows系统之间的文件共享问题,便基于了这项SMB技术协议开发出了SMBserver这一款服务程序,SMBserver服务程序是一款基于SMB协议并由服务端和客户端组成的开源文件共享软件,通过非常简单的配置就能够实现Linux系统与Windows系统之间的文件共享工作。当时还在上学的Tridgwell想要把这款SMBServer软件注册成为商标,但却被商标局以SMB是没有意义的字符而拒绝了他的申请,经过Tridgwell不断的翻看词典,突然看到一个拉丁舞蹈的名字——SAMBA,如图12-1所示,这个热情洋溢的舞蹈名字中又恰好包含了SMB(SAMBA),于是这便是Samba服务程序名字的由来,现在已经成为了Linux系统与Windows系统之间共享文件的最佳选择。
Samba服务程序的配置方法跟咱们以前学习过的服务很相似,首先咱们需要先通过yum软件仓库来安装samba服务程序,这款软件也恰巧是软件包的名字,很好记吧~:
java">[root@linuxprobe~]#yuminstallsamba
Loadedplugins:langpacks,proct-id,subscription-manager
………………省略部分输出信息………………
Installing:
sambax86_644.1.1-31.el7rhel527k
TransactionSummary
================================================================================
Install1Package
Totaldownloadsize:527k
Installedsize:1.5M
Isthisok[y/d/N]:y
Downloadingpackages:
Runningtransactioncheck
Runningtransactiontest
Transactiontestsucceeded
Runningtransaction
Installing:samba-4.1.1-31.el7.x86_641/1
Verifying:samba-4.1.1-31.el7.x86_641/1
Installed:
samba.x86_640:4.1.1-31.el7
Complete!
安装后打开Samba服务程序的主配置后发现竟然有320行呢!有没有被吓到?但仔细一看发现其实大多都是以#(井号)开头的注释信息行,既然您手中已经拥有了刘遄老师的经验之书,就肯定不会让您去“死啃”这些东东的~:
[root@linuxprobe ~]# cat /etc/samba/smb.conf
# This is the main Samba configuration file. For detailed information about the
# options listed here, refer to the smb.conf(5) manual page. Samba has a huge
# number of configurable options, most of which are not shown in this example.
#
# The Official Samba 3.2.x HOWTO and Reference Guide contains step-by-step
# guides for installing, configuring, and using Samba:
# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# The Samba-3 by Example guide has working examples for smb.conf. This guide is
# generated daily: http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# In this file, lines starting with a semicolon (;) or a hash (#) are
# comments and are ignored. This file uses hashes to denote commentary and
# semicolons for parts of the file you may wish to configure.
#
# Note: Run the "testparm" command after modifying this file to check for basic
# syntax errors.
#linuxprobe.com
………………省略部分输出信息………………
由于这次配置文件中的注释信息行实在太多,不便于分析里面的重要参数,因此咱们可以先将配置文件改个名字,然后使用cat命令读入主配置文件内容后通过grep命令-v参数(反向选择)分别去掉所有以#(井号)和;(分号)开头的注释信息行,对于剩余的空白行可以再用^$来表示并反选过滤,最后将过滤后的可用参数信息通过重定向符覆盖写入到原始文件名称中即可。samba服务程序过滤后的参数并不复杂,为了更方便同学们查阅参数功能,刘遄老师在重要参数行后面都写上了注释说明:
php">[root@linuxprobe~]#mv/etc/samba/smb.conf/etc/samba/smb.conf.bak
[root@linuxprobe~]#cat/etc/samba/smb.conf.bak|grep-v"#"|grep-v";"|grep-v"^$">/etc/samba/smb.conf
[root@linuxprobe~]#cat/etc/samba/smb.conf
⑵ 如何用命令行开启nodejs搭建web服务器
首先,需要安装nodejs,这个可以去官网下载,目前我本地安装的v0.12版本。
安装完成后可以通过命令行测试安装是否成功,输入:node -v,应该会显示当前安装node版本号。
本文中用到的模块,都是nodejs核心模块,不需要从外部下载,如果有需要,可以使用以下命令安装:npm install xxx。
开始
下一步,新建js文件,可以命名为server.js,代码如下:
var http = require('http');
var url = require('url');
var path = require('path');
var fs = require('fs');
var dir, arg = process.argv[2] || ''; // 命令行第三个参数,用来接收目录,可为空,相对当前server.js文件的目录名称
// 比如使用命令 node server debug,意思就是debug文件夹与server.js文件同级
// 且你想以debug文件夹启动web服务
http.createServer(function (req, res) {
var pathname = __dirname + url.parse(req.url).pathname;
⑶ linux 里没有ftp服务 怎么安装
Linux中的ftp服务器一般是安装vsftp。以centos为例,具体操作如下:
1、运行yum install vsftpd命令
命令具体的细节如下:
[[email protected]]# yum install vsftpd
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package vsftpd.i386 0:2.0.5-12.el5 set to be updated
filelists.xml.gz 100% |=========================| 648 kB 02:46
http://ftp.hostrino.com/pub/centos/5.2/os/i386/repodata/filelists.xml.gz: [Errno 4] Socket Error: timed out
Trying other mirror.
filelists.xml.gz 100% |=========================| 2.8 MB 00:21
filelists.xml.gz 100% |=========================| 1.1 MB 00:12
filelists.xml.gz 100% |=========================| 132 kB 00:01
filelists.xml.gz 100% |=========================| 150 B 00:00
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
vsftpd i386 2.0.5-12.el5 base 137 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 137 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): vsftpd-2.0.5-12.el 100% |=========================| 137 kB 00:01
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 “CentOS-5 Key (CentOS 5 Official Signing Key) <[email protected]>” from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vsftpd ######################### [1/1]
Installed: vsftpd.i386 0:2.0.5-12.el5
Complete!
[root@localhost ~]#
2、将 /etc/vsftpd/user_list文件和/etc/vsftpd/ftpusers文件中的root这一行注释掉
#root
3、执行以下命令
# setsebool -P ftpd_disable_trans=1
修改/etc/vsftpd/vsftpd.conf,在最后一行处添加local_root=/
4、/sbin/service iptables stop (linux是虚拟机的话要运行这个一句)
5、/sbin/service vsftpd restart
一下是对配置文件中一些参数的说明:
centOS vsftpd建FTP,配置文件有三:
/etc/ftpusers
/etc/vsftpd.user_list
/etc/vsftpd/vsftpd.conf 这个是主配置文件,,
/etc/vsftpd/vsftpd.conf vsftpd.conf 默认配置:
anonymous_enable=YES 允许匿名登录
local_enable=YES 允许本地用户登录
write_enable=YES 开放本地用户写权限
local_umask=022 设置本地用户生成文件的掩码为022
#anon_upload_enable=YES 此项设置允许匿名用户上传文件
#anon_mkdir_write_enable=YES 开启匿名用户的写和创建目录的权限
dirmessage_enable=YES 当切换到目录时,显示该目录下的.message隐藏文件的内容
xferlog_enable=YES 激活上传和下载日志
connect_from_port_20=YES 启用FTP数据端口的连接请求
#chown_uploads=YES 是否具有上传权限. 用户由chown_username参数指定。
#chown_username=whoever 指定拥有上传文件权限的用户。此参数与chown_uploads联用。
#xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES 使用标准的ftpd xferlog日志格式
#idle_session_timeout=600 此设置将在用户会话空闲10分钟后被中断
#data_connection_timeout=120 将在数据连接空闲2分钟后被中断
#ascii_upload_enable=YES 启用上传的ASCII传输方式
#ascii_download_enable=YES 启用下载的ASCII传输方式
#ftpd_banner=Welcome to blah FTP service 设置用户连接服务器后显示消息
#deny_email_enable=NO
此参数默认值为NO。当值为YES时,拒绝使用banned_email_file参数指定文件中所列出的e-mail地址用户登录。
#banned_email_file=/etc/vsftpd.banned_emails 指定包含拒绝的e-mail地址的文件.
#chroot_list_enable=YES 设置本地用户登录后不能切换到自家目录以外的别的目录
#chroot_list_file=/etc/vsftpd.chroot_list
#ls_recurse_enable=YES
pam_service_name=vsftpd
设置PAM认证服务的配置文件名称,该文件存放在/etc/pam.d/
userlist_enable=YES
此项配置/etc/vsftpd.user_list中指定的用户也不能访问服务器,若添加userlist_deny=No,则仅仅/etc /vsftpd.user_list
文件中的用户可以访问,其他用户都不可以访问服务器。如过 userlist_enable=NO,userlist_deny=YES,则指定使文件/etc/vsftpd.user_list中指定的用户不可以访问服务器,其他本地用户可以访问服务器。
listen=YES 指明VSFTPD以独立运行方式启动
tcp_wrappers=YES 在VSFTPD中使用TCP_Wrappers远程访问控制机制,默认值为YES
⑷ linux 如何设置代理
linux设置代理linux系统设置yum,wget,rpm命令使用代理:1.Using
yum
with
a
proxyserver---------------------------------------To
enable
yum
operations
to
use
aproxy
server
you
should
first
add
the
following
parameter
to
/etc/yum.conf
proxy=http://yourproxy:8080/
where
yourproxy
is
the
name
of
the
proxy
server
you
want
to
access
and
8080
isthe
proxy
port.
If
the
server
requires
authentication
you
can
specify
the
logincredentials
like:proxy=http://username:password@yourproxy:8080/---------------------------------------2.
The
rpm
package
manager
makesuse
of
the
proxy
environment
variable.
This
can
be
set
system
wide
in
/etc/profile
or
user
specific
in
~/.bash_profile:export
http_proxy=http://yourproxy:8080/export
ftp_proxy=http://yourproxy:8080/---------------------------------------3.
To
use
wget
throug
a
proxy
serveradd
the
following
lines
to
/etc/wgetrc
http_proxy
=
http://yourproxy:8080/
ftp_proxy
=
http://yourproxy:8080/
⑸ 一篇看懂!详解-Linux系统中安装软件的三种方法
Linux系统中安装软件的三种方法
Linux系统中安装软件主要有三种方式:使用rpm命令、yum命令以及编译安装源码包。
使用rpm命令安装软件
格式:rpm [选项] RPM包文件
常用选项:
-i:安装一个新的rpm软件包
-h:以“#”号显示安装的进度
-v:显示安装过程中的详细信息
--force:强制安装所指定的rpm软件包
--nodeps:安装软件时,忽略依赖关系
例如:安装没有依赖包的.rpm软件
安装有依赖关系的.rpm软件包,可以同时将依赖包与软件包一起安装。
使用yum命令安装软件
格式:yum install 软件名 [-y]
常用选项:
-y:在安装软件时命令行不会出现"Is this ok[y/N]"这条提醒语句,直接安装软件。
例如:使用yum命令安装软件包。
清空yum源的缓存、卸载软件包、列出所有已安装的软件包、列出所有可安装的软件包、列出所有软件包的信息或单独一个软件包的信息。
使用yum命令安装组套件
格式:yum groupinstall 组名
使用yum grouplist命令可以查询到组名。
编译安装源码包
优点:编译安装源包必须要有源代码编译环境。
编译源代码步骤:解压、配置、编译、安装。
解压源码文件并释放出源代码文件,配置好安装参数,将源代码文件变为二进制的可执行程序,安装程序。
其它版本的Linux安装方式:deb包安装方式、apt方式安装、bin文件安装、不需要安装的软件。
对于不同版本的Linux,安装软件的命令及选项可能有所不同,具体可以根据系统文档或官方提供的安装指南进行操作。