NAS 详细搭建方案 - 安装Ubuntu Server

目录


Ubuntu Server


1 下载与安装

1.1 下载地址

Ubuntu官网下载: http://cdimage.ubuntu.com/releases/18.04/release/
我这里采用的版本为 Ubuntu Server 18.04.1 LTS

1.2 安装

和安装win server一样,先镜像上传到ESXI,然后直接新建虚拟机就可以了。硬件配置我分配了2G内存和20G硬盘。
加载完毕后,选择语言、选择安装位置、选择引导位置,然后等待安装结束重启。

2 后续配置

2.1 设置root密码

sudo passwd root

Password:你当前的密码
Enter new UNIX password:这个是root的密码
Retype new UNIX password:重复root的密码

2.2 设置静态IP

Ubuntu18.04采用的是netplan来管理network。所以可以在/etc/netplan/目录下创建一个以yaml结尾的文件。比如01-netplan.yaml文件。
然后在此文件下写入以下配置(注意保留空格缩进):

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: no
      addresses: [192.168.1.102/24]
      gateway4:  192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 114.114.114.114]

然后重启网络

sudo netplan apply

2.3 修改时区

输入timedatectl status如果显示的时间不对,则使用如下命令修改时区

sudo timedatectl set-timezone 'Asia/Shanghai'

2.4 更新系统,升级应用

添加更新源。服务器版的ubuntu更新源很少,需要吧一些常用的更新源添加进去

sudo vi /etc/apt/sources.list

# 在最后添加下列源,并保存: #######################################
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

# 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
# ######################################################################

更新源及系统:

sudo apt-get update
sudo apt-get upgrade
  • 如果update出错
sudo vim /etc/resolv.conf
把nameserver的值换为8.8.8.8

再重启网络服务

/etc/init.d/networking restart

2.5 挂载nas盘

  • 挂载
sudo apt-get install nfs-common
cd ~
sudo mkdir nfs
cd nfs
sudo mkdir Download
sudo mount -t nfs 192.168.1.100:/Download /home/username/nfs/Download

# 添加开机自动挂载
sudo vim /etc/fstab

# 在文件最后加上下面内容
192.168.1.100:/Download /home/username/nfs/Download nfs defaults 0 0

  • 卸载
sudo umount 192.168.1.100:/Download /home/username/nfs/Download

3 安装必要的软件

sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install unzip
sudo apt-get install apache2
sudo apt-get install -y php7.2
  • 7
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
好的,以下是详细搭建PPPoE-Server的过程以及配置文件解释: 1. 首先,确保你的Ubuntu系统已经安装了pppoe和pppoe-server软件包。如果没有安装,可以通过以下命令安装: ``` sudo apt-get update sudo apt-get install pppoe pppoe-server ``` 2. 创建一个pppoe服务器的配置文件,可以在/etc/ppp/pppoe-server-options文件中进行编辑。以下是一个示例配置文件: ``` require-chap require-mschap require-pap refuse-pap refuse-chap refuse-mschap mtu 1492 mru 1492 asyncmap 0 auth crtscts lock hide-password novj novjccomp nologfd plugin /usr/lib/pppd/2.4.7/radius.so plugin /etc/ppp/radiusplugin.conf ``` 解释: - require-chap, require-mschap, require-pap表示只允许使用CHAP、MSCHAP和PAP认证。 - refuse-chap, refuse-mschap, refuse-pap表示禁止使用CHAP、MSCHAP和PAP认证。 - mtu和mru表示最大传输单元和最大重组单元的大小。 - asyncmap 0表示禁用异步映射。 - auth表示启用认证。 - crtscts表示启用硬件流控制。 - lock表示在使用PPP设备时锁定设备。 - hide-password表示在日志中隐藏密码。 - novj和novjcomp表示禁用VJ压缩。 - nologfd表示禁用日志文件。 - plugin /usr/lib/pppd/2.4.7/radius.so表示启用radius插件。 - plugin /etc/ppp/radiusplugin.conf表示radius插件的配置文件路径。 3. 编辑/etc/ppp/chap-secrets文件,添加用户和密码信息: ``` # Secrets for authentication using CHAP # client server secret IP addresses user1 * password1 192.168.1.100 user2 * password2 192.168.1.101 ``` 解释: - user1和user2表示用户名。 - password1和password2表示密码。 - *表示允许任何主机连接到服务器。 - 192.168.1.100和192.168.1.101表示允许连接的客户端IP地址。 4. 编辑/etc/ppp/pap-secrets文件,添加用户和密码信息: ``` # Secrets for authentication using PAP # client server secret IP addresses user1 * password1 192.168.1.100 user2 * password2 192.168.1.101 ``` 解释: - user1和user2表示用户名。 - password1和password2表示密码。 - *表示允许任何主机连接到服务器。 - 192.168.1.100和192.168.1.101表示允许连接的客户端IP地址。 5. 编辑/etc/ppp/ip-up.d/0dns-up文件,添加DNS服务器信息: ``` #!/bin/sh # Update resolv.conf with DNS information from pppoe [ -x /sbin/resolvconf ] || exit 0 case "$5" in pppoe) /sbin/resolvconf -a "${IFACE}.ppp" ;; *) ;; esac exit 0 ``` 解释: - /sbin/resolvconf -a "${IFACE}.ppp"表示添加DNS服务器信息到pppoe接口。 6. 编辑/etc/ppp/pap-secrets文件,添加用户和密码信息: ``` # Secrets for authentication using PAP # client server secret IP addresses user1 * password1 192.168.1.100 user2 * password2 192.168.1.101 ``` 解释: - user1和user2表示用户名。 - password1和password2表示密码。 - *表示允许任何主机连接到服务器。 - 192.168.1.100和192.168.1.101表示允许连接的客户端IP地址。 7. 启动pppoe服务器: ``` sudo pppoe-server -I eth0 -C /etc/ppp/pppoe-server-options -L 192.168.1.1 -R 192.168.1.100-192.168.1.200 ``` 解释: - -I eth0表示pppoe服务器使用的网络接口。 - -C /etc/ppp/pppoe-server-options表示pppoe服务器配置文件路径。 - -L 192.168.1.1表示pppoe服务器IP地址。 - -R 192.168.1.100-192.168.1.200表示pppoe服务器分配的IP地址范围。 8. 如果需要使用Radius认证,可以编辑/etc/ppp/radiusplugin.conf文件,添加Radius服务器信息: ``` # radiusplugin.conf # # This file contains the configuration for the radius plugin # # The format of the file is: # keyword argument1 argument2 ... # # The keyword is the name of the radius attribute to be set. # The arguments are the values of the attribute. # # For a complete list of radius attributes, see the dictionary file # (usually /usr/share/freeradius/dictionary). server = 192.168.1.1 login = user password = password nas-ip-address = 192.168.1.1 nas-port-type = Virtual nas-port = 0 service-type = Framed-User framed-protocol = PPP ``` 解释: - server = 192.168.1.1表示Radius服务器IP地址。 - login = user表示Radius服务器用户名。 - password = password表示Radius服务器密码。 - nas-ip-address = 192.168.1.1表示NAS IP地址。 - nas-port-type = Virtual表示NAS端口类型。 - nas-port = 0表示NAS端口号。 - service-type = Framed-User表示服务类型。 - framed-protocol = PPP表示使用的协议。 至此,PPPoE-Server安装与配置就完成了。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值