Ubuntu8.04开发环境搭建

1. 使用硬盘源

在/etc/apt/source.list中将源修改为:

deb file://mnt/hgfs/vm_share/ubuntu_mirror/ubuntu.cn99.com/ubuntu hardy main restricted universe

更新源:
sudo apt-get update

2. tftp服务

需要在PC机的根目录下建立tftpboot目录并赋于此目录相关权限:
sudo mkdir /tftpboot
sudo chmod 777 tftpboot

ubuntu 8.04配置如下:
直接安装以下三个包即可。

sudo apt-get install  tftp atftpd xinetd

8.04的tftp服务下载文件时的默认目录(/tftpboot)是在/etc/inetd.conf中定义的。

可以更改此目录中的相关设置,将/srv/tftp改为/tftpboot即可;

更改后使用

sudo /etc/init.d/xinetd restart   //重新启动一下服务即可。

3. ftp服务
安装vsftpd
sudo apt-get install vsftpd
安装了之后会在/home/下建立一个ftp目录。这时候你可以试着访问下ftp://ip/地址。应该可以看到一个空白内容的ftp空间。

默认设置下匿名用户可以下载,但不能写入或上传。

启动、关闭、重启vsftpd

sudo /etc/init.d/vsftpd start       (启动)

sudo /etc/init.d/vsftpd stop       (关闭)

sudo /ete/init.d/vsftpd restart    (重启)


配置vsftpd.conf文件

首先,找到要配置的vsftpd.conf文件,此文在/etc/vsftpd.conf

其次,在修改之前先备份一下vsftpd.conf这个文件。输入如下命令备份文件:

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old

编辑vsftpd.conf文件。命令如下:

sudo vim /etc/vsftpd.conf

然后,可以按自己的要求修改文件中的参数:

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES       // 以standalone模式启动
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES     // 是否允许匿名用户登陆FTP,如果是否,则选NO
#
# Uncomment this to allow local users to log in.
#local_enable=YES             // 是否允许本地用户登陆
#
# Uncomment this to enable any form of FTP write command.
#write_enable=YES            // 设置本地用户写权限
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022              //  设置本地用户的文件掩码缺省为022,默认值为077
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES      //  是否允许匿名用户上传文件
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES      //  是否允许匿名用户建立目录并上传文件
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES               //  是否显示目录说明文件,缺省是YES,但需要手工创建.message文件
#
# Activate logging of uploads/downloads.
xferlog_enable=YES                     //  使用上传/下载日志(是否允许记录FTP传输过程)
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES        //  是否确信端口传输来自20
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever     //   是否改变上传文件的属主,如果需要则输入一个系统用户名,可把上传的文件都改成root属主
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log      //  FTP传输日志路径和名字,缺省为:/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
#xferlog_std_format=YES             //  是否使用标准的 ftp xferlog 模式
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600          //  设置缺省的断开不活跃会话时间为600秒
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120       //  将数据连接空闲2分钟后断开
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure             //  运行vsftpd需要的非特权系统用户,缺省为nobody
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES                          //  是否使用ASCII方式上传文件
#ascii_download_enable=YES                     //  是否使用ASCII方式下载文件
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.       //  定制欢迎信息
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES                     //  是否禁止匿名用户使用某些邮件地址
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails       //  如果禁止匿名用户使用某些邮件地址,则输入禁止的邮件地址路径和文件名
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES              //  是否将本地所有帐户限制在home目录下
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES               //  是否将系统用户限制在自己的home目录下
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list    //  如果限制系统用户在home目录下在,则在列表中写出被禁止的用户列表
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
#
# Debian customization
#
# Some of vsftpd's settings don't fit the Debian filesystem layout by
# default.  These settings are more Debian-friendly.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key


另附:

max_clients=10        //  可接受的最大客户数目为10

max_per_ip=5         //   每个IP的最大client数

anon_max_rate=50000      //  匿名用户传输率为50K

local_max_rate=60000      //  本地用户传输率为60K

Accept_timeout=60           //  客户端空闲1分钟后断开

Connect_timeout=60        //  中断60秒后重新连接

pasv_min_port=50000

pasv_max_port=60000     //  将客户端的数据连接端口改在50000~60000之间

默认功能:
    匿名用户可以登录,下载。但是无上传、修改权限。并且限制在ftp用户文件夹(/home/ftp) 下访问

匿名用户上传功能:
    write_enable=YES               #启用全局上传
    anon_upload_enable=YES         #启用匿名用户上传
    anon_mkdir_write_enable=YES    #启用匿名用户新建文件夹权限,建议不开启

匿名用户主目录(/home/ftp) 无法作为上传目录,需新建文件夹,并开启相应写权限
cd /home
sudo chown -R root:nogroup ftp
cd /home/ftp
sudo mkdir upload
sudo chown ftp/: upload/
sudo chmod 755 upload

sudo /etc/init.d/vsftpd restart

4. nfs配置

1)进行NFS服务器端与客户端的安装:

sudo apt-get install nfs-kernel-server  nfs-common  portmap

安装客户端的作用是可以在本机进行NFS服务的测试。

2)配置portmap

sudo dpkg-reconfigure portmap

运行后选择“否”

3)配置挂载目录和权限

sudo vim  /etc/exports

配置如下:

/home/nfsboot *(rw,sync)

/home/nfsboot是NFS的共享目录,*表示任何IP都可以共享这个目录,你可以改为受限的IP,rw表示的是权限,sync是默认的。


4)重启NFS服务

 sudo /etc/init.d/nfs-kernel-server restart 重启nfs服务

5)进行测试

尝试一下挂载本地磁盘

$ sudo mount localhost:/home/nfsboot /mnt 

$ sudo umount /mnt

5. samba
sudo apt-get install samba
安装完以后,就可以在windows的我的电脑的地址栏中输入此linux 机器的IP地址,然后就可以看到已经共享出来的资源了。

也可以修改/etc/samba/smb.conf文件,重新设置相关共享资源,例如可以在smb.conf文件的最后加入如下内容,
[Share]
path = /share
available = yes
browseable = yes
public = yes
writable = yes
这样就把/share目录下共享出去了,准许别人写此目录了。

最后一步就是重启samba服务。

sudo /etc/init.d/samba restart

现在网络上的计算机(windows或linux)都可以通过samba访问共享目录了。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值