ubuntu tftp server?ubuntu ssh安装

各位老铁们好,相信很多人对ubuntu tftp server都不是特别的了解,因此呢,今天就来为大家分享下关于ubuntu tftp server以及ubuntu ssh安装的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!

如何在CentOS Linux下安装ASTERISK和FreePBX

下面给出在linux上安装Asterisk,FreePBX的基本步骤。

1.首先是更新系统(可选)

在命令行中输入

sudo apt-get update

sudo apt-get upgrade

2.安装LAMP(Apache2+MySQL+PHP)

在命令行输入

sudo tasksel

选择 LAMP Server

3.添加额外的PHP软件包

sudo apt-get install php5-gd php-pear php-db sox curl

4.安装phpmyadmin(可选)

sudo apt-get install phpmyadmin

5.安装asterisk

sudo apt-get install asterisk asterisk-mysql asterisk-mp3

6.安装Freepbx准备工作

在安装Freepbx我们先要想好将Freepbx安装在哪个目录下,FreePBX为asterisk的Web管理应用,可以帮助用户配置Asterisk等。

1) Ubuntu的Web根目录为/var/www,因此我们可以把FreePBX安装到/var/www/freepbx目录下,为便于管理,创建三个子目录conf设置文件

log存放日志

public WEB应用。

sudo mkdir/var/www/freepbx/

sudo mkdir/var/www/freepbx/conf

sudo mkdir/var/www/freepbx/log

sudo mkdir/var/www/freepbx/public

2)创建设置文件/var/www/freepbx/conf/vhost.conf

sudo vim/var/www/freepbx/conf/vhost.conf

输入以下内容

<VirtualHost*:80>

ServerName freepbx

ServerAlias freepbx

ServerAdmin james.shen@guidebee.com

ErrorLog/var/www/freepbx/log/error.log

CustomLog/var/www/freepbx/log/access.log combined

DocumentRoot/var/www/freepbx/public

<Directory/var/www/freepbx/public>

Options Indexes FollowSymLinks MultiViews

Order allow,deny

AllowOverride All

Allow from all

</Directory>

<Directory/var/www/freepbx/public/admin>

AuthType Basic

AuthName"Restricted Area"

AuthUserFile freepbx-passwd

Require user admin

</Directory>

</VirtualHost>

修改 ServerAdmin到你自己的Email地址。

3)将vhost添加到 Apache的sites-enabled目录下

sudo ln-s/var/www/freepbx/conf/vhost.conf/etc/apache2/sites-available/freepbx

cd/etc/apache2/sites-enabled/

sudo ln-s../sites-available/freepbx

4)创建用户和密码来验证合法用户可以来配置FreePBX(有权限访问该网页)

sudo htpasswd-c/etc/apache2/freepbx-passwd admin

5)重启Apache

sudo/etc/init.d/apache2 restart

有了这些准备工作后,就可以开始安装FreePBX了

7.安装FreePBX

1)下载FreePBX安装包

cd/tmp

wget

cd/usr/src

sudo tar xvzf/tmp/freepbx-2.8.1.tar.gz

cd freepbx-2.8.1/

2)创建数据库

mysqladmin create asterisk-u root-p

mysqladmin create asteriskcdrdb-u root-p

mysql-u root-p asterisk< SQL/newinstall.sql

mysql-u root-p asteriskcdrdb< SQL/cdr_mysql_table.sql

3)创建数据库用户

mysql-u root-p

在SQL命令行输入GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY‘badasspassword’;

GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY‘badasspassword’;

flush privileges;

quit;

注意将badasspassword换成你自己选择的密码。

4)备份modules.conf, FreePBX安装时会修改Apache的配置文件

sudo cp/etc/asterisk/modules.conf~/asterisk-modules.conf

5)安装FreePBX

sudo./install_amp

输入对应的参数

Enter your USERNAME to connect to the'asterisk' database:

[asteriskuser] asterisk

Enter your PASSWORD to connect to the'asterisk' database:

[amp109] badasspassword

Enter the hostname of the'asterisk' database:

[localhost]

Enter a USERNAME to connect to the Asterisk Manager interface:

[admin]

Enter a PASSWORD to connect to the Asterisk Manager interface:

[amp111]

Enter the path to use for your AMP web root:

[/var/www/html]

/var/www/freepbx/public

Enter the IP ADDRESS or hostname used to access the AMP web-admin:

[xx.xx.xx.xx] freepbx

Enter a PASSWORD to perform call transfers with the Flash Operator Panel:

[passw0rd] password

Use simple Extensions [extensions] admin or separate Devices and Users [deviceanduser]?

[extensions]

Enter directory in which to store AMP executable scripts:

[/var/lib/asterisk/bin]

6)恢复asterisk-modules.conf

sudo cp~/asterisk-modules.conf/etc/asterisk/modules.conf

7)添加asterisk用户

sudo adduser www-data asterisk

修改权限/etc/amportal.conf中添加

AMPASTERISKUSER=www-data

AMPASTERISKGROUP=asterisk

AMPASTERISKWEBUSER=www-data

AMPASTERISKWEBGROUP=asterisk

重启amportal

sudo amportal start

8)使用amport启动Asterisk

sudo update-rc.d-f asterisk remove

sudo sed-e s/BACKGROUND=0/BACKGROUND=1/-i/usr/sbin/safe_asterisk

修改/etc/rc.local

在exit 0前添加

/usr/local/sbin/amportal start

至此,安装完毕。

如何安装linux的tftp服务器

以下资料来源网上:

fedora下tftp服务器的安装与配置

总结过程如下:

1.下载tftp服务器、客户端tftp和守护进程xinetd三个包

yum install xinetd tftp tftp-server

//xinetd.i386 2:2.3.14-21.fc10

//tftp-0.49-1.fc10.i386.rpm

//tftp-server-0.49-1.fc10.i386.rpm

2.配置vi/etc/xinetd.d/tftp

修改server_args=-s/tftpboot-c,这里的-c一定要加上,否则只能下载不能上传!!!

service tftp

{

disable= no

socket_type= dgram

protocol= udp

wait= yes

user= root

server=/usr/sbin/in.tftpd

server_args=-s/tftpboot-c

per_source= 11

cps= 100 2

flags= IPv4

}

3.关闭防火墙

4.建立tftp工作目录并修改属性(不修改属性会出现error)

cd/

mkdir tftpboot

chmod 777-R/tftpboot/

5.开启服务,上传下载文件

######################################

我的配置过程中先后顺序和出现的问题如下:

下载tftp服务客户端tftp和守护进程xinetd

yum install xinetd

yum install tftp tftp-server

//xinetd.i386 2:2.3.14-21.fc10

//tftp-0.49-1.fc10.i386.rpm

//tftp-server-0.49-1.fc10.i386.rpm

关闭防火墙

service xinetd restart

Stopping xinetd: [ OK ]

Starting xinetd: [ OK ]

cd/

mkdir tftpboot

cd tftpboot

cp/etc/inittab/tftpboot/

tftp 172.18.1.90

tftp> get inittab

Transfer timed out.

tftp>quit

[root@localhost tftpboot]# netstat-a|grep tftp

[root@localhost tftpboot]# ls

inittab

[root@localhost tftpboot]# touch aaa

[root@localhost tftpboot]# ls

aaa inittab

[root@localhost tftpboot]# tftp 172.18.1.90

tftp> get aaa

Transfer timed out.

tftp> quit

不知何故出现“Transfer timed out.”的错误提示,想想没有修改tftp配置文件:

[root@localhost tftpboot]# cd/etc/xinetd.d

[root@localhost xinetd.d]# vi tftp

修改保存:

disable=no

server_args=-s/tftpboot/-c

[root@localhost xinetd.d]# cd/

[root@localhost/]#/etc/init.d/xinetd restart

Stopping xinetd: [ OK ]

Starting xinetd: [ OK ]

[root@localhost/]# netstat-a| grep tftp

udp 0 0*:tftp*:*

[root@localhost/]# tftp 172.18.1.90

tftp> get aaa

Error code 1: File not found

tftp> get inittab

Error code 1: File not found

tftp> quit

错误不一样了,以为需要安装tftpd服务器端,yum install tftpd没有源

但这次想起来新建/tftpboot/目录时候没有对该目录权限进行修改,就一切ok了

[root@localhost/]# chmod 777-R/tftpboot/

[root@localhost/]# tftp 172.18.1.90

tftp> get aaa

tftp> get inittab

tftp> q

[root@localhost/]# ls

aaa boot etc inittab lost+found mnt proc sbin srv tftpboot usr

bin dev home lib media opt root selinux sys tmp var

//根目录出现了aaa和inittab文件,下载成功!

再来试试上传文件:

[root@localhost/]# cd/tftpboot

[root@localhost tftpboot]# ls

aaa inittab

[root@localhost tftpboot]# rm aaa

rm: remove regular empty file `aaa'? y

[root@localhost tftpboot]# ls

inittab

[root@localhost tftpboot]# tftp 172.18.1.90

tftp> put aaa

tftp: aaa: No such file or directory

tftp> put aaa

tftp: aaa: No such file or directory

tftp> q

[root@localhost tftpboot]# cd/

[root@localhost/]# ls

aaa boot etc inittab lost+found mnt proc sbin srv tftpboot usr

bin dev home lib media opt root selinux sys tmp var

[root@localhost/]# tftp 172.18.1.90

tftp> put aaa

tftp> q

[root@localhost/]# cd/tftpboot

[root@localhost tftpboot]# ls

aaa inittab

上传成功!

上面错误原因就是tftp的执行目录要再根目录下进行,因为默认根目录为当前操作的目录

为啥ubuntu要配置tftp和nfs的作用

tftp是FTP服务文件上传下载用的,NFS server可以看作是一个FILE SERVER,它可以让你的PC通过网络将远端得NFS SERVER共享出来的档案MOUNT到自己的系统中,在CLIENT看来使用NFS的远端文件就象是在使用本地文件一样。

配置tftp

方法一:(推荐方法)Ubuntu10.04测试通过

1.安装TFTP软件

sudo apt-get install tftp-hpa tftpd-hpa

tftp-hpa是客户端,tftpd-hpa是服务器端

2.建立tftpboot目录,作为服务器的目录

sudo mkdir~/tftpboot

释放权限:(服务器目录,需要设置权限为777,chomd 777)

sudo chmod 777~/tftpboot

3.配置TFTP服务器

sudo gedit/etc/default/tftpd-hpa

将原来的内容为:

#/etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

#TFTP_DIRECTORY="/var/lib/tftpboot"#修改为自己需要的路径,与上面创建的目录一致

TFTP_ADDRESS="0.0.0.0:69"

#TFTP_OPTIONS="--secure"#可以通过查看mantftpd,看各种参数的意义

#修改为

TFTP_DIRECTORY="/home/shenhao/tftpboot"

TFTP_OPTIONS="-l-c-s"

3.重新启动TFTP服务

sudo service tftpd-hpa restart

4.测试下

$ cd~/tftpboot echo"hello tftp service">>a.txt

$ echo"hello tftp service,put to tftp serive">>b.txt

$ tftp localhost

tftp> get a.txt

tftp> put b.txt

tftp> quit

其中get是取得文件,put是将文件上传到TFTP服务器上。

方法二:

配置tftp服务的步骤:

1、安装相关软件包:tftpd(服务端),tftp(客户端),xinetd

sudo apt-get install tftpd tftp xinetd

2、建立配置文件(蓝色的目录是可以更改为其他地址的,例如/home/user/tftpboot)

在/etc/xinetd.d/下建立一个配置文件tftp

sudo vi tftp

在文件中输入以下内容:

service tftp

{

socket_type= dgram

protocol= udp

wait= yes

user= root

server=/usr/sbin/in.tftpd

server_args=-s/tftpboot

disable= no

per_source= 11

cps= 100 2

flags= IPv4

}

保存退出

3、建立tftp服务文件目录(上传文件与下载文件的位置),并且更改其权限

sudo mkdir/tftpboot

sudu chmod 777/tftpboot

4、重新启动服务

sudo/etc/init.d/xinetd restart

至此tftp服务已经安装完成了,下面可以对其进行一下测试。(假设在当前目录下有一个测试文件test.txt)

$tftp 192.168.16.2(本机的ip地址)

tftp> get test.txt

tftp> quit

$

通过get命令,可以把当前目录下的test.txt文件,通过tftp上传到它的服务文件目录。这时,在/tftpboot下面会出现test.txt文件。通过put命令,可以从/tftpboot下,下载test.txt文件。这样就验证了tftp服务配置的正确性。当文件上传与下载结束后,可以通过quit命令退出。

严格按照以上步骤配置tftp服务,一般都可以成功。如果出现无法get或者put的时候,可以查看一下防火墙是否关闭。

-----------------------------------------------------------------------------------------------------

配置nfs服务器

在ubuntu下安装、配置nfs服务的步骤如下:

1、安装nfs

Ubuntu上默认是没有安装nfs服务器的,因此我们首先安装nfs服务器端:

$sudo apt-get install nfs-kernel-server

在一些文档中,提出还需要使用apt-get来手动安装nfs的客户端nfs-common,以及端口映射器portmap,但其实这是没有必要的,因为在安装nfs-kernel-server时,apt会自动为我们把它们安装好。

2、配置/etc/exports

nfs允许挂载的目录及权限在文件/etc/exports中进行了定义。

例如,我们要将根目录下的rootfs目录共享出来,那么我们需要在/etc/exports文件末尾添加如下一行:

/rootfs*(rw,sync,no_root_squash)

其中:/rootfs是要共享的目录,

*代表允许所有的网络段访问,

rw是可读写权限,sync是资料同步写入内存和硬盘,

no_root_squash是nfs客户端分享目录使用者的权限,如果客户端使用的是root用户,那么对于该共享目录而言,该客户端就具有root权限。

其它nfs常用的参数有:

ro

只读访问

rw读写访问sync所有数据在请求时写入共享

async

nfs在写入数据前可以响应请求

secure

nfs通过1024以下的安全TCP/IP端口发送

insecure

nfs通过1024以上的端口发送

wdelay

如果多个用户要写入nfs目录,则归组写入(默认)

no_wdelay

如果多个用户要写入nfs目录,则立即写入,当使用async时,无需此设置。

hide在nfs共享目录中不共享其子目录

no_hide

共享nfs目录的子目录

subtree_check

如果共享/usr/bin之类的子目录时,强制nfs检查父目录的权限(默认)

no_subtree_check

和上面相对,不检查父目录权限

all_squash

共享文件的UID和GID映射匿名用户anonymous,适合公用目录。

no_all_squash

保留共享文件的UID和GID(默认)

root_squash

root用户的所有请求映射成如anonymous用户一样的权限(默认)

no_root_squas

root用户具有根目录的完全管理访问权限

anonuid=xxx

指定nfs服务器/etc/passwd文件中匿名用户的UID

anongid=xxx

指定nfs服务器/etc/passwd文件中匿名用户的GID

3、重启服务

$sudo/etc/init.d/portmap restart

$sudo/etc/init.d/nfs-kernel-server restart

4、测试nfs

此时可以运行以下命令来显示一下共享出来的目录:

$showmount-e

或者可以使用以下命令把它挂载在本地磁盘上,例如将/rootfs挂载到/mnt下:

$sudo mount-t nfs localhost:/rootfs/mnt

可以运行df命令查看是否挂载成功。查看后可以使用以下命令卸载:

$ sudo umount/mnt

阅读剩余
THE END